How to restrict integration user
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
6 hours ago
Hi All
I need someone help in my requirement. My requirement is, If a sc_task state is either "Open, Pending or Work in progress" and at the same time if the "requested for" active status changes to "false" then I need to update the sc_task state to "Pending Cancellation". For this I have written a "After" business rule on "Update" in the "sys_user" table. The problem I am facing is, there are few integration user which is running on user table but they are not updating the "Active" value to "false". Still my BR is getting triggered and it is updating the sc_task state to "Pending Cancellation".
Please help to fix this issue. I am not able to find the root cause for the same. I have shared my script below.
Table: sys_user
BR: After and On Update
Filter Condition: Active changes to False.
Script:
if (previous.active == true && current.active == false) {
var userSysId = current.sys_id;
cancelCatalogTasks(userSysId);
}
function cancelCatalogTasks(userSysId) {
var catalogTaskGr = new GlideRecord('sc_task');
catalogTaskGr.addQuery('cat_item', '57be3d29b7121010189e22b5de11a937');
catalogTaskGr.addQuery('requested_for', userSysId);
catalogTaskGr.addQuery('state', 'IN', [1, 2, -5]);
catalogTaskGr.query();
while (catalogTaskGr.next()) {
catalogTaskGr.state = -6;
catalogTaskGr.work_notes = 'Reason for escalation: User is inactive.';
catalogTaskGr.update();
}
}
})(current, previous);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
6 hours ago
I'm not sure why is this happening to integration users.
If you want to avoid running this BR for Integration Users then you can add the below condition:
Palani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
if the above BR is not getting triggered then any other logic is updating SC Task?
what debugging did you do?
Did you try disabling this BR and confirm the issue?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
BR is triggering, problem is why it is triggering when the condition is not matched.