- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2020 11:48 AM
I'm trying to generate multiple RITM with a Record Producer and GlideappCalculationHelper API.
Script is not working. Nobody knows why?
var reqHelper = new GlideappCalculationHelper();
reqHelper.addItemToExistingRequest(current.sys_id.getValue(), <cat item id>, 1); // 1 is the qty
reqHelper.rebalanceRequest(current.sys_id.getValue());
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2020 11:43 PM
Best Way to solve this is use Service Catalog Script API to create both Request and RITM needed and then abort record producer to not generate a new boid request item.
Here is the code:
// cat_item sys_id
var CN = '43d255771b812010c01fff37dc4bcbcd';
// Create new chart
var cart = new sn_sc.CartJS();
// add item to char
var item =
{
'sysparm_id': CN,
'sysparm_quantity': '1',
'variables':{
<item variables>
}};
var cartDetails = cart.addToCart(item);
// Checkout Chart
var checkoutInfo = cart.checkoutCart();
// Redirect record producer to new request item
producer.redirect='sc_request.do?sys_id=' + checkoutInfo.request_id;
producer.portal_redirect='sp?id=sc_request&is_new_order=true&table=sc_request&sys_id=' + checkoutInfo.request_id;
// Abort new boid request creation
current.setAbortAction(true);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2020 12:42 AM
It's running on global scope
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2020 11:43 PM
Best Way to solve this is use Service Catalog Script API to create both Request and RITM needed and then abort record producer to not generate a new boid request item.
Here is the code:
// cat_item sys_id
var CN = '43d255771b812010c01fff37dc4bcbcd';
// Create new chart
var cart = new sn_sc.CartJS();
// add item to char
var item =
{
'sysparm_id': CN,
'sysparm_quantity': '1',
'variables':{
<item variables>
}};
var cartDetails = cart.addToCart(item);
// Checkout Chart
var checkoutInfo = cart.checkoutCart();
// Redirect record producer to new request item
producer.redirect='sc_request.do?sys_id=' + checkoutInfo.request_id;
producer.portal_redirect='sp?id=sc_request&is_new_order=true&table=sc_request&sys_id=' + checkoutInfo.request_id;
// Abort new boid request creation
current.setAbortAction(true);