- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2023 05:37 AM
Hi I have created a BR on request table, where it checks whether its parent is empty or not.
if not empty then it glide incident table and check for the concerned parent incident and sets it state to request created.
upto this is fine, but I want to set the incident active to false along with its state.
var gr = new GlideRecord('incident');
gr.addQuery('sys_id',current.parent);
gr.query();
if(gr.next()){
gr.state = '9';
gr.active = false;
gr.work_notes='Incident converted to request \n Kindly access Request from Related List';
gr.update();
}
this is changing the state but not setting the active to false.
what to do?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2023 09:47 AM - edited ‎05-24-2023 09:51 AM
When I tested this and got it to work, I did the condition on the first tab..."when to run" via the GUI, not on the advanced tab. The advanced tab condition is still "current.incident_state != IncidentState.CLOSED && current.incident_state != IncidentState.CANCELED"
^^ I already deleted the custom state in my PDI before I took this screener, but I did this with a custom state of "Request created"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-25-2023 04:40 AM
Hi,
instead of updating the close code and notes why can't we update the data policy like canceled state?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-25-2023 07:07 AM
You may be able to do it with a data policy too -- but you definitely need the condition on the "incident reopen" BR, so that it doesn't trigger when you adjust the record (because it is a "before update" BR, it'll do the work it is trying to do first)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-25-2023 07:21 AM
it is working, but why it is showing the data policy exception for the new state and not for canceled state.?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2023 09:05 AM
Hello Rahul,
There are a couple out of the box things in play here that are preventing you from moving the active flag to 'false'. First since the Request Created is a custom value and is not technically a valid closed state this business rule is automatically flipping the active flag from "false" back to "true"
If you update the condition on that BR to include the Request Created state, you will then have a conflict with an out of the box data policy that requires Resolution code and Resolution notes to be populated. So in your script you'll need to populate those values as well in order for the updates to the record to occur.
var gr = new GlideRecord('incident');
gr.addQuery('sys_id', current.parent);
gr.query();
if(gr.next()){
gr.state = '9';
gr.active = false;
gr.close_code = 'Resolved by request';
gr.close_notes = 'Incident converted to request';
gr.work_notes='Incident converted to request \n Kindly access Request from Related List';
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2023 09:25 AM
oops, I'm too slow haha