Copy field from a change task into the change request
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2017 01:35 PM
I know how to copy fields from the request over to the task but I have a requirement to copy a field we capture in an implement change task called 'Result' to a newly created field on our Change Request Form called "result' as well. But since our changes have multiple tasks associated with them I can't seem to get it to pull. Any thoughts?
I created a BR to run after the change state has closed complete with the following:
current.change_task_u_result = current.change_u_result_of_change
- Labels:
-
Change Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2017 02:39 PM
Hi Danielle,
Just to verify, you want to copy the result field on the change task to the change request when it is closed?
Here is the way I solved it based on my assumption stated above:
1) I created a field on change task called "u_result"
2) I created a filed on change request called "u_result"
3) I created a business rules called "Copy result from task to change" on the "change_task" table.
4) I set the When to "after" and checked the "Update" condition on the right
5) I also added a condition "State" changes to "closed complete" and "Result" is not empty condition.
6) Here is the script that I ran in my business rule.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var cr = new GlideRecord('change_request');
if(cr.get(current.change_request)) {
cr.u_result = current.u_result;
cr.update();
}
})(current, previous);
7) When you close your change task, the value in the result field is copied to the change request result field.
😎 NOTE: If you have multiple change tasks and want to copy all result fields to the change request, you need to update the code in the business rule to append instead of replace.
cr.u_result += current.u_result;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2017 07:30 AM
Thank you for really explaining how and why you did what you did. It really helped me to understand what I was doing wrong. I didn't think about building it on the task table for some reason and your solution worked great!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2017 08:12 AM
You're welcome. I'm glad it worked