How to Set Up Task as a Target Object in Email-to-Anything (e2a)

Introduction

From e2a v3.4956 onwards, e2a has an enhancement to cater to the 'Task' object. Users can now configure the Task object as a target object for both incoming and outgoing emails. This allows emails to be automatically logged as task records in Salesforce, ensuring seamless tracking of communications and follow-ups.

By setting up Task as a target object, incoming emails can create or update Task records, while outgoing emails sent via e2a can also be associated with Tasks, providing a complete email activity history associated with a specific task record within Salesforce.

Instructions

Setting up Task object to work with e2a involves a few steps which are listed below. Before moving forward, please create a Thread Id field on the Task object (Activity) if you have not already done it by following this guide. (Please refer to the section titled 'Add a Thread Id field to your custom Target Object' in the shared link).

Creating a field on e2a Email object to store Task record IDs:

Below are the instructions to create a field on the 'e2a Email' object:

  1. Go to Setup | Object Manager | e2a Email | Field and Relationships.

  2. Click on New button.
  3. Select Type: Text
  4. Enter Length: 18
  5. Enter Field Name: Task_id (You can add any label here)
  6. Enter API Name as: Task_id__c
  7. Click Save button.

Create a Custom Metadata Type under Setup

Next step is to create a Custom Metadata Type and create a record under it with a reference to the field created in above step.

  1. Go to 'Setup' and type 'Custom Metadata Type' in the quick find box.

  2. From the results, open 'Custom Metadata Type'.
  3. Click New.
  4. Set the Label as: Ortoo Customer Settings (Both Singular and Plural labels can be same)
  5. Set the Object Name as: Ortoo_Customer_Settings__mdt (note the "__mdt" gets added automatically)

    Note: If the custom metadata type with label 'Ortoo Customer Settings' already exists, then the above steps can be skipped, and you can directly move to the below-mentioned steps. 

You have successfully created a 'Custom Metadata Type'. Please follow the steps below to create a field under it: 

 

  1. In the same Custom Metadata Type record created above, look for the 'Custom Fields' section and press on 'New'.
  2. Select Type: Long Text Area (131072)
  3. Enter Label as: Value
  4. Enter API Name as: Value__c

As the next step, we will have to create a record under the newly created metadata type. To do that:

  1. Go to 'Setup' and type 'Custom Metadata Type' in the quick find box and open it.
  2. From the 'Custom Metadata Types' list, locate the newly created metadata type i.e. Ortoo Customer Settings.
  3. Press on 'Manage Records' - an option residing on the left side of the metadata type.
  4. Press on 'New'.
  5. Enter the Name as: CustomRelationships
  6. Enter the Label as: CustomRelationships
  7. Enter the Value as: 
    [
    {
    "objectName": "ortoo_e2a__EmailMessage__c",
    "lookupObjectName": "Task",
    "lookupFieldName": "Task_Id__c",
    "relationshipLabel": "Emails For This Task"
    }
    ]

    Note: Above you'll add the API name of the field we just created instead of 'Task_Id__c' in front of "lookupFieldName".
    You will see that the text value provided for "relationshipLabel" will appear as the related list title which we are going to set up in the next step.

You have successfully completed the Custom Metadata Type creation and its associated steps.

 

Adding e2a Emails Related List to Task Object Records

We are now almost ready to use e2a emails within Task object. One last thing to do will be to add the e2a Emails related list on the Task page layout so that we can see all the associated emails for a task record. To do this:

  1. Go to any task record.
  2. Click on the 'gear icon' in the top right corner and click on 'Edit Page'.
  3. Drag the e2aEmailCustomRelatedList component (situated under Custom components) to the Related section of the Task page layout and click Save.
  4. You will be able to see a related list containing the list of emails associated with that particular task record as shown below.
  5. Please note that the label of the e2a emails related list is the same text which was provideded under "relationshipLabel" in the JSON value in the above step.

 

Note: Neither the 'Custom Metadata Type' nor the field on e2a Email object is shipped as part of the package. 

 

Please contact us at support@ortooapps.com for any other queries. 

Was this information helpful?
Quick survey: How do you rate Email-to-anything?
★★★★★ - EXCELLENT
★★★★ - GOOD
★★★☆☆OK
★★☆☆☆POOR
☆☆☆☆ - RUBBISH

-