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

Change Task in Workflow

leahp
Kilo Guru

I have a workflow that will create a change request when a catalog task closes.  In addition to the change request, I need for it to open a change task, propagating specific information from the change request to the change task, specifically the fields listed below:

 

Configuration Item

Change Request #

Company

Short Description

 Assignment Group

Assigned To

 

Set due date to 5 days out. 

Below is script I have.  The only thing working is the due date.

 

task.change_request = current.getValue('sys_id');
task.cmdb_ci = current.getValue('cmdb_ci');
task.assignment_group = current.assignment_group;
task.assigned_to = current.getValue('assigned_to');
task.short_desccription = current.short_descrirption;
task.company = current.getValue('company');
task.u_category = 'Hardware';

 

thoughts?

 
1 ACCEPTED SOLUTION

scott barnard1
Kilo Sage

Hi leahp

 

In the create change task choose set values and set your state and initial assignment group etc then go to the advanced section

Tick the advanced box

Add the line

 

workflow.scratchpad.sys_id = task.sys_id;

 

 

What this does is passes the sysID of the created change to the scratchpad

Then go to your change task script and in the advanced section add

 

var sys_id = workflow.scratchpad.sys_id;


task.change_request = sys_id;

 

What this does is retrieves the sysID of the Change you created and sets the change task change_request field with it.

 

I mocked this up like yours and it creates fine

 

Hope this helps

 

 

View solution in original post

7 REPLIES 7

scott barnard1
Kilo Sage

Hi leahp

 

In the create change task choose set values and set your state and initial assignment group etc then go to the advanced section

Tick the advanced box

Add the line

 

workflow.scratchpad.sys_id = task.sys_id;

 

 

What this does is passes the sysID of the created change to the scratchpad

Then go to your change task script and in the advanced section add

 

var sys_id = workflow.scratchpad.sys_id;


task.change_request = sys_id;

 

What this does is retrieves the sysID of the Change you created and sets the change task change_request field with it.

 

I mocked this up like yours and it creates fine

 

Hope this helps

 

 

Apologies I wasn't clear what I was saying

For for the other stuff it's about passing the data from the change, as strings, to the scratchpad then retrieving the values in the change_task script.

 

Regards

Thank you!  that worked like a charm!