Workflow Runscript
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2017 08:12 AM
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,
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2017 08:21 AM
You can use script in your task activity.
Set task field value after getting the data from glide.
task.field_name = current.variables.variable_name;

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2017 08:22 AM
To pass variable value from one activity to another, You have to use workflow scratchpad variable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2017 08:28 AM
HI Deepak,
Variable in which we need to pull the asset name is a variable from the variable set of the catalog item. It is NOT THE TASK FIELD.
Can you let me know how can we achieve this.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2017 08:54 AM
I tried the below script on my demo instance and it worked fine!
var gr = new GlideRecord('alm_asset');
gr.addQuery('request_line',current.sys_id);
gr.query();
if(gr.next())
{
current.variable_pool.variablename = gr.display_name;
}
Regards,
Vaibhav
Mark Correct /Helpful /Like based on the effect of response.