I need to link RITM on Exisiting Change Request (in Related section) - Help

AbdurRahmanSnow
Giga Guru

I have a requirement.
On a Catalog form, there is a Change Request reference field. So, when Catalog form gets submitted along with the Change Request number, an RITM gets created.

 

So, the requirement is, this RITM should be then linked on the Change Request Related List (change number which we gave on the Catalog form).

 

How should I achieve this with Run Script Code on WorkFlow ? I have created a workflow on sc_req_item table. But I will use Run script action and will write code.

 

I have written some code in Workflow but it is not working. Please help.

workflow.info('Run Script Checking 3' + current.variables.change_request_number_1);
workflow.info('Line 2' + current.sc_req_item); //Here, current means RITM table.

var cNumber = current.variables.change_request_number_1;

var cChange = new GlideRecord("change_request");
cChange.addQuery('sys_id', cNumber);
cChange.query();

if(cChange.next()) {
    cChange.sc_req_item = current.sc_req_item.sys_id;
    cChange.update();
}
1 ACCEPTED SOLUTION

@AbdurRahmanSnow In your workflow run script, can you simply put the following code.
Preview
 
current.parent = current.variables.change_request_number_1+'';
current.update();

View solution in original post

7 REPLIES 7

@AbdurRahmanSnow In your workflow run script, can you simply put the following code.
Preview
 
current.parent = current.variables.change_request_number_1+'';
current.update();

Awesome Sandeep. Wonderful. Super. !!!
I am really very grateful for your help. God bless you.

@AbdurRahmanSnow Glad to know it worked for you 🙂