The CreatorCon Call for Content is officially open! Get started here.

How can I get the content of a Variable Set Value (catalog table variables) from a Service Catalog Item inside a workflow?

guy
Kilo Contributor

hi,

There is a field in the service catalog named "requested for" which the initiator of the request enters the data to the field. I want, by pressing the button "Order now" - that the data will enter to the field "requested for" in the requested items table. The script was made in the workflow.

I don't know how to access to the data in the catalog when there is a variable of type of Variable Set Value (catalog table variables).

thanks.


12 REPLIES 12

Kalaiarasan Pus
Giga Sage

if you want to get the value



current.variables.variablename


Or


current.variable_pool[variablename]



if it is a reference field and you want get the display value use this



current.variable_pool["requested_for"].getDisplayValue()


hi,



Thanks for the reply



I tried what you suggested and it's not working (the field in the table requested items is blank). I've included the code below when the variable "test_result" is of type of catalog table variable (variable set). I also attached the log result



var item= GlideRecord("sc_req_item");  


item.addQuery('request', current.sys_id);  


item.query();  


while(item.next())


{  


  current.requested_for = item.variable_pool["test_result"].getDisplayValue();


}  




gs.log("xxxxx1     " + item.variable_pool["test_result"].getDisplayValue()); //check the content in log




check the content in log :


xxxxx1 [{"hdr":"","forElement":"","preFields":[],"rows":[[{"field":"users","label":"user","mandatory":"","type":"reference","giveFocus":"","reference":"sys_user","choiceOptions":null,"refQual":"","onChangeFunc":"","cellCSS":"","labelCSS":"","show":"always","value":"12826bf03710200044e0bfc8bcbe5db1","display":"Alfonso Griglen","relatedTable":"","disabled":false}]]}]



thanks.


just try this



current.requested_for = current.variables.test_result;


When I update it, The log writes undefined and the "requested_for" field in the requested items table is empty.