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

8 REPLIES 8

According to Google, "Liczba" is Polish for numbers of a thing. AKA, count. 

RobertFedoruk_0-1713900686898.png

 

Hi @Robert ,

 

My apologies for replying late but your solution worked! Loved the video as well.

 

Regards,

Saurabh

Uncle Rob
Kilo Patron

RobertFedoruk_0-1713878979093.png

 

Uncle Rob
Kilo Patron

Here, I made a video for you.

https://www.youtube.com/watch?v=PGjMHPJrqz0