Inbound email for service request
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2025 12:17 AM
The requirement is if the user sent a ibound email the ritm needs to be generated
I have create a script in inbound action
The email is getting created but in email the target record is showing 'none' and ritm is also not created
var template nane
var templateFound;
var sub email.subject.toString().toLowerCase();
if (sub.contains("Linux")) {
template name 'SR Email ';
templateFound true;
if (templateFound = true) (
current.applyTemplate(template_name); //'current will not be committed.
var cartid GlideGuld.generate(null);
var cart new cort(cartid);
var item cart.addItem(current.cat_item);
var rc cart.placeorder();
var regiten new GlideRecord("sc_req_item");
regiten.addQuery("request", rc.sys id);
reqItem.query()
if (reqztem.next()) [
reqItem.work notes "received from: " + email.origemail "\n\n" email.body_text;
regitem.contact_type = 'email';
reqitem.impact4
reqItem.urgency 4
reqitem.priority-4
reqItem.update();
sys email.instance = reqitem sys id;
sys_email.target table reqitem.getrableName(); logger loginfo("RITH created, reqItem.number);
//Attachment
var sysättach new GlidesysAttachment);
var emallsysId = sys_email-getuniquevalue);
if (emailSysId)
var sysEmailAttachments sysattach.getAttachments("sys email", emailsysId);
while (sysEmailAttachments.next())
sysemallattachments.setValue("table_name", reqItem.getTableName());
sysEmailAttachments.setvalue("table sys id", reqItem.sys_id);
sysemallattachments.update();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2025 02:39 PM
Hi @keerthana_M
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2025 10:08 PM
you are not passing the catalog item sysId in cartID
sample script using CartJS
var cart = new sn_sc.CartJS();
var request1 = {
'sysparm_id': 'ec10f4fd47266110b81cd855d36d4308', // sys_id of catalog item
'sysparm_quantity': '1',
'variables': {
'requested_for': producer.requested_for, //'8efae6cbdb038b00d6563cae7c961
'short_description': producer.short_description,
'description': producer.description
}
};
var checkoutInfo = cart.checkoutCart();
var cartDetails = cart.orderNow(request);
var requestDetails = cart.submitOrder(request);
check these links as well
Submitting a catalog item from an Inbound Action
creating RITM using inbound action and cart api
this link has solution using Flow, please enhance
Create RITM through inbound action by parsing mail body
1. Flow (No code or low code): https://www.youtube.com/watch?v=uLHCw2GA3lo&t=363s
ServiceNow official information and instructions: https://developer.servicenow.com/dev.do#!/learn/courses/xanadu/app_store_learnv2_flowdesigner_xanadu...
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