- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2022 07:24 AM
We have this issue for awhile and want to know why the target field is not populated with this script and the attachments are not associated to the RITM?
I have the advanced inbound action script below:
(function runAction( /*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {
var cart = new Cart();
cart.initialize();
item = '3bc821e41b3f901021adfeeccd4bca6c';
var ritm = cart.addItem(item);
cart.setVariable(ritm, 'description', email.body_text);
var screquest = cart.placeOrder();
})(current, event, email, logger, classifier);
Here's the result:
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2022 02:37 AM
I believe the quantity is mandatory and is resulting in your NullPointer
'sysparm_quantity': '1',

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2022 07:40 AM
Hi,
As you're not using the "current" object, SN doesn't implicitly know what record you're wanting to set. You can set the target as below:
Note I've moved you to using the modern sn_sc.CartJS script as the Cart API is deprecated!
(function runAction( /*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {
var cart = new sn_sc.CartJS();
var request =
{
'sysparm_id': '3bc821e41b3f901021adfeeccd4bca6c',
'sysparm_quantity': '1',
'variables':{
'description': email.body_text,
}
};
var cartDetails = cart.orderNow(request);
//assuming two-step is off
sys_email.instance = cartDetails.request_id;
sys_email.table = "sc_request";
})(current, event, email, logger, classifier);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2022 08:10 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2022 02:37 AM
I believe the quantity is mandatory and is resulting in your NullPointer
'sysparm_quantity': '1',
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2022 02:11 PM
Thank you. Looks good to me now - just had a minor change used sys_email.target_table instead of sys_email.table:
sys_email.instance = cartDetails.request_id;
sys_email.target_table = "sc_request";
My next question was how to get the RITM number instead of the REQ.