How to create a request(RITM) through code in an Order Guide in servicenow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
HI,
I have a requirement where I need to create a Request(RITM) in an Order guide through code. So, I am implementing this code In a BR as per my requirement.
Order Guide Name-Tech support
Catalog items in an tech support Order guide are 1)Application support 2)Cost support
So now in order to create a request in order guide I need to fill these below fields
1)Requested for(variable in Order guide "Tech support")
2)Category(variable in Order guide "Tech support")
3)Application(variable in catalog item "Application support")
4)Description(variable in catalog item "Application support").
So, I need a sample script where I can set values for all the above variables navigating through order guide and catalog items.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi @sushma123vu ,
Sure, Please check below code
var orderGuideSysId = 'PUT_YOUR_ORDER_GUIDE_SYS_ID_HERE';
var orderGuide = new sn_sc.OrderGuide(orderGuideSysId);
var guideVars = {
'requested_for': '62826bf03710200044e0bfc8bcbe5df1',
'category': 'Software'
}; // You can add your own variables
orderGuide.setVariables(guideVars);
var items = [
{
itemSysID: 'catalog Item SysId',
quantity: 1,
variables: {
'description': 'Incident fix required'
} // Add your variables
}
];
var item = items;
orderGuide.addItem(item.itemSysID, item.quantity, item.variables);
var request = orderGuide.orderNow();
gs.info('Order Guide submitted : ' + request.number);
Please mark my answer correct and helpful if this works for you
Thanks and Regards,
Sarthak
