Limit ITIL access to tickets assigned to their group AND when they are the caller

Abbie4
Tera Contributor

Hello

 

I have a business rule setup on incidents which limit some ITIL users to only see tickets assigned to their assignment group:

if(gs.getUser().isMemberOf("GROUPNAME")){
 current.addEncodedQuery("assignment_group=GROUPSYS_ID");
 
However I also want them to be able to see tickets where they are the caller, regardless of which assignment group the ticket is assigned to. I can't seem to get it to work using the same business rule.
 
Help?

Thanks
Abbie
1 ACCEPTED SOLUTION

 Please use the below code and check if this works for you.

if (gs.getUser().isMemberOf('Group_Name')) {
current.addEncodedQuery("caller_idDYNAMIC90d1921e5f510100a9ad2572f2b477fe^ORassignment_group=group_sysid^ORwatch_listLIKEjavascript:gs.getUserID()");
}

 

 

View solution in original post

10 REPLIES 10

maroon_byte
Mega Sage

Try:

 

assignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744^ORcaller_idDYNAMIC90d1921e5f510100a9ad2572f2b477fe

 

Above same as below:

maroon_byte_0-1712235610447.png

 

Mark Manders
Mega Patron

Combine your query with the OOB user query:

var u = gs.getUserID();
		current.addQuery("caller_id", u).addOrCondition("opened_by", u).addOrCondition("watch_list", "CONTAINS", u);

Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

I tried this using the else if condition, but I can't seem to get it to work 😞 

1__AnithaHV
Kilo Sage

Hi Abbie,

Could you please try the below code in the query business rule.

 

(function executeRule(current, previous /*null when async*/ ) {

    // Add your code here
	var user = gs.getUserID();
    if (gs.getUser().isMemberOf('Group_Name'));
		current.addEncodedQuery('numberISNOTEMPTY^assignment_group=group_sysid');
  
  else if ('caller_id=' + gs.getUserID() + '^ORwatch_listLIKE' + gs.getUserID())
    
    current.addEncodedQuery('numberISNOTEMPTY');


})(current, previous);

 

Thanks,

Anitha H V