Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Populate values in journal field

neharao
Giga Contributor

Hi all,

I have a requirement where i need to populate the CI ´s from Affected CIs tab into the journal field (Additional comments) . Please find the screen shot below.

find_real_file.png

Kindly let me know how to proceed on this.

Thanks,

Neha

1 ACCEPTED SOLUTION

Please use below script in your business rule.



var aff = new GlideRecord('task_ci');


  aff.addQuery('task',current.sys_id);


  aff.query();


  gs.log("No of records " + aff.getRowCount());


  while(aff.next()){



  current.work_notes = aff.ci_item.getDisplayValue();


  //current.update();



  }


View solution in original post

6 REPLIES 6

Hi Sachin,



Thanks a lot. That worked



Thanks,


Neha


neharao
Giga Contributor

Hi all,



I have one more question to the above posted question. Now that the script works fine and affected CIs are added to the work_notes field. I have written this on 'Insert' and 'update' Business rule. But this is working when i change something on the field and save the form. For example: when i change the 'state' field on change request and save the form this works fine. I want it to be added to Work_notes field when i save the form.



Kindly guide me on this.



Thanks,


Neha