
- 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 12:01 AM
Hello Raphael,
What are you creating first in workflow? RITM Or Change? Are you using a same activity for creating both records?
Yes you can set CR as parent for the RITM.
Can you share a script for creating a RITM & CR? or a screenshot?
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 12:18 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-28-2019 12:40 AM
Hello Raphel,
I have created this activity and created a change request.
1.When you Submitted a SR form. A service Request has been created and with the workflow Change has been created as well
2. As I can see in change request table RITM IS A PARENT FOR THE CHANGE and it should be as its created from workflow of RITM.
3. So logically with OOTB functionality the scenario is :
For change request : PARENT IS RITM
and after we configured your scenario:
For change request : PARENT IS RITM
FOR RITM : PARENT IS CHANGE REQUEST
same records are pointing each other as parent.
3. But still if you wan to configure then create a AFTER INSERT business rule on change table and add below code:
var gr = new GlideRecord('sc_req_item');
gr.addQuery('sys_id','parent'); // Field on CR or
gr.query();
if(gr.next()){
gr.parent = current.sys_id // it will set parent for RITM
gr.update();
}
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 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