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
‎03-01-2019 05:05 AM
Hi,
I dont think that is possible atm. with mrvs. It only works with the "old" variable sets. I'll see if I can dig out something more. Can you give a good use can where you actually need to have this setup where a variable inside a mrvs populates a field outside of the mrvs. Perhaps with the requirements we can come up with a different approach.
LinkedIn & Twitter
Subscribe to my YouTube Channel
Buy The Witch Doctor's Guide To ServiceNow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-21-2019 11:51 AM
Hi Goran,
I have same question and use case here is-
1. MRVS variable 1- start date
2.MRVS variavle 2- end date
3.MRVS variable 3 date difference
if (date difference > 3 days) then set approval flag to yes // approval flag is a variable on catalog item
else keep on adding rows in MRVS
Any suggestion would be highly appreciated.
Thanks in advance !!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-28-2019 10:16 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2021 09:51 PM
The only way I've been able to do this is DOM manipulation and angular:
//Frame view
if (typeof angular == "undefined")
accountJSON = window.parent.g_form.getValue('account_options');
//Service Portal
else {
var catItem = this.angular.element('#sc_cat_item\\.do').scope();
var parent_g_form = catItem.getGlideForm();
accountJSON = parent_g_form.getValue('account_options');
}
The top code is for the backend whereas the bottom is for Service Portal. This is not ideal and could easily change in an upcoming release, but it's working as of Paris.
Has anyone come up with a less hacky solution?