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

@SamiranD 

it worked for me, are you checking the correct field and how are you verifying that?

See below

AnkurBawiskar_1-1747895624345.png

 

AnkurBawiskar_2-1747895700312.png

 

Working solution

 

AnkurBawiskar_0-1747895604283.png

 

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

i am putting some value in comments( not additional comments) field, and then saving the record. Then if the code works the comments field value should come in the activities filter directly right?
Comments is a different out of the box field present in alm_hardware table.

@SamiranD 

comments field on alm_hardware is journal type?

If yes then it should show in activity filter if you have added that field using "Configure Fields" by clicking the funnel icon

AnkurBawiskar_0-1747897471053.png

 

If comments OOTB field is String type then use this

current.work_notes = current.comments;

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 

Hope you are doing good.

Did my reply answer your question?

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

phgdet
Mega Sage

Hi @SamiranD
Create a Business Rule on the alm_hardware table that triggers when the comments field changes, and copy the content to work_notes field.

 if (current.comments && !current.work_notes) {
        current.work_notes = current.comments;
    }