Help needed with accessing multi row variable set in client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2019 07:31 AM
sorry for the cross post, this was posted in the developer community as well, I just really need to get some traction on this
I am using a multi row variable set and I need to autopopulate fields based on what is selected in a reference field within the mrvs. I want to do this by using a onChange catalog client script. It looks like that is a little more complicated to do with multi row variable sets. I have found the below but i am looking for some help on how to implement it. The mrvs allows a user to select a name from the reference field (multiple names, not just the current user) and then based on the name they pick, all the following fields will autopopulate. the user name field is referencing the user table.
Step 1 : Create a script include and write your logic for gathering the data from table and push the data into array of objects. Return the array as return JSON.stringify(array);
Step 2: In your catalog client script, Write the GlideAjax and call the function in the script include creatd in step 1, In the callback function, write below code :
var answer = response.responseXML.documentElement.getAttribute("answer");
answer = JSON.parse(answer);
g_form.setValue('the name of the multi row variable list',JSON.stringify(answer));
Please let me know if any additional info is needed.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2019 11:14 AM
Excellent, please take a look and you have a similar post.
Please close that thread too if your question is answered.
-Cheers
Prateek
Please mark my response as correct and helpful if it helped solved your question.
-Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2019 11:39 AM
If you dont mind, can you help me as i customize your script to work for my situation.
In the script include, do i need to a var name= this.getParameter('sysparm_user_id'); for each variable in my variable set?
the field that users are selecting from is a reference field that reference the user table. That field name is u_user_name. How do i incorporate that in to this script?
Thanks again
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2019 12:06 PM
Try this?
Please mark my response as correct and helpful if it helped solved your question.
-Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2019 01:15 PM
I am so close to getting this requirement completed if you dont mind helping me
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2019 01:17 PM
Please post the script what have you tried so far
Please mark my response as correct and helpful if it helped solved your question.
-Thanks