cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jimal
Regular Visitor

Problem using the first result from List Records

I have leads coming in containing text names for countries from a web form that uses something akin to an option set, the lead arrives with the country name filled in a text column. In Lead, we use a custom table for country for reporting purposes and have a country lookup column to show it on the Lead form.

 

I want a flow to read the text name, look up the name column in the country table, then update the lead country look up column with the matched country.

 

I have set up a trigger which correctly pulls the effected lead when it is created (or updated). 

I have a List Row  action which allows me to search and find the country using the text column from the trigger.

I have set the Top Row to 1, it is correctly pulling one country row when I test.

 

I then am trying to update the original lead row, I know the preceding List Row action will create an Apply to All if I just select the GUID dynamically even though I limited the action to just one item to return. I have read elsewhere that the right process is to use a "first" expression to update my lookup field when updating the lead record. But I keep getting errors, the other examples of expressions I have seen here don't work. Can anyone help?

 

My country table GUID column name is c9_countryid

 

Here is my flow and the expression I can't fathom!

 

 
 

image.png

image.png

The first two actions pull data correctly,

The third action is updating the right row, I tested by adding some text to the notes fields and the whole flow reacts as expected and updates the original lead row.

My challenge is extracting the country GUID from the List Row action and then updating it in the third action.

 

To update the look up field in the Lead, I have this expression

 

first(outputs('List_country')?['body/c9_countryid'])

 

'List_country' is my second action.

c9_countryid is my primary ID for the country table.

 

When I view the failed run i get this error message which suggest the expression is not right for the file type?

 

Error Message:

image.png

 

image.png

 

Can anyone suggest what is the correct expression to use please?

 

 

2 REPLIES 2
jimal
Regular Visitor

I should have added, the last visual is cut from the raw data in the test, I wanted to show that the 2nd action is correctly pulling the GUID, I just can't then use it in the third action 😞

 

Hi @jimal 

 

Can you try outputs('List_country')?['body']?[0]?['c9_countryid']

 

Damien

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (4,242)