How to populate Requestor Details in variables of MRVS?

rkreddy
Giga Expert

Hi All,

Hope everyone is doing good.

I am working on a catalog form with Variables,

Name (reference to User table), Department, Work Location, Telephone, Email. When value changes in Name variable, all the other variables get populated automatically if the user in Name variable has that values exist. If not, we are allowing users to manually enter values in Department, work location, telephone, email variables.

We have a MRVS with the same variables as mentioned above.

Now, We have a checkbox variable on the same form with name "Self". When user checks it to true, all the values in the Name, Department, work location, telephone, email should be copied to variables in MRVS. If he unchecks, the values should get cleared (only the row should get deleted which is populated when the variable is checked). This should work on change of both Name and Self variables.

Thank you.

1 ACCEPTED SOLUTION

@rkreddy 

Done and working fine in native

please check below output

find_real_file.png

Please mark my response as correct and close the question.

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

58 REPLIES 58

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you can write onChange client script on Name and Other variable

1) then set MRVS with the array of JSON string values

2) to clear MRVS use g_form.setValue('mrvsVariableName', '');

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi @Ankur Bawiskar ,

Thank you. 

1. Is it possible to clear specific row in MRVS which is populated because of checking Self to true.

2. Do I need to write two OnChange client scripts? for each variable. Could you please provide rough script.

 

Hi,

1) yes specific row can be removed

a) iterate the array of json objects and if value found then don't push that in new array of json objects

2) check links for point 2 where I have shared solution; enhance it as per your need

How to set MVRS variable value to a variable of catalog item onSubmit/OnChange

How to populate values in MRVS automatically from List type variable on catalog item

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi @Ankur Bawiskar ,

As all the variables on the catalog form itself, like Department, Work location, email, telephone, instead of using script include how to get these values and convert to json and push it into MRVS. And this script should work only when Self check box is set to true.

Thank you.