Set variable with a row id returned from List rows in a cloud flow
I created a cloud flow that looks like the following:
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.
Here’s how I reference the value of projectType in the Add a new row step:
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.
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:
Here’s the detailed view of Set variable:
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:
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.