Subflow to Create Approvals from Results of MRVS

jmiskey
Kilo Sage

I have a Catalog Item with a Multi-Row Variable Set (MRVS).  I need to iterate through all the records in the MRVS, and create an Approval for each Owner (one of the fields in the MRVS).

 

I was able to start this, and make sure that the loop is working correctly.  Currently, I have it loop through all the records, and have it log the Owner field value.  That is working perfectly, so I know my loop is good.  Here is what it looks like:

 

jmiskey_2-1690557494822.png

 

Here is the caveat/tricky part: Many times, the Owner will be repeated.  I only want one record to be created per Owner.

 

For example, if I have 4 records in my MRVS, and the Owner for each record looks like this:

RecordOwner
1Adam Allison
2Barb Berry
3Chris Curtis
4Barb Berry

 

I only want to create 3 approvals, not 4 (Barb Berry will get just one approval, not two).

How can I do this in my Subflow?

 

Thanks

 

1 ACCEPTED SOLUTION

 

Hm, thinking about it, if you need only an approval, you can simply go with the following solution:

MarkusKraus_1-1690588034195.png

 

A simple "All users approve" is sufficient. It will create an individual approval for each "owner" and go to the next step only when all users approved.

Would this work for you?

View solution in original post

9 REPLIES 9

Markus Kraus
Kilo Sage

The easiest way to get the "unique" users is to do a simple "Look up records" Action. However you need to convert the MRVS into a single line, you can do this by adding a new flow variable called "Owners" of type "string".
You need to iterate over the MRVS and concatenate the approval users.
Please check out the screenshot below, and note step 3.

MarkusKraus_0-1690562781604.png

In step 5 you iterate over the now unique sys_user records. To do the approval concurrently, you would need to create a new subflow which only contains the approval (and probably a syncronization variable so you know at some point that all approvals have happened). This subflow can be called with "Wait for Completion = false" so they run in parallel.

 

OK, that is helpful in getting me started, I think.  But you lost me on the last part regarding the approvals.  I set as you have shown, and that last step is not running:

jmiskey_0-1690564857400.png

 

Here is what that last step looks like:

jmiskey_1-1690564914820.png

 

Please click on each step which is related to the flow variable and check, if the variable is being properly populated.

Probably the easiest thing is to expand every step by clicking on it once and posting back the screenshot of the fully expanded flow execution.

OK, here it is:

jmiskey_0-1690570297858.pngjmiskey_1-1690570310643.pngjmiskey_2-1690570320363.pngjmiskey_3-1690570328237.pngjmiskey_4-1690570336294.png

Does that help?