- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2019 09:21 AM
As a change manager I would like a field on the form asking if an outage is required to ensure initiators are adding outages where required
Mandatory field (not when the form is in draft stage) - Outage required? Yes or No
If Yes, need to have an outage record included on the change related list before submitting for approval with error message appearing with message 'Right click on grey bar and click 'Create Outage'.
If there's already an Outage linked, it should allow the form to be submitted.
How can we achieve this?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2019 10:08 AM
You can do a UI/Data policy or client script to set the outage_required field mandatory under condition of state != -5 (or whatever draft state is).
Then you can have an on update business rule for checking if there is an associated outage when outage_required is true.
var gr = new GlideRecord('outage_table_name');
gr.addQuery('change', current.sys_id); //Whatever field on the outage relates to the current change record
gr.query();
//If nothing is found, abort action
if (!gr.hasNext()){
gs.addErrorMessage("Right click on grey bar and click 'Create Outage'")
gs.setAbortAction(true);
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2019 10:08 AM
You can do a UI/Data policy or client script to set the outage_required field mandatory under condition of state != -5 (or whatever draft state is).
Then you can have an on update business rule for checking if there is an associated outage when outage_required is true.
var gr = new GlideRecord('outage_table_name');
gr.addQuery('change', current.sys_id); //Whatever field on the outage relates to the current change record
gr.query();
//If nothing is found, abort action
if (!gr.hasNext()){
gs.addErrorMessage("Right click on grey bar and click 'Create Outage'")
gs.setAbortAction(true);
}