Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to restrict specific groups or categories of incidents to only its group members

Renu4
Tera Contributor

Hello All,

I want to restrict the HR group from everyone as it will contain confidential data.

I need guidance with it.

i have refered to the knowledge artile here:

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0790987

but not sure what wrong i am doing .

 

I have attached the image below for more info.

Thanks in Advance,

Regards,

Renu

 

 

14 REPLIES 14

Shivam Techlene
Tera Guru

Hello @Renu4 ,

 

Can you try the solution given below.

 

Create a before query business rule on incident table.

 

Check the advanced check box and put " !gs.getUser().isMemberOf('<name of the group to be restricted>') " in the condition field under advanced tab.

 

Put the script given below in the script field.

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

    current.addEncodedQuery('assignment_group!=<sys_id of the group to be restricted>');

})(current, previous);

 

Just change the values as per your requirements.

NOTE: Put group name in the condition field and group sys_id in the script field.

 

Please mark my answer helpful and correct if it resolves your requirement.

 

 

Thanks & Regards,
Shivam Jaiswal

Hello @Renu4,

 

Any updates on this one?

Did you get a chance to implement the solution I've given above?

 

Kindly mark my answer helpful and correct if it helps resolving your issue.

 

Thanks & Regards,
Shivam Jaiswal

Hello Shivam,

This works but it hides the tickets from the creater also.Say i create the ticket now then i dont get to view the ticket once it is submitted.

this should not be the case.

Hello @Renu4,

 

Thank you for the update. You can add one more condition inside the encoded query:

 

current.addEncodedQuery('assignment_group!=<sys_id of the group to be restricted> || sys_created_by==current.getUserName()');

 

Please let me know if it resolves your requirement.

 

 

Thanks & Regards,
Shivam Jaiswal

Hello @Renu4 ,

 

Did you get chance to try this one?,

Kindly mark my answers helpful & correct i it helps resolving your query.

 

Thanks & Regards,
Shivam Jaiswal