- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-24-2020 09:12 PM
Hi,
I have a variable set in that created a variable called 'price' which is a single line text.( i want to use that variable set into multiple record producers)
for the variable price i want default value as sys id of that record producer.
i tried on degault value: , javascript:current.sys_id ,and producer.sys_id but no luck , please share if you have any idea on this.
Thank you
Shabbir
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-24-2020 09:17 PM
Try with on load catalog client script:
g_form.setValue('price', g_form.getUniqueValue());
Raghav
MVP 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-24-2020 09:17 PM
Try with on load catalog client script:
g_form.setValue('price', g_form.getUniqueValue());
Raghav
MVP 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-24-2020 10:21 PM
hi raghav, i tried the same but not workig
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-24-2020 09:48 PM
Hi,
You cannot get it directly via default value
you will have to set it via form load catalog client script
1) Create one onLoad Catalog Client script which Applies to variable set
Script below This would work in native and portal both
function onLoad() {
//Type appropriate comment here, and begin script below
if(window != null){
var cat_id = gel('sysparm_item_guid').value;
g_form.setValue('price', cat_id);
}
else{
var val = g_form.getUniqueValue();
g_form.setValue('price', val);
}
}
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
‎11-24-2020 10:21 PM
hi ankur ,
it is not working ,i tried.
//Shabbir