On change client script issue for reference variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2022 02:54 PM
We have a table (cmdb_ci_appl) where there is no Display value.
we have a catalog item in which we have a reference field, on selecting the 1st field we need to populate the 3 other fields.
How to set the app ID ( which is highlighted) upon selecting? ( as of now it is defaulting to name , which is on the left side)
Below is the Onchange CS script ( for some reason when the ID is selected it is not setting the name in the name field (name is of string type on the table )
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var AppID = g_form.getReference('citrix_application_id', SetApplicationvariables);
function SetApplicationvariables(AppID) {
g_form.setValue('citrix_application_name', AppID.name);
g_form.setValue('citrix_application_version', AppID.version);
g_form.setValue('citrix_application_vendor_name', AppID.u_common_name);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2022 03:28 AM
Hi,
this should be fine but remember along with the field which is Display=true user will see data from u_number when they try to type in the reference variable
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2022 10:24 PM
Hope you are doing good.
Did my reply answer your question?
If my response helped please close the thread by marking appropriate response as correct so that it benefits future readers.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2022 12:27 AM
Try this Zero Code approach
https://community.servicenow.com/community?id=community_article&sys_id=3f0cf115db7fc190847d5ac2ca961931
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2022 12:04 AM
Hi
Did you try this zero code method. It is very simple to use.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2022 10:36 AM
Tried this too but seems the application name is not populating, rest of the fields are populating in native view but not in portal view