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
Kilo Patron
Kilo Patron

Hello,

 

Has everything been done from the same script. If yes then curent.sys_id stores the value if RITM sys_id. one way is to glide the chnage and then get the sys_id and attach it the code will look like below:-

 

var gr=new GlideRecord('change_request');
gr.addQuery('u_parent_requested_item',current.sys_id);
gr.query();
if(gr.next())
{
task.change_request=gr.sys_id;
}

 

Please mark my answer as correct based on impact.

@Saurav

yes in the same workflow i am using, Yes it is taking RITM number.

I tried u r code on create task activity which creates change task ,but still i dont see change task attached to change request


task.description = 'Before activities' ;
var gr=new GlideRecord('change_request');
gr.addQuery('u_parent_requested_item',current.sys_id);
gr.query();
if(gr.next())
{
task.change_request=gr.sys_id;
}

Can you paste the screenshot of the flow where you are creating the change and change task and how you are creating it will be easier to assist you.

@Saurav11 

sravya03_0-1695826920146.png

 

First task is creating change request and linked with RITM.

Second task activity is creating change task and it is not linking with change request.

With your code on change task ,in change number field RITM is getting populated.

Change task and change request are created using create task activities after approval of RITM.

so i tried changing code as below

var gr=new GlideRecord('change_request');
gr.addQuery('u_parent_requested_item',current.sys_id);
gr.query();
if(gr.next())
{
task.change_request=gr.number;
}