Help needed with accessing multi row variable set in client script

Bruler1230
Tera Expert

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

 
18 REPLIES 18

I will give this a try and report back...thanks again. You are a big help

My pleasure! 

Please don't forget to close the threads by marking the responses as correct.

Good luck.

-Thanks

Prateek kumar


Please mark my response as correct and helpful if it helped solved your question.
-Thanks

I input this script and modified the field names as necessary. But it isnt working. when i choose a name from the list for the u_user_name field, nothing happens. nothing else gets populated.

Shiraz2
Mega Guru

Hello Bruler1230, I did something similar and was able to do it but with a Workflow Task Script. I also wrote an article on this. See if that helps you. Document attached.