Not able to copy change number to change task in workflow

sravya03
Tera Contributor

I have a requirement to create ritm through catalog item and from RITM change is created and from change change task.

Everything i have done using workflow and linked RITM to change req using below code in create task activity.

task.u_parent_requested_item =current.sys_id;

Now to link change req and change task the below code is not working in workflow 

task.change_request =current.sys_id;

 

 

Please help in assigning change number to change task.

On change request form in the related list tab need respective change tasks.

11 REPLIES 11

@Saurav11 

 

First I created using BR only as i need to create 5 tasks from same change request.

But i need to put a wait for completion condition ,like after firts task is completed then only second should be created .

in that case i am not able to put wait condition.

If you have any idea on that scenario ,pls let me know.

 

function executeRule(current, previous /*null when async*/) {
    
        createChangeTask(current, current.assignment_group, 'Description for Task 1');
        create(ChangeTask(current, current.assignment_group, 'Description for Task 2');
        createChangeTask(current, current.assignment_group, 'Description for Task 3');
   
})(current, previous);

function createChangeTask(change, assignmentGroup, description) {
    var gr = new GlideRecord("change_task");
    gr.initialize();
    gr.assignment_group = assignmentGroup;
    gr.state = '1';
    gr.description = description;
    gr.change_request = current.sys_id;
    gr.insert();
}

Now to do this what you can do is instead of creating the script in the BR create the script in the script include and in place of create task for change task use a run script and call the script include.

This way you will make sure that the script is only being called when necessary.

Please mark my answer as correct based on impact.