How can I get the display value from oldValue in a client script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2021 11:41 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2021 12:24 PM
I already use this field, but it's not easily searched. The users already rejected this solution, they want a different field that only contains the specific data they are looking for.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2021 01:06 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2021 01:11 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2021 03:21 PM
This isn't a bad option and one I considered. I think I'll try this option instead of the client scripts. At least I can put everything into one code snippet instead of multiple client scripts.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2021 11:51 AM
Hi gjz,
If you need to use the display value in your script, your best bet is to put it through GlideAjax to a Script Include that does a GlideRecord get on the sys_id from that table and returns the string display value. You can then use the new value in your callback function as needed.
https://docs.servicenow.com/bundle/paris-application-development/page/script/ajax/topic/p_AJAX.html