- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2024 04:56 AM
I am creating new problem record when incident created with BR. its working as expected. but the issue is when i resolve the incident the associated problem should be closed automatically. but its my code is not working as expected. below i am sharing my script and conditions for the reference. Please any help would be appreciated. T
After BR - Update , Table- Incident.
i have added infoMessages for testing and those are triggered correctly.
Thanks in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2024 07:08 AM - edited ‎04-28-2024 07:09 AM
Hi @Jaya Chandra Re
Use the below script but lets try to understand few things
1) We should use gr.addQuery("sys_id", current.problem_id) because you can see problem_id is present on the incident form and when you are querying problem table, you should compare the sys_id of problem with the sys_id present in problem_id
2)You can open the dictionary of state field in problem table. Go to the choices and bring the table field. Among all the choices that are closed, only 107 is a match for problem table. Please refer the attached screenshot
3) Once you have confirmed everything as mentioned above, use the below script. It will be after update BR and condition also remains same
var probRcd = new GlideRecord('problem');
probRcd.addActiveQuery();
probRcd.addQuery("sys_id", current.problem_id);
probRcd.query();
if (probRcd.next()) {
probRcd.state = '107';
probRcd.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2024 08:02 AM
Hi @Jaya Chandra Re ,
In the problem record there some mandatory field that we have to fill to move state from new to resolved.
So for that i have created on script please try this once