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

How can we make variables visible on catalog task which are created through Run script

alekhyanagabhyr
Kilo Contributor

Hello Everyone,

I have worked on the generic workflow where catalog task are created through the run script.

Now I need help how can I make variables visible on the catalog task in script.

Here is the script were catalog task are created:

while (gr.next()) {
if(workflow.scratchpad.count == count) {
var task = new GlideRecord('sc_task');
task.initialize();
task.request_item = current.sys_id;
task.assignment_group = gr.u_assignment_group;
task.priority = gr.u_priority;
task.short_description = current.request.requested_for.getDisplayValue() + ' - ' + gr.u_short_description;
task.description = gr.u_description;
task.state = 1;
task.insert();
}

Thanks

Alekhya N

2 REPLIES 2

Brian Dailey1
Kilo Sage

Hi Alekhya,



There is a table called [sc_item_variables_task] that relates a TASK to the variable definitions in [item_option_new] that it is able to view.   To see a variable on your TASK, create a record in this table for your task for each variable you wish to make available.



Also note: an option record [sc_item_option] must have been created for your parent RITM using the same variable definition as above, and is related to your RITM via the Variable Ownership table [sc_item_option_mtom].



Thanks,


-Brian


Deepak Ingale1
Mega Sage

Hi Alekhya,



On variable definition, there is a 'global' checkbox field. You need to check it so that it is appears of catalog tasks as well.


http://wiki.servicenow.com/index.php?title=Using_Service_Catalog_Variables#Creating_Variables_for_Ca...