Office 365 REST API | Guide to Updating Multiple Selection Lookup

  • 22 April 2020
  • 0 replies
  • 36 views

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:
7567i9DCD8A2346F593AF.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)
7568i91AA6CA165DDB8A7.png
 
2. Set Workflow Variable - Library Name
Reference: My workflow is dynamic and accepts input from multiple source library workflows.
7569i23688E52ACDBA6B4.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.
7570i43B73EC3D54EEA45.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}').
7571iB6986DB753161F5A.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 [ ].
7572iB3987650AE29EF54.png 
6. Build Dictionary - request
Note: Define "results" as a Dictionary type variable.
7573iF4F487EE7D8F2794.png 
7. Build Dictionary - Request Header
7574iD460533245958615.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.
7575i096F317C881063B0.png 
9. Build String - wsEndPointURL
Note: txtID is a variable that contains the ID of the converted PDF item.
7576i46EF1B84E5AA9A3C.png  
10. Call HTTP Web Service - Update Parent Document
7577i3427B0CD1F7D1961.png 
 
Fellow Nintex Community Members, I hope you find this information useful. 
 
#Office 365, #MERGE, #REST, #Multiple Selection Lookup

 


0 replies

Be the first to reply!

Reply