RNagahori
Nintex Observer

Office 365 REST API | Guide to Updating Multiple Selection Lookup

Hello Nintex Community!
 
I was faced with a challenge of updating the Parent Document relationship column of a given document/file. The "Update List Item" and "Office 365 update items" actions failed. I discovered that it might be possible to utilize the "Call HTTP Web Service" action to perform the column update.
 
I discovered several golden nuggets of data that helped me piece together the solution for updating a multi-selection lookup using the REST API.
 
Solution Overview:
WF1.png
 
1. Build String - File Path
Workflow Context: List Name = name of the list or library
Current Item: Name = file/document name with the extension (e.g.: QMS-Manual.docx)
WF1a.png
 
2. Set Workflow Variable - Library Name
Reference: My workflow is dynamic and accepts input from multiple source library workflows.
WF1b.png 
3. Build String - File URL
Reference: In this example, my parent approval workflow approves a document and converts the file document to PDF. This workflow is looking for the converted PDF file name.
WF1c.png
 
4. Build Dictionary - metadataObject
Important Note: {ListName} may need to be retrieved from the <EntityTypeName> element by navigating to this URL:
https://{entity}sharepoint.com/sites/{site-name}/_api/web/lists/getbytitle('{list-name}').
WF1d.png 
5. Build String - Parent Document Data
Important: Select return type for the Multiple Selection Lookup will need to be "Lookup Ids, Comma Deliminted".
Note: Be sure the variable is captured between the left and right brackets [ ].
WF1e.png 
6. Build Dictionary - request
Note: Define "results" as a Dictionary type variable.
WF1f.png 
7. Build Dictionary - Request Header
WF1g.png 
8. Build Dictionary - Request Body
Note: Define the Key as "ColumnName+Id". In my example, the Parent Document column is defined as Key "ParentDocumentId". Track down the EntityPropertyName by using this URL:
https://{entity}sharepoint.com/sites/{site-name}/_api/web/lists/getbytitle('{list-name}')/fields. The EntityPropertyName will provide you with the column name without spaces. Append "Id" to the EntityPropertyName and that will become the Key.
WF1h.png 
9. Build String - wsEndPointURL
Note: txtID is a variable that contains the ID of the converted PDF item.
WF1i.png  
10. Call HTTP Web Service - Update Parent Document
WF1j.png 
 
Fellow Nintex Community Members, I hope you find this information useful. 
 
#Office 365, #MERGE, #REST, #Multiple Selection Lookup

Reply