Freigeben über


Sharepoint Designer 2007 workflow error occurred on Update List Item when field is Person/Group

 

This is concerning an error found encountered in Sharepoint Designer based workflows after installing the October Cumulative updates.

The behavior you will encounter is the following:

 

Create a simple list with two fields:

Title (default)

User type Person/Group Lookup

 

Create a Sharepoint Designer Workflow attached to this list , set it to start manually.

 

In step 1 add an Action : Update List Item (or set Field Value to)

Update the User Field to a specific User

------------------------------

Create a new item in the list and start the workflow.

The resulted output is an Error Occurred Message in the Workflow History and the following error being logged in the Sharepoint logs:

Microsoft.SharePoint.SPException: Invalid data has been used to update the list item. The field you are trying to update may be read only. ---> System.Runtime.InteropServices.COMException (0x80020005): Invalid data has been used to update the list item. The field you are trying to update may be read only. at Microsoft.SharePoint.Library.SPRequestInternalClass.AddOrUpdateItem(...

Apparently, the same behavior occurs if you are trying to use the Set Field In Current Item Action instead.

To overcome this unwanted behaviors, here are the workarounds that can be implemented (if you choose not to go and install the latest updates or they do not work in your case):

1. Instead of updating the username with the AccountName of the User, as usual in Sharepoint Designer (DOMAIN\AccountName) use the following pattern Id;# Name of the User, or just ID , where Id is the Id of the user as in the site collection.

2. Develop a custom workflow in Visual Studio

3. Develop a custom Sharepoint Designer Activity to perform the same action, specifically, update the list item with the pattern we know is accepted.

4. Use another activity to retrieve the User's ID and then Update the custom field using the default action

Let's take them one by one , shall we ?

1. You can try updating the username by specifying an ID in Sharepoint designer but only if you already know the ID of the respective user.When it comes to dynamically retrieving it, it might not be such an easy task to implement.

2. Yeah right.( Like if you already have the skills to develop Visual Studio workflows you would still use Sharepoint Designer to do it :) )

3. Not so easy and, as above, if you have the skills ...

Anyway, for those of you wanting to have a go at this option, see the following materials on how this can be achieved, implemented and successfully developed:

Building Custom Activities for Use in SharePoint Designer 2007

Microsoft SharePoint Designer Team Blog : Adding Activities to SPD

4. Here is the simpler approach to get the functionality back until a fix will address the issue:

First, you need to download the codeplex project Useful Sharepoint Designer Custom Workflow Activities

NOTE! This project is at alpha stage and is provided "as-is" under the Microsoft Permissive License (MS-PL ) v1.1

Second, install it on the server where you want to get the functionality

Third, you need to adjust the workflows as it follows:

Replace the original Update List Item activity with  two activities:

 

1. Lookup User Information (part of the tools you just installed)

Lookup ID for user DOMAIN\Username , store in Variable:UserID              

"Domain\username" can be manually specified or looked up , if you were wondering :)

 

2. Update List Item

Update item in this List  (Set User Field to WorkflowData. Variable:UserID from above )

 

Ignition, Start !

NEWSFLASH !!! February Cumulative Update were released !!!

Among other things, a patch for the issue is comprised .

https://blogs.msdn.com/joerg_sinemus/archive/2009/02/25/february-cumulative-update-for-wss-v3-and-moss-2007.aspx

Comments

  • Anonymous
    January 01, 2003
    The response is in workaround 1 above
  1. Instead of updating the username with the AccountName of the User, as usual in Sharepoint Designer (DOMAINAccountName) use the following pattern Id;# Name of the User, or just ID , where Id is the Id of the user as in the site collection.
  • Anonymous
    February 26, 2009
    A more simple workaround for this issue could be: -> Add a new workflow variable of type string. -> Add a new workflow step at the begining of the workflow. -> Copy the value from the people field to the variable. -> Use the build dynamic string action to add this string to the beginning of the variable -1;# (and the original value of the variable after the string using a lookup) -> Use the variable in the action that require the value from the people field.

  • Anonymous
    April 29, 2013
    The workaround suggested by Daniel in the comments did the trick !!! But .......... I would be happy to understand what is the expression -1;# and why did adding it helped.. Thanks again