How can I get the display value from oldValue in a client script?

gjz1
Giga Expert

I have a requirement to store the old display value of a reference field in a string field.  I'm using an onChange client script, but I can't figure out how to get the display value from oldValue.  Does anyone know how I can accomplish this?  What I have written returns the sys_id, I need the display value.

TIA

find_real_file.png

12 REPLIES 12

Nisar Khan1
Mega Sage

have you tried oldValue.getDisplayValue() ?

getDisplayValue() isn't available on a client script.

Willem
Giga Sage
Giga Sage

As the great Ashutosh replied here:

https://community.servicenow.com/community?id=community_question&sys_id=13ff8f101b1dd05017d162c4bd4b...

1) Why you want to do this using script. Just add the field in activity log same as state field using funnel icon. Which will show you value transition from old to new.

find_real_file.png

 

2) You have to write a script include and pass the oldValue sys_id there to get name.

 

Yup, Script Include is the only way.