Get variable value on server side script (not display value)

Eli Guttman
Tera Guru

Hi,

On business rule / workflow script - how can i get the value of a variable ( not display value, value)?

for example - variable named model

 

var req = new GlideRecord('sc_req_item');
req.addQuery('number','RITM0219702');
req.query();
if (req.next()){


gs.print(req.getValue('variables.model')); // this is not working - return null

gs.print(req.getDisplayValue('variables.model')); // this is working and return the display value

}

 

Anyone know the reason?

9 REPLIES 9

Allen Andreas
Administrator
Administrator

Hi,

req.variables.model

Please mark reply as Helpful/Correct, if applicable. Thanks!

 


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Hi Allen,

 

I would like to use the getValue method. the reason is that i'm building something dynamic, so i don't know the variable name in advance.

 

thank you.

Hello, I'm not understanding as you'd need to know what to get the value of.


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Hi,

 

I have build a configuration table where it is defined for each catalog item, which variable is relevant for this process.

so in my code, i use this configuration table to get the variable value.