Email inbound actions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-21-2023 10:53 PM
When a user submits a catalog item, an email will be sent to particular email id.
So if they sends any response it needs to be captured in ritm worknotes (this is not for one ritm)
How to create inbound action for this?
Like conditions and script.
In condition what exactly should be there so that ,only that particular email's response should capture in ritm worknotes.
And script for that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-21-2023 11:40 PM
Hi @User_267 ,
To capture responses from emails sent to a specific email address and update the corresponding Requested Item (RITM) work notes, you can set up an Inbound Email Action in ServiceNow. Here's how you can configure the conditions and script for this scenario:
### Inbound Email Action Conditions:
In the conditions section of the Inbound Email Action, you can set criteria to filter emails based on the sender's email address or subject. For example, you can filter emails based on the subject line containing a specific keyword or a unique identifier.
Conditions could look something like this:
- `Subject` `CONTAINS` `"Your Unique Identifier"`
- `AND`
- `Sender Email` `IS` `"specific.email@example.com"`
### Inbound Email Action Script:
In the script section of the Inbound Email Action, you can use a script to process the email body and update the corresponding RITM's work notes. Here's an example script in Javascript:
```javascript
(function process(/*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) {
var requestBody = request.body.data; // Get the email body
// Parse the email body and extract necessary information (e.g., work notes, RITM number)
var workNotes = parseEmailBody(requestBody);
// Find the RITM record based on the unique identifier in the email subject or body
var ritm = findRITMRecord(requestBody);
// Update RITM work notes with the captured response
if (ritm) {
ritm.work_notes = ritm.work_notes.getDisplayValue() + '\n' + workNotes;
ritm.update();
}
// Return a response if necessary
response.setStatus(200);
response.setBody('Email processed successfully.');
})(request, response);
```
In the above script:
- `parseEmailBody` is a function you create to extract relevant information from the email body.
- `findRITMRecord` is a function you create to find the corresponding RITM record based on the unique identifier provided in the email subject or body.
- `ritm.work_notes.getDisplayValue() + '\n' + workNotes` appends the captured response from the email to the existing work notes of the RITM.
Please note that you'll need to implement the `parseEmailBody` and `findRITMRecord` functions according to your specific use case and data format.
Additionally, ensure that the inbound email action is properly configured in your ServiceNow instance, including the email address where emails are sent, and the conditions match the criteria you want for processing emails and updating RITM work notes. Testing is crucial to verifying that the email processing and work notes update work as intended.
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2023 08:32 AM
As you mentioned above, what does it mean, implement parse email body??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2023 08:41 AM
Hi @User_267 ,
It means the logic for collecting information present in the body of the email needs to be present in that parseEmailBody function
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2023 08:57 AM
How can I mention specific catalog item name?? So that whatever reply we get it can capture in that ritm worknotes