Caller is not (dynamic) one of my Assignment group

Alon Grod
Tera Expert

Hi,

 

I have the field 'hide_incident' of type True/False. 

I need to write a BR query on the incident table that will meet these 2 conditions:

 

1) hide_incident = True

2) caller and login user are not in the same assignment group.

 

How can I achieve that?

 

 

11 REPLIES 11

@Saurabh Gupta  

 

these two conditions are met:

1) hide_incident = True

2) the login user is not in the same group as the caller (no matter what is the assignment group of the incident)

Hi @Alon Grod 

 

Do you want a query business rule or insert/update BR?

 

 


Thanks and Regards,

Saurabh Gupta

@Saurabh Gupta  hi i want query BR.

Hi @Alon Grod 

 

I think this is not possible as in query BR current object is not available and hence we cannot check the groups of caller.

 

 


Thanks and Regards,

Saurabh Gupta

BharathChintala
Mega Sage

@Alon Grod  This is possible with before query but script will be complicated  as you need to get all incident callers and check in all groups combining logged in user. and storing big list of incident numbers sending that as query.

 

Best option is write read ACL 

in script

var arr = [];

var loguser = gs.getUserID();

var caller= current.caller_id;

var group = new GlideRecord('sys_user_group');

group.addQuery('active',true);

group.query();

while(group.next()){

var groupmem = new GlideRecord('sys_user_grmember');

groupmem.addQuery('group', group.sys_id);

groupmem.addQuery('user','IN',loguser,caller);

groupmem.query();

if(groupmem.getRowCount() ==2){

arr.push(groupmem.group.toString());

}

}

if(arr.length>=1){

answer= true;

}else{

answer = false;

}

 

 

 

 

If my inputs have helped with your question, please mark my answer as accepted solution, and give a thumb up.
Bharath Chintala