- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2025 04:15 AM
Hi Team,
My requirement is to Create RITM taking Information from 3rd Party.
Here user will submit one form related Onboarding, then request will get submitted in that application then i want to pull that data daily basis and create RITM in ServiceNow with same details filled in variables of that RITM because that form is also available here.
Do I need to use here scripted rest message? if yes what should be the approach?
or Should I use get Rest Message to get the info and simply use that script in schedule script and run that script every 3o min and in script use that data and create RITM ?
Is there any another approach I should be using?
Thanks ,
BR
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2025 10:57 PM
yes you can use scripted REST API and use Cart API or CartJS and it will set RITM variables
Once RITM is created the associated workflow or flow will get triggered
try {
var cartId = GlideGuid.generate(null);
var cart = new Cart(cartId);
//add your requested item to the cart by sys_id of the catalog item
var item = cart.addItem('0336c34407d0d010540bf2508c1ed096', 1);
//fill in the variables on the request item form
cart.setVariable(item, "asset", "00a96c0d3790200044e0bfc8bcbe5dc3");
cart.setVariable(item, "multiple_choice", "Phoenix");
var rc = cart.placeOrder();
gs.info(rc.number);
} catch (ex) {
gs.info(ex);
}
Another way
try {
var cart = new sn_sc.CartJS();
var item = {
'sysparm_id': '0336c34407d0d010540bf2508c1ed096',
'sysparm_quantity': '1',
'variables': {
'user': '7282abf03710200044e0bfc8bcbe5d03',
'asset': '00a96c0d3790200044e0bfc8bcbe5dc3',
'multiple_choice': 'Phoenix',
}
};
var cartDetails = cart.addToCart(item);
var checkoutInfo = cart.checkoutCart();
gs.info('Order details' + JSON.stringify(checkoutInfo));
} catch (ex) {
gs.info('Exception' + ex);
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2025 10:57 PM
yes you can use scripted REST API and use Cart API or CartJS and it will set RITM variables
Once RITM is created the associated workflow or flow will get triggered
try {
var cartId = GlideGuid.generate(null);
var cart = new Cart(cartId);
//add your requested item to the cart by sys_id of the catalog item
var item = cart.addItem('0336c34407d0d010540bf2508c1ed096', 1);
//fill in the variables on the request item form
cart.setVariable(item, "asset", "00a96c0d3790200044e0bfc8bcbe5dc3");
cart.setVariable(item, "multiple_choice", "Phoenix");
var rc = cart.placeOrder();
gs.info(rc.number);
} catch (ex) {
gs.info(ex);
}
Another way
try {
var cart = new sn_sc.CartJS();
var item = {
'sysparm_id': '0336c34407d0d010540bf2508c1ed096',
'sysparm_quantity': '1',
'variables': {
'user': '7282abf03710200044e0bfc8bcbe5d03',
'asset': '00a96c0d3790200044e0bfc8bcbe5dc3',
'multiple_choice': 'Phoenix',
}
};
var cartDetails = cart.addToCart(item);
var checkoutInfo = cart.checkoutCart();
gs.info('Order details' + JSON.stringify(checkoutInfo));
} catch (ex) {
gs.info('Exception' + ex);
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2025 08:49 AM
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader