ACL script on ritm

zeeshan ahmed
Tera Contributor

Hello All,

 

I am creating Read ACL on the RITM table , i have included ITIL role in role condition and Assignment group is dynamic one of my groups or Assigned to is dynamic me in Data Condition(This restriction is working as expected). Along with this i want to also include catalog task assignment groups members to be able to see RITM's . How to include this in ACL script . 

Note: I don't want to use query Business Rule.

Thanks in advance

1 ACCEPTED SOLUTION

@zeeshan ahmed I've created new Read ACL on sc_req_item table with the below script and it's working as expected.

answer = false;
var groups = [];
var tasks = new GlideRecord('sc_task');
tasks.addEncodedQuery('request_item='+current.sys_id);
tasks.query();
while (tasks.next()) {
    if (!gs.nil(tasks.assignment_group)) {
        groups.push(tasks.getDisplayValue('assignment_group'));
    }
}

for (var i = 0; i < groups.length; i++) {
    if (gs.getUser().isMemberOf(groups[i])) {
        answer = true;
		break;
    }
}

 

View solution in original post

7 REPLIES 7

hi @Ankur Bawiskar ,

 

i tried all the above provided solution , still does not work for me .please find the attached screenshot . Along with these conditions i want Catalog task assignment group members should see RITM's of those catalog tasks

 

zeeshanahmed_0-1747050137792.png

 

@zeeshan ahmed 

there are many conditions, please share the script you tried and what debugging did you do?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@zeeshan ahmed I've created new Read ACL on sc_req_item table with the below script and it's working as expected.

answer = false;
var groups = [];
var tasks = new GlideRecord('sc_task');
tasks.addEncodedQuery('request_item='+current.sys_id);
tasks.query();
while (tasks.next()) {
    if (!gs.nil(tasks.assignment_group)) {
        groups.push(tasks.getDisplayValue('assignment_group'));
    }
}

for (var i = 0; i < groups.length; i++) {
    if (gs.getUser().isMemberOf(groups[i])) {
        answer = true;
		break;
    }
}