
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-27-2019 11:54 PM
Hello,
I have a workflow in which when you submit the form, it will create a RITM and a Change Request at the same time. Is it possible to set the CR created as the parent of the RITM created? If yes, how can I do it in the workflow. Thank you.
Kind Regards,
Raphael
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
-
Team Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-28-2019 12:58 AM
I would suggest,
1. Add a RUN SCRIPT activity , in place of CREATE TASK.
2. Add below code for creating change request and setting parent of RITM:
var grc= new GlideRecord('change_request');
grc.initialize();
grc.cmdb_ci = current.cmdb_ci ; // current.cmdb_ci : this will copy CMDB from RITM to CHANGE
grc.field_Name_on_CR= current.field_Name_on_RITM; // replace with your values that you want to set
var sysID =change.insert(); // store sys_id of change request created
current.parent = sysID // This will set parent for RITM
current.update();
3. In this way you can avoid setting,issue mentioned on my above comment.
Please mark as Correct Answer/Helpful, if applicable.
Thanks!
Abhishek Gardade
Abhishek Gardade

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-28-2019 01:16 AM
Thank you for this Abhishek!! I believe 'var sysID =change.insert();' should be 'var sysID = grc.insert();' , other than that it works fine! Thanks again!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-28-2019 01:27 AM
Ohh yes!! you are correct...
Abhishek Gardade
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2021 04:25 AM
will u please specify how to make ritm as parent for CR....where am triggering the standard change through workflow
var templateSysId = "6e24a61bad7810017ba944b24bcba4";
var changeRecord = new GlideRecord('change_request');
changeRecord.initialize();
GlideTemplate.get(templateSysId).apply(changeRecord);
changeRecord.insert();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-28-2019 12:06 AM
Hi Raphael Dizon,
In run script
var change = new GlideRecord('change_request');
change.initialize();
change.applyTemplate('<template name>');
change.cmdb_ci = current.configuration_item;
change.parent = current.sys_id;
change.company = current.company;
change.insert();
if (change) {
workflow.scratchpad.changeTicket = change.number;
current.work_notes = 'Change ticket ' + change.number + ' created. Setting Status to Pending.';
current.state = -5; //set State to "Pending"
}
else {
activity.result = 'Change not created';
current.work_notes = 'WARNING - Change not created! Do something manually?';
}
Refer to this link, I hope it will help you.
If my reply helps you at all, I’d really appreciate it if you click the Helpful button and if my reply is the answer you were looking for, it would be awesome if you could click both the Helpful and Accepted Solution buttons..:)
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-28-2019 12:20 AM
Hello,
Won't this script make the RITM the parent of the CR? I want to do it the other way around, CR is the parent of RITM.