Flow Designer | Compare Requestor in Group Member Table and Create Task without Approval

chatsaurav19
Tera Contributor

Hi All,

 

I have a requirement where , for example , if a RITM is raised using a specific Catalog Item, then in the Flow Designer, it will be required to check if the 'Requestor' belongs to the 'Knowledge Function Group'. If 'yes' then the SCTASK would automatically get created without any approval. 

 

The end user populates the 'Knowledge Base' field in the Catalog Item and Submits the Request.

 

Tables:::

=======

Requestor ::: sc_req_item ( Get the Requestor Name ) 
Group-User Relationship ::: sys_user_grmember ( Get the Users against each Group )
Group Mapping ::: x_custom_table ( Mapping between Knowledge Base and Knowledge Function Group ) . The 'x_custom_table' is the table which holds the mapping between Knowledge Base and Knowledge Function Group ( which is basically the sys_user_group )

 

Query ::: What should be the correct approach to achieve this, using lookup record, as this involves all the three tables as stated above?  Would it be possible to achieve this using conditions if not then what should be the script? I was trying to use the below script but then will this work?

 

chatsaurav19_0-1713871823449.png

 

var groupName = fd_data.trigger.current.knowledge_functional_team.name;
//var reqT = fd_data.trigger.current.request.request_for.name;

var arr = [];
var grUserGr = new GlideRecord('sys_user_grmember');
grUserGr.addQuery('group.name', groupName);
grUserGr.query();
while (grUserGr.next()) {
    arr.push(grUserGr.getValue('user'));
}

for(i=0; i<=arr.length; i++){
  if(reqT == arr[i]){
    return true;
  }
}

 

Thanks and Regards,

Saurabh Chatterjee

 

1 ACCEPTED SOLUTION

Uncle Rob
Kilo Patron

Easy peasy in flow designer.
1)  Look Up Records (plural!) on the sys_user_grmember table (where group memberships are stored)
- CONDITIONS
--- Group = Knowledge Function Group AND 
--- User = <drag requestor from Trigger Record>
2)  IF <drag COUNT from node 1> is GreaterThanOrIs 1

2.1)  Do the thing you want 
ELSE
2.2) Do the thing you don't want.

View solution in original post

12 REPLIES 12

Not sure how to ask for this... but I'd like to see the "full length data pill" that you're calling that returns a runtime value of null.

Thanks for replying, @Uncle Rob!  Here's what the Look Up Group Member Records looks like in my Flow, including the pill path.

UncleRob_0-1762694556212.png

I'm not sure if this is the precise problem but its my first guess.
User is expecting a sys_id, but you're retrieving all the way to name, which is a string.

Bob's sys_id = 71826bf03710200044e0bfc8bcbe5d3b
Bob's name = Bob

Bob != 71826bf03710200044e0bfc8bcbe5d3b

Therefore nothing should be returned in your group member query.