I want to populate work notes field from the comments field in alm_hardware table.

SamiranD
Tera Contributor

I want to populate work notes field from the comments field in alm_hardware table. So that it directly gets logged in activities filter. I want to do this using scripting. Please help

13 REPLIES 13

Ankur Bawiskar
Tera Patron
Tera Patron

@SamiranD 

you can use before update business rule and copy the comments to work notes

BR Condition: Comments Changes

Script:

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

    // Add your code here
    current.work_notes = current.comments.getJournalEntry(1);
	
})(current, previous);

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

SamiranD_0-1747893640788.png

Have wrote this script it is not working.
after saving the record nothing is getting updated in the work notes field.

@SamiranD 

your business rule should be Before update

what's your BR trigger?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

SamiranD_0-1747894289814.png

This is the BR trigger i am using.