Set MRVS Value Though Catalog Client Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2023 01:41 AM - edited 11-08-2023 01:47 AM
I want to set the MRVS value through client script . Unable to get the logic how the MRVS field values are to be set on the change of the form Field. I want to do only inside catalog client script not inside the variable set client script. My reference field is not in variable set. but on the change of that field variable set fields will be auto populated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2023 01:50 AM
you need to form array of json objects and the object will contain key-value pairs w.r.t. variable name and variable value
what script did you start with and where are you stuck?
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-08-2023 01:51 AM
Hello Arun,
Hope you are doing well. Your requirement is very simple. If you are using the Catalog client script instead of variable set. Then from the script include you got the objects and push it into one new array then stringify that array. You will get your answer.
Refer my screenshots for better understanding.
If you like my solution please do like and follow me on LinkedIn for better connection
Regards
Basudeb Mishra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2023 02:21 AM
Hi
Is this on portal or native ui?
If it's on portal you need an on load client script to define g_form
this.my_g_form = g_form; //this is at cat item level and on load
then at variable set level
if(parent.g_form){
g_form.setValue('date', parent.g_form.getValue('move_date'));
}
So this sets a mrvs field based on the value of a variable that is not in the variable set
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2023 02:22 AM
and portal
if(this.my_g_form){
g_form.setValue('date', this.my_g_form.getValue('move_date'));
}