- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2016 04:50 AM
If a change is created from an incident using the 'create Change' UI action on incident form, the incident from which the change is created can usually be resolved/closed without closing the change. How can this be prevented?
The incident should not be allowed to be closed/resolved unless the Change created from it is closed.
Any help is really appreciated
Thanks,
Harsha
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2016 05:04 AM
Hi Harsha,
It would be better if you can hide the 'Closed' option from incident state field if change is not in closed state. Or else you can abort update action by writing before update business rule on incident table which should trigger whenever state changes to closed state. Here is the sample code snippet
Condition: current.state.changesTo('Closed state choice value')
Script:
var flag=false;
var chg=new GlideRecord('change_request');
chg.addQuery('parent.sys_id',current.sys_id);
chg.query();
while(chg.next()){
if(chg.state!='closed'){
flag=true;
break;
}
}
if(flag==true){
current.addErrorMessage('Can't update incident state');
current.setAbortAction(true);
}
Thanks
Abhinandan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2016 05:04 AM
Hi Harsha,
It would be better if you can hide the 'Closed' option from incident state field if change is not in closed state. Or else you can abort update action by writing before update business rule on incident table which should trigger whenever state changes to closed state. Here is the sample code snippet
Condition: current.state.changesTo('Closed state choice value')
Script:
var flag=false;
var chg=new GlideRecord('change_request');
chg.addQuery('parent.sys_id',current.sys_id);
chg.query();
while(chg.next()){
if(chg.state!='closed'){
flag=true;
break;
}
}
if(flag==true){
current.addErrorMessage('Can't update incident state');
current.setAbortAction(true);
}
Thanks
Abhinandan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2016 05:07 AM
You can do a onSubmit client script
if(g_form.getValue('state') == 7){
var state = g_form.getReference('change', changeState);
}
function changeState(state){
if(state != 4){
alert('You must close the associated change before closing the incident');
return false;
}
]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2016 05:13 AM
Hi,
Write a business rule on incident table take values of problem from related list and glide record the change table check the status and prevent it and add info message.