Today I’ve got a document library with an approval workflow on it. For the approval I’ve userequestdatad a Request data task.

Within the Request Data task I’m collecting some additional fields. This data will then be displayed within a list view web part on my page.

Some of these field the user will have to complete during thew approval process.

projectfield

Of the additional fields the Project field and the Director field is already available on the document that is being approved. Therefor I don’t really want to bother the user having to re-enter it. Simply updating the task with the data from my document would be a friendlier option.

Parallel Actions

I tried solving this problem with a parallel action in the Nintex workflow where one branch does the approval and the other one updates the task with the project details but that seems to just lock up the workflow.

Site workflow

I’ve then tried creating a site workflow. First I made sure that it is easy to find my document by adding the document ID to the Name of the task.

taskname

With the above in place I created a site workflow to query the task list

query1

The query will now return a collection and put it in my variable varTaskTitles.

With a for each task I’m now going through each of the tasks.

foreach1

So no my single line of text variable, varTaskTitle contains the title of the task. As the task title looks like the below, I can split the title into a new collection using a regular expression Action

123 – My task title

So now I’ve got a document Id.

So now it’s time to query the document library for the Directors and Projects.

query2

Now I’m splitting the varDirectors collection into single text line varDirector variable and I’ve collected the information needed to update my task.

Hmmm, it wasn’t this simple.

updateproject

When I tried to update the task I got the following error:

The workflow could not update the item, possibly because one or more columns for the item require a different type of information.

 

Quite quickly I got to a Microsoft site 

The workflow could not update the item, possibly because one or more columns for the item require a different type of information

This error commonly results from one of two situations:

  • One of the list fields was removed or changed, but the workflow was not updated to account for the change and is therefore trying to set a value for the old field. You should check all Update List Item actions in your workflow and make sure they are setting appropriate values for fields and that those fields exist on the list.
  • There is a data type error wherein the workflow is trying to set a value in a field in the list item using the wrong data type. You should confirm that the Return Field As operation in their lookup is of the correct data type.

I’m quite sure that I’m updating the task with the right data. So these options don’t seems to be the case. I even tried updating the task title, but still no luck. I couldn’t imagine that  the tasks would be locked.

So why would project be of the wrong type? Well it wasn’t!

I reviewed my update item action. and I’m using another field. The ID field in the query. varId looked set correctly but it wasn’t. There was some white space added to the ID. Once I trimmed the variable my updates worked perfectly.

 

 

 

By Pieter Veenstra

Business Applications and Office Apps & Services Microsoft MVP working as a Microsoft Productivity Principal Consultant at HybrIT Services. You can contact me using contact@veenstra.me.uk.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: