inbound email action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2024 07:45 PM
Hi,
When an email is sent to the service desk(servicedesl@example.com) i need a incident to be created using inbound email action.
could you suggest how can we do this using inbound email action.
thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2024 07:53 PM
Hi @siddharth26 ,
- Navigate to "System Policy" > "Inbound Email Actions" in the ServiceNow instance.
- Click on "New" to create a new inbound email action.
- Configure the conditions that trigger the creation of an incident. This typically involves specifying the email address (e.g., servicedesk@example.com) and other criteria if needed.
- Define the actions to be performed when the conditions are met, such as creating a new incident record.
- Here u can write a small GlideRecord query for initializing/creating a new incident
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2024 07:59 PM
Plz check this link for detailed steps.
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2024 08:02 PM
You can create a new inbound email action , give you condition and in script you can write like below:
// Define the inbound email action script
(function process(/*EmailInbound*/ email, /*EmailInboundLoop*/ email_action) {
// Check if the email is sent to the specified address
if (email.to == 'servicedesk@example.com') {
// Create a new incident record
var incident = new GlideRecord('incident');
incident.initialize(); // Initialize the incident record
// Set incident details based on email content
incident.short_description = email.subject; // Use email subject as incident short description
incident.description = email.body_text; // Use email body as incident description
// Set other incident fields as needed
// Insert the incident record
var incidentID = incident.insert();
gs.info('Incident created with ID: ' + incidentID);
}
})(email, email_action);
Please Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2024 08:04 PM
Hi @siddharth26 ,
There is an OOB Email Inbound Action, 'Create Incident', which will do this work. But there are a couple of things that you would need to do:
1. Create a new user or edit an existing user with email address same as the one, from which you are going to send the email. So, you should have a user with same email address as of yours to send the email to ServiceNow.
2. The ServiceNow email address to which email needs to be sent can be found in the 'User name' field on Email Accounts. To locate that, navigate to System Mailboxes -> Administration -> Email Accounts -> ServiceNow SMTP record. Open it and locate the User name field.
3. Navigate to System Mailboxes -> Email properties. Under the Inbound Email Configuration heading, enable Email receiving by selecting the checkbox and then saving it.
4. Now, send an email from the configured email address (your email address) to the ServiceNow email address and refresh the Incident list. You may check the Email Logs (System Logs -> Emails) and locate the email that you sent and the new corresponding incident that opened up in response to that email.
Also,
This section provides a very simple example of how to create a domain-specific inbound email action.
Make sure Domain Separation is active in your instance and the global domain is selected on the domain picker.
Navigate to System Policy > Email > Inbound Actions and click New.
Provide the following values:
- Name: Create Incident – Oceanic
- Target Table: Incident [incident]
- Active: Check
- Script:
(function runAction(/*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) { if(gs.getUser().getDomainID() != 'c9434fce4a3623120181f955f4a3d6e9'){ current.caller_id = gs.getUserID(); current.comments = "received from: " + email.origemail + "\n\n" + email.body_text; current.short_description = "For Oceanic Domain : " + email.subject; current.category = "inquiry"; current.incident_state = IncidentState.NEW; current.notify = 2; current.contact_type = "email"; if (email.body.assign != undefined) current.assigned_to = email.body.assign; if (email.importance != undefined) { if (email.importance.toLowerCase() == "high") current.priority = 1; } if (email.body.priority != undefined) current.priority = email.body.priority; current.insert(); } })(current, event, email, logger, classifier);
Deactivate the Create Incident Inbound Action.
Go to https://<instance>.service-now.com/nav_to.do?uri=sysevent_in_email_action.do?sys_id=3ccfeff5c611227a0180144333c87af9.
Uncheck Active.
Save the record.
Navigate to User Administration > Users, then select the demo user Abel Tuter.
Change Email to an email ID that you can also use, and change its domain to Oceanic Airlines.
Send an email message to your ServiceNow instance's email ID from the email ID value you set.
If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!
Thanks & Regards,
Sumanth Meda