- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2021 12:39 AM
Hi All,
After creating the change request with planned start date and planned end date fields. Automatically populate these dates in all change tasks.
Thanks in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2021 11:01 PM
Are you saying you want those fields to be auto-populated when change_task is created?
if yes then you can use before insert BR on change_task and set the fields
(function executeRule(current, previous /*null when async*/) {
// Add your code here
current.start_date = current.change_request.start_date;
current.end_date = current.change_request.end_date;
})(current, previous);
OR
You can also use flow designer to set the fields with no script
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2021 10:41 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2021 06:36 AM
Thanks for your replay.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2021 11:01 PM
Are you saying you want those fields to be auto-populated when change_task is created?
if yes then you can use before insert BR on change_task and set the fields
(function executeRule(current, previous /*null when async*/) {
// Add your code here
current.start_date = current.change_request.start_date;
current.end_date = current.change_request.end_date;
})(current, previous);
OR
You can also use flow designer to set the fields with no script
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2021 06:35 AM
Thanks Ankur for your replay.
it is working fine with my below script
Async insert BR on change request table
var ch_task = new GlideRecord('change_task');
ch_task.addQuery('change_request',current.sys_id);
ch_task.query();
while(ch_task.next()){
ch_task.planned_start_date = current.start_date;
ch_task.planned_end_date = current.end_date;
ch_task.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2021 06:37 AM
Hi,
your BR is async insert on change request.
What if there are no change tasks for that CHG?
by default CHG Task will be created post CHG Request; so not sure how the change tasks would be present as soon as CHG is created
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader