I want to use the email inbound feature to create incidents only when the sender is  sys_user.

Koshiyama Kenta
Tera Contributor

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:

 

  1. Create an incident only if the sender is a sys_user.
  2. 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

1 REPLY 1