Enforce SLA Rules on Change Requests with Scheduled Job Trigger#1949
Enforce SLA Rules on Change Requests with Scheduled Job Trigger#1949chetnadev wants to merge 3 commits intoServiceNowDevProgram:mainfrom
Conversation
WillemZeiler
left a comment
There was a problem hiding this comment.
Thank you for your submission. Please see the comments on the code and readme. Feel free to make adjustments and submit the PR. Closing this PR
| task.initialize(); | ||
| task.short_description = "Escalation: Change not assessed in 48 hours"; | ||
| task.parent = gr.sys_id; | ||
| task.assignment_group.setDisplayValue('Change Management'); |
There was a problem hiding this comment.
This group is not the same for every company/instance. Can you add a comments so people know to adjust this?
| If a Change Request hasn't been moved to "Assess" state within 48 hours of submission, | ||
| automatically send a reminder and log escalation task. | ||
| This is a hybrid of a Business Rule + Scheduled Job (or Flow). | ||
| This code sets up an automated escalation process for change requests in ServiceNow. When a new change request is created, it schedules a job to run after 48 hours using a `sys_trigger`. |
There was a problem hiding this comment.
Why do you want to do this with code? Notifications can commonly be handled in the Flow. There is for example already an example SLA flow with reminders. If you can add to the readme why that would be helpful. Alternatively, include in the readme that there is also a Flow way of doing this, so people know that is also an option
| var timer = new GlideRecord('sys_trigger'); | ||
| timer.initialize(); | ||
| timer.name = "Change Escalation for: " + current.number; | ||
| timer.script = "new global.ChangeEscalationHelper().checkAndEscalate('" + current.sys_id + "');"; |
There was a problem hiding this comment.
Would not pass the sysId like that ('" + current.sys_id + "'). Better to get the sysId and pass it like this: current.getUniqueValue();
| timer.script = "new global.ChangeEscalationHelper().checkAndEscalate('" + current.sys_id + "');"; | ||
|
|
||
| var triggerTime = new GlideDateTime(); | ||
| triggerTime.addSeconds(60 * 60 * 48); // 48 hours |
There was a problem hiding this comment.
Can you think of a way this will be more configurable? For example using a system property where users can set the nr of hours? And in the script convert the hours entered to seconds?
If a Change Request hasn't been moved to "Assess" state within 48 hours of submission,
automatically send a reminder and log escalation task.
This is a hybrid of a Business Rule + Scheduled Job (or Flow).
This code sets up an automated escalation process for change requests in ServiceNow. When a new change request is created, it schedules a job to run after 48 hours using a
sys_trigger.If the change is still in the "New" state at that time, the Script Include sends a notification event and creates an escalation task assigned to the Change Management group. This ensures timely review and prevents unattended change requests.