Skip to main content

Notifications

Power Automate - Building Flows
Unanswered

Set variable with a row id returned from List rows in a cloud flow

(0) ShareShare
ReportReport
Posted on by 31

Set variable with a row id returned from List rows in a cloud flow

I created a cloud flow that looks like the following:

gcoleman_3-1636518656121.jpeg

It’s designed to run instant on one or several Contact rows and create a Project row for each selected contact. The new Project row should have a column value for Project Type, which is a row from a third table.

  • I set the value of the string variable projectType with the result of the List rows step.
  • List rows has a filter (tamc_name eq 'RMD Support') and row count =1. It addresses the Project Types table.
  • I’m getting an error “Action 'Add_a_new_row' failed” with details “Bad Request - Error in query syntax.”
  • This error is about the Project Type value in the Add a new row in the Projects table step.

Here’s how I reference the value of projectType in the Add a new row step:

gcoleman_4-1636518807324.jpeg

Would appreciate any thoughts about what I’m doing wrong.

Am I supposed to extract a single value out of what List rows returns? (If so, how?)

Should projectType be a different datatype?

Is surrounding the variable value with <plural of table name>(<variable ref>) the correct syntax?

Should I use a better method for getting the row id for a specific Project Type?

 

Thanks.

  • rgriff50 Profile Picture
    rgriff50 31 on at
    Re: Set variable with a row id returned from List rows in a cloud flow--an update

    I’m surprised and disappointed I didn’t get any replies on this. I finally made it work on my own and wanted to help somebody like me in the future, who is just starting and needs basic, simple advice, by reporting what I think I learned.

     

    The key learnings were (1) my Set variable step needed to be placed inside an Apply to each step, and (2) I also needed to pull out from the row, the guid value for the Project Type instance to be put as the value of the corresponding field on the Project record being created (added).

     

    Here’s my overall flow that’s now working:

    gcoleman_0-1636690942918.png

    Here’s the detailed view of Set variable:

    gcoleman_1-1636690982375.png

    I believe the guid value available was from one of the columns of a selected row, not from the whole row itself. While I was trying to refer to the whole record of a selected row, I kept getting syntax errors.

     

    Then, once I had a valid value in the projectType variable, and I used the proper syntax for referring to it in the Add a new row step shown here:

    gcoleman_2-1636691039967.png

    everything finally worked.

     

    A particularly valuable reference I found was an article by Linn Zaw Win on his Power Platform Notebook blog. Win explains the proper format for referencing a lookup value is <<EntitySetName>>(<<RecordGUID>>) e.g. contacts(<ContactID>). Entity Set Name is the schema name of the table with an 's' on the end.

     

    If an expert reading this can correct any errors or misunderstandings, I would be grateful. Thanks.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,580

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,909

Leaderboard