Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2024 08:32 AM
Hi @Community Alums ,
Try with below code.
// Assuming 'email' is your incoming email object
var gr = new GlideRecord('incident'); // Change 'incident' to your target table
gr.initialize();
gr.short_description = email.subject;
// Other ticket fields here
// Check for attachments
var attachment = new GlideSysAttachment();
var attachments = attachment.getAttachments(email.sys_id);
if (attachments) {
gr.comments = "An attachment was discarded during ticket creation.";
}
// Insert the record
var ticketSysId = gr.insert();
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
LinkedIn: https://www.linkedin.com/in/runjay
YouTube: https://www.youtube.com/@RunjayP
-------------------------------------------------------------------------