Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to Populate Multirow Variable set from Previous Request

Connor14
Tera Contributor

Hello,

I have a catalog item with a reference field pointing to the the "sc_req_item" table. When a user selects a record from this reference field I want the values from the previous request to populate the variables in the Multirow variable set I have on my catalog item. How would I achieve this using an onChange client script?

3 REPLIES 3

harshav
Tera Guru

use glideAjax and query the request item record and get your values from that record.

syntax
   for (var n in current.variables){
      vars[n] = current.variables[n];
   }
here you will get the variables and get the values of it using dot walk and set to your variables in client script using g_form.setValue();

Connor14
Tera Contributor

Would to be able to provide a more comprehensive script example? I am trying to achieve this only using an onChange client script using the "getReference" function. 

magee
Tera Guru

Did you ever get this working? I'm trying to do something similar.