Possible to Isolate Trigger to Activate by Group of Users

emorganisc
Tera Contributor

Hi all, I was wondering if it is at all possible in any sort of way to limit the "when to run" exclusion in flow designer for a trigger to a group of users instead of maintaining a list of cherry picked individual users?

  • Do not run if triggered by the following users: Specify a list of users who cannot execute the flow.
  • Only Run if triggered by the following users: Specify a list of users who can execute the flow.emorganisc_0-1707612564418.png

     

Any advice is greatly appreciated, the current method of having to maintain this without groups is very frustrating!

1 ACCEPTED SOLUTION

That's no problem, you can create a TRUE/FALSE Flow Variable and set it to either true or false to indicate the 'updated_by' is part of the group. And you can use that within your IF Flow activity.

 

For example, you can refer to the following script for setting your true/false Flow variable

JamesChun_0-1708459344273.png

var runFlow = false;
if(gs.getUser().getUserByID(fd_data.trigger.request_item.sys_updated_by.toString()).isMemberOf(fd_data.flow_var.mygroup.getValue('name')))
{
    runFlow = true;
}
return runFlow;

You can modify the script above with your parameters.

 

Then use IF Flow action like below

JamesChun_1-1708459403618.png

 

Hope it helps, thanks.

View solution in original post

7 REPLIES 7

That is exactly what I did, however, I that logic won't work when I test it. Here is my setup:

emorganisc_0-1708442759191.png

The issue is the "Updated by" field is just a string, and the allowedUsers is a reference record to a group. So there needs to be a way to iterate over a group's members to compare it to the "Updated by" string. However, I do not see a way to access a group's members via flow designer, which is a bit of a disappointment.

That's no problem, you can create a TRUE/FALSE Flow Variable and set it to either true or false to indicate the 'updated_by' is part of the group. And you can use that within your IF Flow activity.

 

For example, you can refer to the following script for setting your true/false Flow variable

JamesChun_0-1708459344273.png

var runFlow = false;
if(gs.getUser().getUserByID(fd_data.trigger.request_item.sys_updated_by.toString()).isMemberOf(fd_data.flow_var.mygroup.getValue('name')))
{
    runFlow = true;
}
return runFlow;

You can modify the script above with your parameters.

 

Then use IF Flow action like below

JamesChun_1-1708459403618.png

 

Hope it helps, thanks.

Worked like a charm! Only modification I made was changing "request_item" to "current", otherwise, this is much more futureproof than what we were doing before. Hope SN responds to my idea, as adding this in the trigger when to run section saves a lot of hassle. Appreciate all the help James!

emorganisc_0-1708469802358.png