- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
6 hours ago
Morning,
I would like to see if it is possible to have the ability on a SLA Definition that the condition is based on whether the user has a role or not.
At present I have to manually add usernames into the SLA definition, which is not idea. I was think is there a way I could have the conditon based on if the user has a role or not.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
HI All,
Thanks for all your guidance. I have gone with a business rule that executes on the task table if the user has the role in question. That business rule thne looks up the active sla record and updates the state to "Paused"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5 hours ago
I believe your trying “pause SLA if user has role”
you can create a Boolean field on the Task table (Incident, Request, etc.) named e.g., u_user_has_role.
Create a business rule on the Task table that updates this field whenever the assigned_to/requested_for changes or record is updated:
- In your SLA Definition pause conditions, add: [u_user_has_role] [is] [true]
(function executeRule(current, previous /*null when async*/) {
var userGR = new GlideRecord('sys_user');
if (userGR.get(current.assigned_to)) { // Or current.requested_for depending on your need
if (userGR.hasRole('desired_role_name')) { // Replace with your role sys_id or name
current.u_user_has_role = true;
} else {
current.u_user_has_role = false;
}
} else {
current.u_user_has_role = false;
}
})(current, previous);
Thanks,
Vignesh
"If this solution resolves your issue, kindly mark it as correct."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5 hours ago - last edited 5 hours ago
I think you can use script include and then handle this
1) store the user names in system property
2) use gs.getProperty() or use GlideRecord to get system property value and then use it and return
check this
Implementing complex SLA definitions using decision table and script include
also see this link and enhance, response from Harsh Vardhan
Can we call script include from SLA filter condition?
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
HI All,
Thanks for all your guidance. I have gone with a business rule that executes on the task table if the user has the role in question. That business rule thne looks up the active sla record and updates the state to "Paused"