Not able to copy change number to change task in workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2023 07:33 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2023 07:43 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2023 07:52 AM
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;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2023 07:56 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2023 08:05 AM - edited ‎09-27-2023 08:07 AM
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;
}