How can i set old and new value in a field?

Ankit Kumar6
Tera Contributor

HI,

 

On change of a caller in an incident, how can I set old and new caller email in additional comments ?

 

Thanks,

Ankit

1 ACCEPTED SOLUTION

AnveshKumar M
Tera Sage
Tera Sage

Hi @Ankit Kumar6 

You can use a before update Business rule like the one below.

 

AnveshKumarM_0-1697612987916.png

 

AnveshKumarM_1-1697613002578.png

 

AnveshKumarM_2-1697613017147.png

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

	current.comments = "Old caller email: " + previous.caller_id.email + "\n New Caller email: " + current.caller_id.email;

})(current, previous);

 

And the result is:

 

AnveshKumarM_3-1697613031985.png

 

Please mark my answer helpful and accept as solution if it helped you 👍✔️

Thanks,
Anvesh

View solution in original post

2 REPLIES 2

AnveshKumar M
Tera Sage
Tera Sage

Hi @Ankit Kumar6 

You can use a before update Business rule like the one below.

 

AnveshKumarM_0-1697612987916.png

 

AnveshKumarM_1-1697613002578.png

 

AnveshKumarM_2-1697613017147.png

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

	current.comments = "Old caller email: " + previous.caller_id.email + "\n New Caller email: " + current.caller_id.email;

})(current, previous);

 

And the result is:

 

AnveshKumarM_3-1697613031985.png

 

Please mark my answer helpful and accept as solution if it helped you 👍✔️

Thanks,
Anvesh

Ankur Bawiskar
Tera Patron
Tera Patron

@Ankit Kumar6 

you can use before update BR and handle it

what script did you start with and where are you stuck?

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