- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2020 09:15 PM
Hi All,
I need help on the below requirement. At the moment when the incident is resolved there will be an incident task gets created. Here i want to copy the state of the incident task to a string field on incident table. Already i've tried with the Display BR it's working but it's not saving the value, I've tried with before / after BR but no luck. Can someone guide me on how i can achieve the same.
Below is the simple piece of code that i'm using inside the Display BR
var rec = new GlideRecord('incident_task');
rec.addQuery('incident', current.sys_id);
rec.query();
if (rec.next()) {
current.u_category_on_open = rec.state.getDisplayValue();
}
Regards,
Arun
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2020 01:56 AM
Hi Arun,
I tried same in my PDI and it is working properly.
Check attached screenshots.
Business Rule -
Incident task record -
Incident record after resolved.
See result in log
Thanks,
Dhananjay.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2020 12:09 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2020 01:24 AM
Hi Swapnil,
Thanks for the reply. It's working for me on Display BR(Means on the form) but it will not save the value in the database it seems. Please create a report and query this incident and see the description field value. May be you can check it in the list view as well.
Regards,
Arun

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2020 02:09 AM
Ok i try this code in after insert update business rule
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var rec = new GlideRecord('incident_task');
rec.addQuery('incident', current.sys_id);
rec.query();
if (rec.next()) {
current.description= rec.getDisplayValue('state');
current.update();
}
})(current, previous);
Check the sc
It will work for me.
Try like that and let me know if any help.
If this works please mark correct and helpful.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2020 11:26 PM
Hi Swapnil,
Thank you so much.
Regards,
Arun

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2020 12:18 AM
Thank you arun!!
Regard
Swapnil