Workflow Runscript

kamal11
Giga Expert

Hi all,

I have a requirement where in I need to auto populate a certain variable value on the task based upon the value from the asset table.

The display name of the asset has to be populated on the variable of task, once the purchase order is received of the procurement.

To achieve this I have created a run script before the task creation in the workflow,

find_real_file.png

The run script is below,

var gr = new GlideRecord('alm_asset');

  gr.addQuery('request_line',current.sys_id);

  gr.query();

  if(gr.next())

  {

current.variable_pool.variable to be updated on task = gr.dispay_name.getDisplayValue();

}

Here the variable to be updated on the task is in the variable set, hence I have put in variable_pool in the script.

The variable we are trying to update is also present on the RITM and also on the catalog task.

But the run script is not updating the variable on the task. Can anyone help me in finding what else needed to be done on this requirement.

Thanks,

Kamal

11 REPLIES 11

Hi Vaibhav,



Have you used it in the runscript?



Or on the task level??



Thanks,


Kamal


I used the 'Run Script' activity of Requested Item workflow.


HI Vaibhav,



We need to update the variable on the task level



Can you let me know how to do it?



Thanks,


You mentioned, you have that variable on the requested item. So once updated, it will show up on the task as well.


We do have a variable(Which is a reference variable to Hardware asset table) on the RITM (Which is read only) and that has to get updated not on the time of creation.



It should get updated after (example: 7 to 11 Business days)


I have used the Runscript but it is not updating the value on neither RITM nor on task



Can you let us know why?