Using UpdateListItems doesn't appear to support Person/Group field type


Badge +5

We're building a Nintex WF on SP2013 to update various lists we reuse on multiple site collections within our farm. In cases when list items need to be updated, we're using the Web Request action successful to update text & other fields. However, multiple attempts to update a person/group field type has failed, except in one case.

The person/group field we're using tracks a single owner's name for this particular Functional Area (think department manager). There are several options for assigning a person/group field to a variable - and all but one failed when passed in the in the request (see XML below):

  • As String - returns  i:0#.w|domainusername (Failed)
  • As Display Name - returns valid Firstname Lastname (Failed)
  • As Login name - returns i:0#.w|domainusername (Failed)
  • As Email - returns valid email address myName@domain (Failed)
  • As UserID Number - returns the lookup ID of the user in the User Profile list (works)

Has anyone else experienced this problem - and is it by design?

The additional problem this creates is that the User Profile list appears to be generated for each site collection and the ID's are not the same from one site collection to the next. I've been able to verify this by visiting the profile pages for a single user on multiple site collections & the ID's vary.

So it seems one would be able to use something like a Web Call to the UserProfileService.asmx & the GetUserProfileByAccountName method to find the ID. Unfortunately, I've been unable to find the documented property of the lists ID for that user. Any clues to what this might be?

<?xml version="1.0" encoding="utf-8"?>

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:m="http://schemas.microsoft.com/sharepoint/soap/">

  <soap:Header>

  </soap:Header>

  <soap:Body>

        <UpdateListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">

           <listName>{WorkflowVariable:txtListGUID}</listName>

             <updates>

                  <Batch OnError="Continue" ListVersion="1">

                  <Method ID="1" Cmd="Update">

                       <Field Name="ID">{WorkflowVariable:itemUpdateID}</Field>

                       <Field Name="FASiteName">{WorkflowVariable:txtFAsitename}</Field>

                       <Field Name="FunctionalAreaOwner">{WorkflowVariable:usrFAOwner}</Field>

                       <Field Name="IsActive">{WorkflowVariable:ynFAactive}</Field>

                  </Method>

                  </Batch>

              </updates>

         </UpdateListItems>

  </soap:Body>

</soap:Envelope>

TIA,

Gerard


5 replies

Badge +1

Hi,

You can try this out.

<Field Name='UserName'>[ID];#[Person]</Field>

User Field Format:  

Single user = [ID];#[Person]

Multi user = [ID];#[Person];#[ID];#[Person];#[ID];#[Person];#

if you don't know the ID of the person, you could use -1

Example: -1;#Display Name

Badge +2

Amazing timing. I'm doing exactly the same thing.

I got it to work by using -1;#loginname

Thanks!

Badge +5

Thanks for the response. I was able to modify the update XML so that it works using the Display Name. Based on Robyn's reply the Login name works as well. For reference here's what the modified XML's update section looked like.

            <updates>

                  <Batch OnError="Continue" PreCalc="TRUE" ListVersion="0">

                  <Method ID="1" Cmd="Update">

                      <Field Name="ID">{WorkflowVariable:itemUpdateID}</Field>

                      <Field Name="FASiteName">{WorkflowVariable:txtFAsitename}</Field>

                      <Field Name="FunctionalAreaOwner">-1;#{WorkflowVariable:txtFAOwner}</Field>

                  </Method>

                  </Batch>

              </updates>

Regards

Badge +4

Thank you Lui.

This is very helpful. I also got it working for single user using -1;#loginname

I wonder how to use it for multiple user fields.

The task is to copy an already populated multi user field to another list.

When I read the field I get "display name user1;display name user2"

How could this be translated into [ID];#[Person];#[ID];#[Person];# 

Do I need to separate those values using build string or Regular Expressions?

Or is there an easier way.

Does anybody have a suggestion.

Thanks

Thomas

Badge +4

I found the following solution:

use Build String action and convert the variable returned from the multi people field (return type: Display Names, Semicolon Delimited):

;#-1;#fn-Replace({WorkflowVariable:MultiPeopleDisplayName},;,;#-1;#);#

It adds ";#-1;#" at the beginning and ";#" at the end while the function replaces the ";" separating people with ";#-1;#"

Now it could be used with any number of people.

I tested it successfully with one, two and three people happy.png

Thanks again for your help.

Reply