How can I get the content of a Variable Set Value (catalog table variables) from a Service Catalog Item inside a workflow?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2014 07:25 AM
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2014 08:34 PM
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()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2014 11:45 PM
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-22-2014 12:46 AM
just try this
current.requested_for = current.variables.test_result;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-22-2014 01:06 AM
When I update it, The log writes undefined and the "requested_for" field in the requested items table is empty.