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

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.

Hi @Robert ,

 

Thank you for your response. Can you please let me know how to select 'Count' in the 'If' Condition?

 

chatsaurav19_0-1713882467650.png

 

chatsaurav19_1-1713882523011.png

 

Regards,

Saurabh

Don't use Look Up Record.  Use Look Up RecordS

Look Up Records will have a node property called Count.  Then you just drag that into the first part of your condition.

Hi @Robert,

 

I did that yet I do not see it...

 

chatsaurav19_0-1713883541597.png

 

chatsaurav19_1-1713883579634.png

 

 

Regards,

Saurabh