Restriction for one assignment group for Request , RITM , TASK and Incident

Manoj50
Tera Contributor

I have a requirement to restrict Request , RITM , Task ,incidents assigned to group "Security" members.  Security group members should access only those Record other than  Security group remaining Record should be Visible

I tried  Query business Rule ,Can someone let me know what I am doing wrong because when I impersonate security member that data visibility party is working as expected , i am able to create record , but it associated Work Flow is not getting triggered , can some please Help me to achieve this Thank you in Advance

 

I tried the Below Query Business Rule in TASK[task] table which is parent table, It is working but while at the  time of record creation its related workflow is not getting triggered 

 

Manoj50_0-1707294197845.png

 

Thanks,

Manoj

5 REPLIES 5

SunilKumar_P
Giga Sage

Hi @Manoj50, You can try with the before query business rule on the required tables.

 

Condition:

gs.getUser().isMemberOf('Security')

 

Script:

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

    var grpQuery = 'assignment_group=2e959678939335104b7733ddfaba1084';

    current.addEncodedQuery(grpQuery);

})(current, previous);

 

SunilKumar_P_0-1707296116624.png

 

Regards,
Sunil

 

Hi @SunilKumar_P 

In my requirement Request , RITM , Task , Incident all the records belongs to that group needs to be visible to that group only for other group it should not visible the data since i tried this script it is working but when we raise a request its following workflow is not getting triggered

 

Thanks, 

Manoj

var grpQuery = 'assignment_group=2e959678939335104b7733ddfaba1084';

    current.addEncodedQuery(grpQuery);

  

Dr Atul G- LNG
Tera Patron
Tera Patron

HI @SunilKumar_P 

 

Can we use sys id instead of group name?

gs.getUser().isMemberOf('Security')

 I am not  coder, but if we put group name that is not a good practice. or My understating is wrong 

*************************************************************************************************************
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]

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

Hi @Dr Atul G- LNG, Thanks for raising this point. I have just tested it by passing the group sys_id instead of name and it works as expected.

 

@Manoj50, As a good practice, you can create a system property with the value as group sysid and call the systemtem property in the script.

 

gs.getUser().isMemberOf(gs.getProperty('security.group.sysid'))

 

 

Regards,

Sunil