- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2022 05:34 AM
If someone is creating an emergency change we want to require at least one incident is added to the Incidents pending change related list. I am think this would be a business rule but I am not sure how to reference the related list.
Solved! Go to Solution.
- Labels:
-
Change Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2022 05:52 AM
Related list will appear only once the form is submitted. So, assuming you have to do a check on change table
Type | is | Emergency
&&
State | is | .... //as per your need
something as below for script should suffice your need.
(function executeRule(current, previous /*null when async*/) {
var checkchildincident=new GlideRecord('incident');
checkchildincident.addQuery('rfc',current.sys_id);
checkchildincident.query();
if(checkchildincident.getRowCount()<1)
{
gs.addErrorMessage('Ensure atleast once incident is attached for change.');
current.setAbortAction(true);
}
})(current, previous);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2022 05:44 AM
When you say require, is this to allow the state to be changed to a certain value (i.e the change progressed)?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2022 06:03 AM
Correct. In order to move the change from draft to the next stage we want to make sure the change has an incident tied to it.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2022 05:49 AM
Hey,
I think you are looking for an "Incident Fixed by Change" related list.
So, this is not a separate table but the incident table itself.
If you go to a incident record, In related records you will find Change request field, once you add a change, you can spot that incident in your related list on change form.
You just need to GlideRecord your incident table in the BR on Change table, an check if an incident is associated with that Reference field on Incident form.
Aman Kumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2022 05:52 AM
Related list will appear only once the form is submitted. So, assuming you have to do a check on change table
Type | is | Emergency
&&
State | is | .... //as per your need
something as below for script should suffice your need.
(function executeRule(current, previous /*null when async*/) {
var checkchildincident=new GlideRecord('incident');
checkchildincident.addQuery('rfc',current.sys_id);
checkchildincident.query();
if(checkchildincident.getRowCount()<1)
{
gs.addErrorMessage('Ensure atleast once incident is attached for change.');
current.setAbortAction(true);
}
})(current, previous);