Access Catalog Item variable from Variable set Client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-28-2019 09:14 AM
I have a multi row variable set with one reference field. When i change the value of the reference field in the variable set, i want to update the variable on the parent catalog item. I have written a on change client script and tried to set its value using g_form.setValue but it didnt work and it makes sense. I want to know how we can access it

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-28-2019 10:14 AM
Can you share the code you wrote and have so far?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-28-2019 10:19 AM
https://community.servicenow.com/community?id=community_user_profile&user=0733d6e5db1c1fc09c9ffb651f961976
Its actually invoking a script include.. but forget about..
Its a simple onchange script on my variable set which trying to set the value of variable on catalog item.
its mere g_form.setValue('field on catalog item', 'somevalue);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-28-2019 10:27 AM
I would suggest you to place an alert in your script before setting the value to debug and check if there is proper response from your script include.
Use alert(somevalue);
Also, there shouldnt be any quotes on the some value (there is a single quote in your script).
Current Version: g_form.setValue('field on catalog item', 'somevalue);
Expected: g_form.setValue('field on catalog item',somevalue);
Let me know if you have any further questions or mark this response as "Helpful/answered" if this helps answer your question.
~Raghu.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-28-2019 10:43 AM
Hi Raghu,
I tried that. To make it more clear, the script works. As you said, the alert box pops up with value returned from the script include. no issues with it. Here the problem is Variable sets' Client script not having access to the variables used in the catalog item.
There is no problem with syntax or other technical issues.