How to set outside variable value from inside client script of MVRS
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
I am attempting to set the value of a variable outside a Multi‑Row Variable Set from a client script within the MRVS. However, this is not working.
The requirement is to update an outside variable when a specific variable inside the MRVS changes.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//g_form.setValue('in_domain', 'false');
var email=g_form.getValue('u_email');
alert(email);
var domain = email.split('@')[1];
alert(domain);
var ga= new GlideAjax('getDomain');
ga.addParam('sysparm_name','compareDomain');
ga.addParam('sysparm_dom',domain);
ga.getXMLAnswer(function (response) {
alert(response);
if (response !== 'true') {
alert('domain is not approved');
} else {
alert('domain is approved'); // getting this alert
g_form.setValue('in_domain','true'); // This is outside variable
}
});
//Type appropriate comment here, and begin script below
}
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Can you try using this.
g_service_catalog.parent.setValue('field','value');
or
parent.setValue('field','value');
Vishal Birajdar
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Hello Vishal,
Thanks for your quick response.
Unfortunately, it's not working
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
43m ago
you want this for native or portal?
Regards,
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
