Copy the Description, Short Description of existing incident record onto the existing problem record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2022 12:34 AM
Copy the Description, Short Description of existing incident record onto the existing problem records' description and short description.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2022 12:36 AM
Please elaborate your nee.
When you need this.
What is the relation between two tickets?
Thanks and Regards,
Saurabh Gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2022 12:39 AM
if the incident is raised on a particular problem , then if we update the description of incident, it will automatically update the description of problem table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2022 12:42 AM - edited ‎11-23-2022 12:43 AM
You can use below code in background script or in fix script
var gr = new GlideRecord("incident");
gr.addEncodedQuery("problem_idISNOTEMPTY");
gr.query();
while (gr.next()) {
var grProb = new GlideRecord("problem");
grProb.addQuery("sys_id", gr.problem_id);
grProb.query();
if (grProb.next()) {
grProb.description=gr.description;
grProb.short_description=gr.short_description;
grProb.update();
}
}
Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2022 12:47 AM
For Automatic updation you can write Br as below :-
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var grProb = new GlideRecord("problem");
grProb.addQuery("sys_id", current.problem_id);
grProb.query();
if (grProb.next()) {
grProb.description=current.description;
grProb.short_description=current.short_description;
grProb.update();
}
})(current, previous);