Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Get and set SPFieldUserValue from Workflow

$
0
0

Hi,

I can't get or set SPFieldUserValue field in the list. Field name is Initiator.

Set operation.

For setting I use UpdateListItem activity and as a value for Initiator field I use such string:

"i:0#.w|domain\user"

As result, I get an error, by looking at CorrelationID I can see this message:

OData Exception Reading Entity Body: Microsoft.Data.OData.ODataException: A 'PrimitiveValue' node with non-null value was found when trying to read the value of a navigation property; however, a 'StartArray' node, a 'StartObject' node, or a 'PrimitiveValue' node with null value was expected.

And after a few retries WF gets suspended with "Value cannot be null" exception.

Now about getting data.

I use LookupSPListItem and pass there properties collection. I try to get user Title by using the following path

"Initiator/Title"

The problem is that activity makes request URL like this

$select=ID,ContractNumber,Title,FileLeafRef,Initiator/Title

but it doesn't add the necessary $expand part:

$expand=Initiator/Title

As a result, WF gets suspended with "The query to field 'Initiator' is not valid. The $select query string must specify the target fields and the $expand query string must contains Initiator." error message.

How can I accomplish both tasks?





Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>