- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-02-2022 10:40 AM
Looking for some help or directions with my issue. I have a catalog item request where one of the variables is a reference field to the maintain item list. I am looking to re-direct the user to the specific item after they make the selection. I can make it happen if I hard code the link but I wanted to create a dynamic link that capture the correct sys_id of the selection.
I have created an onChange catalog client script to check when the field change.
var SysId = g_form.getValue('software_items'); //name of the variable
if (newValue !== 'none') {
var url = https://dev69851.service-now.com/sp?id=sc_cat_item&sys_id=' + SysId + '&sysparm_category=69d0e41b1b5f8150a190ece0f54bcb4e',
_blank;
top.window.open(url, "_blank");
}
}
where it says I need the sys_id of the selection
Any help will be appreciated it.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-02-2022 11:47 AM
You can use the name in label field and if need it at client end use g_form.getDisplayValue('var_name');
Thanks and Regards,
Saurabh Gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-02-2022 10:55 AM
Hi,
Try below code
var SysId = g_form.getValue('software_items'); //name of the variable
if (newValue) {
var url = https://dev69851.service-now.com/sp?id=sc_cat_item&sys_id=' + SysId;
top.window.open(url, "_blank");
}
Thanks and Regards,
Saurabh Gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-02-2022 11:18 AM
Hi Saurabh,
Thanks for you reply, but the issue is that is not returning the sys_id instead is getting the name of the value
But the same code on my PDI is returning the sys_id
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-02-2022 11:20 AM
Hi,
Can you please check the type of the variable and give the screenshot?
Thanks and Regards,
Saurabh Gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-02-2022 11:36 AM
Hi Saurabh,
The variable type is Lookup Select Box, but on my PDI is a reference. I think that's the issue.