
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2024 02:08 AM
Hi,
I am working on a scenario where the Description field from a Problem record will be copied to associated incident records once the problem record is saved. I have done everything but the Description in Incident records is not getting updated with the Description of the problem record once is saved the problem record. Kindly help.
(function executeRule(current, previous /*null when async*/) {
var gr = new GlideRecord("incident");
gr.addQuery('problem_id', '3D62304320731823002728660c4cf6a7e8');
gr.query();
while(gr.next()){
gr.description = current.description;
gr.update();
}
})(current, previous);
Regards
Suman P.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2024 02:26 AM
Hello @Community Alums ,
You need to create a BR on after insert/Update on problem table and follow the below script that will help you. I tried in my PDI it is working as expected.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var inc = new GlideRecord("incident");
inc.addQuery("problem_id",current.sys_id);
inc.query();
if(inc.next()){
inc.description=current.description;
}
inc.update();
})(current, previous);
Please mark my answer as accepted solution and give thumbs up, if it helps you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2024 02:46 AM
Hi @Abhishek_Thakur,
I am passing directly the sys id instead of the current.sys_id, why do you think it is wrong?
Regards
Suman P.