Copy description from Change Request to Change Task

peggy1
Kilo Contributor

Hi,

I have been trying to auto populate description value from a Change Request to Change Task. Not having any luck Been trying to use

Business Rules.

At present, we have a standard change template that has change tasks automatically populated through Execution Plans.

I would like all the change tasks to have the description field to be the same as the parent Change Request's description upon creation of the tasks.

I've read different posts here but most are scripts for workflow.   But I'm not using a workflow.   Is there a Business Rule script/set up I could use to do so?

Your help will be greatly appreciated.   Thanks.

1 ACCEPTED SOLUTION

Hi Peggy,



Your script seems to be fine.



Are you sure, the 'Description' value from Change request does not copy over AFTER you insert the Change-Task record ?



I've just tried the below in my personal instance and working as expected:


chg_task_desc1.PNG


chg_task_desc2.PNG


View solution in original post

12 REPLIES 12

Thanks for your reply Abhinay.


I still can't get it to work


Below are screenshots of what I've created.   Please let me know where my mistake is.



Capture1.PNG



find_real_file.png



Thanks again.


You're missing:



(function executeRule(current, previous /*null when async*/) {




  // Add your code here


current.description=current.change_request.description;



})(current, previous);



harel


peggy1
Kilo Contributor

Hi Harel,



Still doesn't work.       Change Tasks description field still empty unfortunately.



find_real_file.png



find_real_file.png



As you can the description is still not populated upon creation of the tasks.


Put a gs.log() statement in your script and see if log shows it.



On Tue, Jan 17, 2017 at 17:35 peggy <community-no-reply@servicenow.com>


Hi Peggy,



Your script seems to be fine.



Are you sure, the 'Description' value from Change request does not copy over AFTER you insert the Change-Task record ?



I've just tried the below in my personal instance and working as expected:


chg_task_desc1.PNG


chg_task_desc2.PNG