"Updated" and "Updated by" fields

jleyco
Mega Contributor

Hi all!

Currently "Updated" and "Updated by" fields only reflect when there is a field change.

I would like to have any task's (incident, change, catalog task, etc.) "Updated" and "Updated by" fields reflect (1) when a work note or comment was added and (2) who added the work note or comment.

Idea on how to do this?

5 REPLIES 5

Anurag Tripathi
Mega Patron
Mega Patron

try this..



write a br that runs after comment or worknotes changes(for these tables only) and force update the record in that BR. that might do the trick


-Anurag

jleyco
Mega Contributor

Thanks, Anurag. I actually saw one of your responses to a similar question! Am I missing anything below? (Note: I'm very new to scripting!)



        CONDITION:


        current.comments.changes() || current.work_notes.changes()



        SCRIPT:


        current.sys_updated_on=gs.nowDateTime();


        current.sys_updated_by=gs.current.userID



        WHEN TO RUN:


        after insert/update


SCRIPT:


        current.setForceUpdate(true);



rest all okay


-Anurag

Hi Jessica,



I would suggest not reusing these fields as values are set by ServiceNow itself and will likely change at other times.   You can easily create new fields on relevant tables for this.



You could also use metrics to capture when and who added every comment which becomes data for reporting and can show in the metrics timeline.   This really depends if you need to know things like volume and frequency of updates



Simon