
Announcements
Hi All!
In my scenario I have a canvas app embedded in a CDS record. Basically I need to create a number o records, related to this record.
This part is usually easy, no problems with that. However I was wondering what is the best way to allow the app user to choose from a combobox 1 or more users and create a record of the related table for each one of the users selected and set it as owner of the record.
I attach a screenshot perhaps it helps to understand what i mean.
Thanks in advance
Nik
What about using Power Automate?
Have Power Apps pass the information of selected gallery item and 'array' of selected users to a Power Automate flow.
Then in Power Automate, use an 'Apply to Each' block to apply to all items in the selected users array, and run a 'Add new row' for the current CDS environment, in which you can use the selected gallery item variable as Primary Key for selecting which table to add the new row in.
Then once you completed the flow and saved it to Power Automate, you can import it in your Power App, and tie it to the "Create records" button.
Note that I tried testing myself this for a bit, and I noticed that you cannot actually pass an array as variable from Power Apps to Power Automate, so you need to package the table, in Power Apps, from the Combobox to a string first, and then in Power Automate from a string to object and then array. Tip: create the action in Power Automate first to initialise a string variable and request the variable from Power Apps. (If you request the variable in Power Automate from Power Apps in a object or array variable, then you will not be able to import the flow inside your app)
See: