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

OK, I found the error.  I needed to add a comma here in this step (I missed that in your original image):

jmiskey_0-1690573130408.png

 

But now I have having the issue you mentioned, where it is only creating one approval at a time (it will create the second when the first is complete).  I am not sure how to complete this step you mentioned:

"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."

 

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?

No, that still does the same thing.

Just to be clear, what I want to happen is that it generates 3 separate approvals at the same time, one for each person (Adam, Barb, and Chris).

 

The original suggestion and this new one creates one a time, and waits for it to be approved/rejected before going on to the next.  I don't want to do that.  I want all 3 at once.

 

I can create Wait steps to make sure all are approved/rejected before proceeding with the rest of the workflow - that is not a problem, I have done it before.  The issue is trying to consolidate any duplicate users and create multiple approvals at the same time.


@jmiskey wrote:

Just to be clear, what I want to happen is that it generates 3 separate approvals at the same time, one for each person (Adam, Barb, and Chris).

This is exactly what happens (if configured like i described): One sysapproval_approver record is created for each person. In the flow, there is only one Approval Action which is completed only after everyone has either approved or rejected their individual approvals.

 

I've created a proof of concept:

MarkusKraus_0-1690875179217.png

As you can see, the System Administrator is appearing twice. But the outcome is only one approval for him:

MarkusKraus_1-1690875217717.png

 


@jmiskey wrote:

The original suggestion and this new one creates one a time, and waits for it to be approved/rejected before going on to the next.  I don't want to do that.  I want all 3 at once.


You get this by configuring the "Approval" Action with the Rule "All users approve" (what I've highlighted in my previous reply).

 

Ah, I found the issue.  I was focusing so much on the Approval record, I failed to notice that I had it within a For Each loop (from my original attempt).  I got rid of that loop, and it now works like you suggested.

 

Thank you very much!