Displaying catalog variables on catalog task created by run script

PJ1
Tera Contributor

Hi, I have a requirement to create multple catalog task dimanically in workflow. I achived that by a run script using glide record. however Catalog variables are not showingup on the   tasks created. Did any one try showing catalog variables on tasks created by a script.

16 REPLIES 16

adiddigi
Tera Guru

I agree with Kalai. He nailed it. That's what we did. Instead of a iFrame, we used a UI Action to show the RITM and it's variables (using a normal window object)


Ya I Guess the normal window would be good ..



The extra buttons and headers in the Iframe would be confusing If there is someway to eliminate the headers, it would be just awesome ...


Kalai,



Why not use UI Page or a macro.. It wont show any additional headers and buttons.. and can be easily controlled.


It's just the same.. The solution was just a suggestion and can be tailored to suit the requirement.



But If you are using UI page/Macro, the headers will still be visible. Won't they ?


staceyrocheleau
Kilo Guru

I have a workflow where I generate the tasks via script so it is dynamic. To get the variable section to display I did the following code (loop through tasks, loop through item variables, insert records for each task to have the variable):


(function setVariablesonTasks() {


// Display variables on tasks



var tsk = new GlideRecord('sc_task');


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


tsk.query();



while (tsk.next()) {



try {


// get variables and add to task{


var reqvar = new GlideRecord('sc_item_option_mtom');


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


reqvar.query();



while (reqvar.next()) {


var variablereference = new GlideRecord('sc_item_option');


if (variablereference.get(reqvar.sc_item_option)) {


var add_task_var = new GlideRecord('sc_item_variables_task');


add_task_var.task = tsk.sys_id;


add_task_var.variable = variablereference.item_option_new;


add_task_var.insert();


}


}


} catch (err) {



}


}


})();