Solved

Getting the value of a SharePoint Lookup column in NWC workflow

  • 21 October 2022
  • 5 replies
  • 535 views

Badge +3

I have not been able to find this answered else, so I apologize if it has already been answered. We are migrating our workflows from SharePoint 2013 to NWC and we frequently use values from the SharePoint look-up column types in the list in our workflows.  These are normally stored in the list as an ID for the value in the related list.  The SharePoint workflow products appear to be able to provide the value from the look-up column without an additional query, but NWC only provides the ID of the look-up column value in the start object. What is the best approach to get the mapped value from the lookup column? 

icon

Best answer by ethurber 21 October 2022, 20:44

View original

5 replies

Badge +6

Hello


I believe the only solution is to use the "Retrieve and item" action and pass it the ID (as an int) from the lookup field.


 


Hope this helps.


Ed

Userlevel 4
Badge +12

Hi @clrowe1124 ,


I think this might be part of the limitation of the SharePoint API that is triggering the start of the workflow.


I did a quick list with a lookup column.


First config was lookup column as title only.


Second config was lookup column settings as ID plus show Title as additional column displayed.


 


In both cases when I look at the API output (eg [SiteURL]/_api/web/lists/GetByTitle('TestLookup')/items)


it only displays the ID value for the column name in the API output.


 


I created a workflow to start as sharepoint online and new item created. From this I can only see the ID value in the lookup column. So from that you would need to do a query list to lookup the value in the workflow actions.


If doing a nintex form as the start action, the other options for looking this up would a data source lookup control or an external data source.


 


I did have a test with other API options such as:  /_api/web/lists/GetByTitle('TestLookup')/items(1)/FieldValuesAsText


In this case it retrived the display values of the lookup column rather than the underlying ID value.


 


It could be worth raising as an idea to return both the internal ID and display value for a lookup column in the workflow. https://ideas.nintex.com/ 

Badge +3

Using that action did the trick. I was looking for a single action vs "Query a List" that requires a loop to use the item the query retrieves.  Thanks for suggestion.

Userlevel 1
Badge +4

@Gavin-Adams: I have added such idea: Provide values from Multi-Lookup column in Start-Event | Nintex Ideas

Of course, I got it to work, but it would be much better, to have these values just like this :)

Badge

What if the lookup column has multiple values?

NWC gives me the value like this:

“1;2;3”

I can’t find an action that will allow me to convert this to an array through which I can loop and do a query.

Reply