Variables on NEW manually created tasks

kchorny
Tera Guru

We have a custom provisioning process that creates a request from an email, and two items (fulfillment and billing) within that request.   Each item has 'standard' tasks that are created via the workflow.   The provisioning team then has to create a bunch of new tasks within the item to complete the provisioning of services.  

I have a variable, req_details, that is visible on the items, and is visible on the auto-created catalog tasks. But when we create a new task within the item, the variable is not visible.   The Variable Editor is on the form (obviously, because we can see it on the other tasks...)

I'm at a loss as to why that field doesn't show on the manually created tasks.   Any ideas?

1 ACCEPTED SOLUTION

Hi kchorny



Write a before insert business rule on sc_task table and put this script in there.



(function executeRule(current, previous /*null when async*/) {


  var vars = new GlideRecord("item_option_new");


  vars.addQuery('cat_item', current.request_item.cat_item);


  vars.query();


  while (vars.next()) {


  insertVariable(vars.sys_id);


  }


  function insertVariable(id) {


  var gr = new GlideRecord('sc_item_variables_task');


  gr.initialize();


  gr.setValue('task', current.getValue('sys_id'));


  gr.setValue('variable', id);


  gr.insert();


  }



})(current, previous);


View solution in original post

6 REPLIES 6

vars.addQuery('sc_cat_item', current.request_item.cat_item); 

Change line 3 to the above. 

 

Abhinay Erra
Giga Sage

So how are you creating these catalog task? By going from the related list on the request item?