Get catalog task variables in workflow

sidarth
Giga Expert

So I have some variables that are on my catalog item and are hidden on the form.   Now we know that those variables we can get on the request item form and the catalog task form too. I have created a task where I want to give value to those variables. My issue is how to fetch those variables in a workflow(on request item table) so that I can set some conditions based on that.

pic (2).png

So basically Here I have a checkbox and a choice field coming from the catalog item. I want to access those values in my workflow

1 ACCEPTED SOLUTION

Mihir Mohanta
Kilo Sage

Use current.variables.yourvariablename   to get or set values to variables.



Thanks,


Mihir


View solution in original post

9 REPLIES 9

Frank1975
Kilo Guru

Hi Sidarth


you could built in a "Run Script" activity with the following code



var getsc = new GlideRecord('sc_task');


getsc.addQuery('request_item',current.sys_id);


getsc.addQuery('request_type', 'Web Puslishing');  


getsc.query();




if (getsc.next()) {


getsc.yourcheckboxvariablename = 'true';


  getsc.yourchoicevaribalename= 'your choice';


  getsc.update();


}



Something like that, you need to modify the variables based on your requirements.



let me know if that helps.



Frank


So Can't I do without running a GlideRecord. Since my workflow is also on the request item there should be some way to get those variables. And I was thinking to get those variables in script area of catalog task


Hi Sidarth,


i guess you are right, you can do this within the advanced script in the Catalog Task.


Similar to the example setting the description:


task.short_description = current.short_description;


task.checkbox = 'true'



Give it a try.



Frank


I tried that but it's not working. Giving undefined.