Workflow Advanced Script

Maki
Tera Expert

Hello all,

last but not least i need help with a catalog task. I want to use the same worfklow (sc_request_item) with more items.

In this workflow is a catalog task, assigned to our ServiceDesk. 

My problem is to show the current variables in the task. 

For Example the workflow is in "item1" / "item2" / "item3". 
Item1 variables: test1 / test2
Item2 variables: snow1 / snow2
item 3 variables: sun1 / sun2

So all variables got different names. Is there a way via script, to check the current variables of the requested item?

This is what i got now:

task.short_description = current.cat_item.name; // working
task.variables = current.variables; //Does not work! nothing happens here!

 

12 REPLIES 12

sachin_namjoshi
Kilo Patron
Kilo Patron

task.variables will not work since variables is not a column on sc_task table.

You will have to use any one of available fields like comments to get list of variables like below

 

task.comments = current.variables;

 

Regards,

Sachin

Hello,

i also tried task.description = current.variables; //also not working

Do i need a GlideRecord?

do you mind to share your script?

do you want to just read variable values?

I hope your workflow is on sc_req_item table.

 

Regards,

Sachin

This above is my script 🙂

task.short_description = current.cat_item.name; // working
task.description = current.variables;

Yes the workflow is on sc_req_item

find_real_file.png

 

Yes i just want to read the value. 

For Example, there are 3 variables (PC / Name / Location) in the item. 

So when somebody request this item, our ServiceDesk should get a catalog task with:

PC: 1234
Name: Peter
Location: Amsterdam

 

Because i want to use this workflow as default, i cannot name the variables in the workflow, because there are different for each item.