How can i restrict the access of incidents specific assigned to group xyz only to it's group members

Sowmya20
Tera Contributor

Hi,

 

I have requirement if incident assignment group is "XYZ" security checkbox is true. Then only part of the assignment group member incident ticket should visible. Other team should not have access to view these tickets.

 

Thanks in advance.

 

23 REPLIES 23

Hi @Sowmya20 

 

I am not a coder so may not able to guide you much. But we can wait for some experts.

 

@Anurag Tripathi  @Ankur Bawiskar 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Hello @Sowmya20 ,

 

Try the below script

 

(function executeRule(current, previous /*null when async*/ ) {
var q;
    if (gs.getUser().isMemberOf('811b20e21b72e700755b8480cd4bcb4a')) {
		gs.info('In if');
        q = current.addQuery("assignment_group", "811b20e21b72e700755b8480cd4bcb4a");
    } else {
		gs.info('in else')
		q = current.addEncodedQuery("assignment_group!=811b20e21b72e700755b8480cd4bcb4a");
    }
})(current, previous);

 

Please Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.

 

Regards,

Vaishnavi Shinde

Hello @Sowmya20 ,

In else part of above code add below condition and check 

 

q = current.addEncodedQuery("assignment_group!=36c741fa731313005754660c4cf6a70d");

 

Please Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.

 

Regards,

Vaishnavi Shinde

Hi Vaishnavi,

 

I tried the above code still not working.

In business rule when to run condition will be Before Query?

 

(function executeRule(current, previous /*null when async*/ ) {
var q;
if (gs.getUser().isMemberOf('811b20e21b72e700755b8480cd4bcb4a')) {// Add your sysID of group
gs.info('In if');
q = current.addQuery("assignment_group", "811b20e21b72e700755b8480cd4bcb4a");// Add your sysID of group
} else {
gs.info('in else');
q = current.addEncodedQuery("assignment_group!=811b20e21b72e700755b8480cd4bcb4a");
}
})(current, previous);

 

 

can we try using ACL?

Hello @Sowmya20 ,

 

Yes, it is before Query,

Have you checked the logs in script logs? Can you shar your when to run condition because that script is working properly at my end

 

Please Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.

 

Regards,

Vaishnavi Shinde