Auto Populate the RITM record field in the related task table record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2023 03:55 AM
Hi,
I have a RITM record which has a TASK record in related field. Whenever i change the field in the parent the parent RITM record the same change should be reflected in the child task record.
I have created two custom fields in the ritm tabe:
1. my additional comments - this is string field
2. my status - this is choice field with value - completed and cancelled
The corresponding field in the task table
1. my task additional comments - this is string field
2. my task status - this is choice field with value - completed and cancelled
Whenever these fields get change in parent RITM these should change in child task and reflect the same value. Could you please help with this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2023 03:59 AM
Is this a business requirement?
I could see you have created a new choice field but you could already use OOB state field
You also created comments field whereas you can easily use OOB comments field.
Your requirement is easy. what script did you start with and where are you stuck?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2023 04:23 AM
Hi @Ankur Bawiskar ,
Yes, this is a business requirement.
Could you please help with the script, i have tried after update BR but it is not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2023 04:25 AM
please share script you started with and what debugging have you done so far?
it should be an easy script
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2023 04:46 AM
Without knowing your specifics you could do something like the below
In the condition you would put your additional comments changes or your tasks status changes (I have used state in my example)
And then you would script something like this.
(function executeRule(current, previous /*null when async*/) {
var taskGR = new GlideRecord('task');
taskGR.get(current.task);
taskGR.comments = current.comments;
taskGR.state = current.state;
taskGR.update();
})(current, previous);