The CreatorCon Call for Content is officially open! Get started here.

Inbound Email address on Incidnet

Donald Small
Giga Contributor

We have multiple inbound email addresses in our instance that result in an incident being created.  We have a request to know what address a user is sending to that is creating the request.  How can I go about adding the inbound address as a field on the incident record?

2 REPLIES 2

Tushar
Kilo Sage
Kilo Sage

Hi @Donald Small 

 

  1. Create a new custom field on the Incident table to store the inbound email address.
  2. Create a script include that extracts the inbound email address from the email message.

 

var EmailInboundAddressExtractor = Class.create();
EmailInboundAddressExtractor.prototype = {
  initialize: function() {},

  // Extracts the inbound email address from the email message
  extractEmailAddress: function(emailMessage) {
    // Implement your logic here to extract the email address from the email message.
    // You can use regular expressions or other methods to parse the message.
    // Return the extracted email address.
    return 'example@email.com'; // Replace with actual extraction logic.
  },

  type: 'EmailInboundAddressExtractor'
};

 

3. Create a Business Rule on the Incident table that triggers when a new incident is created and sets the inbound email address in the custom field.

 

 

(function executeRule(current, previous /*null when async*/) {
  // Use the script include to extract the inbound email address.
  var emailMessage = current.comments.getJournalEntry(1); // Assuming the email message is in the first journal entry.
  var emailExtractor = new EmailInboundAddressExtractor();
  var inboundEmail = emailExtractor.extractEmailAddress(emailMessage);

  // Set the inbound email address in the custom field.
  current.u_inbound_email_address = inboundEmail; // Replace with your custom field name.

})(current, previous);

 

 

Please, don't forget to mark my answer as correct if it solves your issue or mark it as helpful if it is relevant for you!

Regards,
Tushar

Revanth Karra
Tera Expert

Dear Donald,

 

Hi @Donald Small . Hope you're doing great! 

 

To create a custom field on the incident table:

  1. Go to System Definition > Fields.
  2. Click New.
  3. In the Table field, select incident.
  4. In the Name field, enter a name for the field, such as Inbound Email Address.
  5. In the Type field, select String.
  6. Click Save.

Once you have created the custom field, you need to add it to the incident form:

  1. Go to System Definition > Forms.
  2. Click the Incident form.
  3. Drag and drop the Inbound Email Address field from the Available Fields list to the Incident form layout.
  4. Click Save.

Now, when an incident is created from an inbound email, the inbound email address will be populated in the Inbound Email Address field.

 

To automatically populate the Inbound Email Address field:

 

var inboundEmailAddress = email.from;

current.setValue('Inbound Email Address', inboundEmailAddress);

 

 

Kindly, please mark my solution as Helpful/Correct, if applicable. If I could help you with your Query then, please hit the Thumb Icon and mark as Correct!!

 

Thanks & Regards, 

Revanth. K

Product Test Automation Engineer