How to retrieve value from RITM dynamically if user is passing value in a query format.

pandeyved
Tera Contributor

Hi All,

Scenario:

From flow designer as a input user will pass some query to retrieve data on RITM table and update it on Short Description on RITM Table.

Eg: User has passed : current.cat_item.name;

So it should run on RITM Table, and update the catalog item name in short description of RITM Table.

I have written script:

var a = "current.cat_item.name";
var b = a.split('.');
for (var i = 0; i < b.length; i++) {
this["b"+i] = b[i];
}

gs.info(b1);
gs.info(b2);
var gr = new GlideRecord('sc_req_item');
gr.get('6ef4c4ef1b48bd54366ea7953b4bcb23');
gs.info(gr[b1][b2]);

 

It is giving correct Output. But My requirement is how to make it Generic.

For this case we know, that we have length till 2nd position, so we given gr[b1][b2].

But what if user has given more than this.

So pls help me in making this Generic. Like gr[a1]....gr[an-1].

 

Thanks

0 REPLIES 0