- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2023 02:55 AM
I have the field u_service_offering of type reference to service_offering table in my sc_cat_item table.
In my catalog item 'Software' I have the variable service_offering of type reference to service_offering table.
How can I auto populate the variable service_offering with the value of u_service_offering from the current cat item when creating a catalog service request? I tried to use this script but its not working:
function onLoad() {
var currentCatalogItem = g_form.getReference('sys_id');
var serviceOffering = currentCatalogItem.u_service_offering;
g_form.setValue('service_offering', serviceOffering);
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2023 03:21 AM
Can you try this:
javascript:current.cat_item.u_service_offering
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2023 03:11 AM
Open the variable and go the default value of it.
and mention the script as below:
javascript:current.u_service_offering
If my answer solved your issue, please mark my answer as ✅Correct & 👍Helpful based on the Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2023 03:15 AM
@Prince Arora its not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2023 03:21 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2023 03:12 AM
Hi @Alon Grod ,
Please refer to below link for details on how to use g_form.getReference()
https://www.servicenow.com/community/developer-forum/client-script-onchange-getreference/m-p/1463098
Regards,
Manmohan