简体   繁体   中英

sharepoint workflow 2013 find itemId in task

I used to Find workflow associated Item id with the SPBuiltInFieldId.WorkflowItemId

but when I use the new sharepoint workflow this column is empty.

What can I do to retrieve Workflow item id from the created task ?

For those who are trying the same using CSOM.

Step 1: First query the list in which the workflow is running with Item ID - 2

Step 2: Read the Field name which is created with your workflow name. 'VetriWorkFlow' is the workflow name and field name.

(FieldUrlValue)mlstItems[0].FieldValues["VetriWorkFlow"];

Step 3: In this field you will be able to see an instance id. Capture the same and pass it to 'WF4InstanceId' column in Workflow Tasks list.

<Where><Eq><FieldRef Name='WF4InstanceId' /><Value Type='Text'>#instanceID</Value></Eq></Where>

Result: You will get the list of tasks that are created for the list item 2.

Hope this helps. If there is any other simple way please share the same.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM