I want to use the email inbound feature to create incidents only when the sender is sys_user.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2024 10:40 PM
Hi,my name is ko-shi
I'm working on creating incidents from incoming emails using ServiceNow's "inbound Action".
While I can successfully create incidents by directly specifying the sender in the 'from' field, I'm having trouble implementing the following logic:
- Create an incident only if the sender is a sys_user.
- If the sender is not a sys_user, send an email reply.
I'm hoping someone can help me with this. Here's the script I'm currently using:"
「Javasprict codes」
current.caller_id = gs.getUserID(); // Sets the caller ID to the current user's ID
current.comments = "received from: " + email.origemail + "\n\n" + email.body_text; // Sets the comments to include the sender's email and the email body
current.short_description = email.subject; // Sets the short description to the email subject
current.contact_type = "Email"; // Sets the contact type to "Email"
// If the user ID is not found, add a comment to the incident
if (current.caller_id == "") { current.comments += "\n\n" + "Sorry, we couldn't identify your user ID. Please contact our support team for further assistance."; }
// Sets the caller name to the sender's email address current.caller_name = email.origemail;
current.category = "Question/Inquiry"; // Sets the category to "Question/Inquiry"
current.incident_state = IncidentState.NEW; // Sets the incident state to NEW //current.notify = 2; // Sets the notification level to 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2024 11:59 PM
hi @Koshiyama Kenta ,
Please refer the below links to achieve this
https://www.servicenow.com/community/now-platform-forum/auto-reply-to-unregistered-users/m-p/1242983
Thanks,
BK