- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2019 12:22 PM
Hello Community,
I have a request from a customer to be able to create multiple RITMs within an catalog item.
We cannot do this using the Order Guide due to the catalog item itself needing to be within an order guide but also requestable directly from the catalog.
We have multiple catalog items created for this, and they all use the same variables and need to display those variables within each RITM.
Example:
1. Submit Catalog Request.
2. Create RITM - Item One
2a. Create SCTASK - Item One
3. Create RITM - Item Two
3a. Create SCTASK - Item Two
4. Create RITM - Item Three
4a. Create SCTASK - Item Three
Much thanks,
Daniel Vargas
We have a script that is running this but it's not looking similar to base RITM being created by catalog item.
var gr = new GlideRecord('sc_req_item');
gr.initialize();
gr.request=current.request;
gr.request.requested_for=current.request.requested_for;
gr.cat_item='9da851db1ba40850705b86e8cd4bcb2a';
gr.cmdb_ci=current.cmdb_ci;
gr.short_description=current.short_description;
gr.description=current.description;
gr.insert();
var newRITM=gr.sys_id;
sc_item_option_mtom = new GlideRecord('sc_item_option_mtom');
sc_item_option_mtom.addQuery('request_item', current.sys_id);
sc_item_option_mtom.query();
while(sc_item_option_mtom.next()){
var sc_item_option = new GlideRecord('sc_item_option');
sc_item_option.addQuery('sys_id', sc_item_option_mtom.sc_item_option);
sc_item_option.query();
if(sc_item_option.next()){
var sc_item_option_insert = new GlideRecord('sc_item_option');
sc_item_option_insert.initialize();
sc_item_option_insert.item_option_new=sc_item_option.item_option_new;
sc_item_option_insert.value=sc_item_option.value;
sc_item_option_insert.insert();
var sc_item_option_mtom_insert = new GlideRecord('sc_item_option_mtom');
sc_item_option_mtom_insert.initialize();
sc_item_option_mtom_insert.request_item=newRITM;
sc_item_option_mtom_insert.sc_item_option=sc_item_option_insert.sys_id;
sc_item_option_mtom_insert.insert();
}
new Workflow().restartWorkflow(gr);
}
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2019 01:12 PM
Hello,
You didn't really tell us HOW it looks differently...but anyways...
If you aren't willing to use the order guide feature, then I would recommend creating the one base catalog item or using....one base catalog item to capture all the variables, etc.
Then...in the workflow, create a run script activity using the Cart API: https://docs.servicenow.com/bundle/newyork-application-development/page/script/server-scripting/refe...
That's how you'd create a new RITM and fill in everything so as you're coding it out, you would assign the variable in the new RITM to the current.variables.field_name version of the same.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2019 01:12 PM
Hello,
You didn't really tell us HOW it looks differently...but anyways...
If you aren't willing to use the order guide feature, then I would recommend creating the one base catalog item or using....one base catalog item to capture all the variables, etc.
Then...in the workflow, create a run script activity using the Cart API: https://docs.servicenow.com/bundle/newyork-application-development/page/script/server-scripting/refe...
That's how you'd create a new RITM and fill in everything so as you're coding it out, you would assign the variable in the new RITM to the current.variables.field_name version of the same.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2019 05:06 AM
Hi,
Let me know if you need any help with that.
If my reply above does end up solving your question, please mark it as Correct.
Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2019 05:43 AM
Hello Allen,
Thank you for your response! I didn't know about Cart API. While this worked well, it created another request. Is there a way to tie this to the same request so that its the original requested items parent as well?
And sorry some clarification on how it looks different, it has the variables shifted in position differ from how they are listed on the copied from RITM when using the script presented in the original post.
Thanks,
Daniel

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2019 12:50 PM
Hi, you should be able to assign the new item to a parent request.
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!