How to create order guide item via inbound email When I receive the notification,

venkatamahesh
Tera Contributor
 
3 REPLIES 3

G Ponsekar
Mega Guru

Hi @venkatamahesh ,

 

you can try like below in your inbound email action script:

 

var orderGuideAPI = new SNC.ScriptableOrderGuide();
var orderGuide = orderGuideAPI.getOrderBySysID("<Order Guide Sys ID>"); // Replace with the sys_id of your Order Guide

// Set the variables for the Order Guide itself (if applicable)
// orderGuide.variables.<variable_name> = <value>;

// Set the variables for the RITMs that will be generated by the Order Guide
var ritmVariables = [];
ritmVariables.push({name: "<variable_name_for_item1>", value: "<value_for_item1>"});
ritmVariables.push({name: "<variable_name_for_item2>", value: "<value_for_item2>"});
// Add more variable objects for each RITM and its variables as needed

// Create the cart based on the order guide and RITM variables
var orderCart = orderGuideAPI.createCart(orderGuide, "Requested", ritmVariables); // "Requested" is the state

// Submit the order
orderCart.submit();

gs.info("Order Guide submitted. Request created: " + orderCart.getRequest().sys_id);

 

If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!

 

Thanks, GP

pavani_paluri
Giga Guru

Hi @venkatamahesh ,

 

Creating an Order Guide item via inbound email in ServiceNow is not directly supported out of the box like standard catalog items — because Order Guides are more complex (they include multiple items, rules, and variable mappings).

But it can be achieved by designing a custom Inbound Email Action with logic to create request first, then ritms as per items of the order guides.

 

For variable information also,you can insert into sc_item_option table using GlideRecord. You have to include logic to trigger flows/workflows as well.

 

Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Pavani P

 

 

Ankur Bawiskar
Tera Patron
Tera Patron

@venkatamahesh 

check how you can do via script

Order a Order Guide using script 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader