deejay-hub / timeline-lwc

:octocat: An interactive timeline for the Salesforce platform.
https://dave-norris.medium.com/
MIT License
266 stars 72 forks source link

Email Showing as a Task and Task Form - Not Email and Email Form. #285

Closed inspired27 closed 7 months ago

inspired27 commented 7 months ago

Time Warp version Ross 1.14.0

Describe the bug Email is showing as a task and uses task form not email form

To reproduce Hover over Email or open link to detail from email on Time warp

Expected behaviour When hovering over an email see the email details and when open link from email on Time Warp the email form opens

Screenshots Included screenshots Hover Over - got status and due date like a task but it is an email?: image Detail - Shows as Task using task form: image

This is what the actual email looks like from the built in timeline view the assumption is that the Time Warp should look like this also: image

Desktop (please complete the following information):

Windows 10 Chrome (all versions)

Additional context Enhanced Email Enabled - "Enhanced Email elevates email to a standard Salesforce object, with customization options and an API. Emails are no longer stored as tasks, but as full-featured records, complete with details, related lists, and collaboration tools. On email records, users can view their messages exactly as their customers do, complete with formatting."

github-actions[bot] commented 7 months ago

Hello @inspired27 , thank you for submitting an issue we appreciate your time. We will take a look and give you an update as soon as we can. We aim for a 72 hour response time.

deejay-hub commented 7 months ago

Hi @inspired27. Technically the emails are stored as Tasks and EmailMessages when you turn on Enhanced Email - which creates 2 records for every email. The standard Timeline just ignores the Task. You can query or report on the Task - hidden but available.

The key to only show EmailMessages for Time Warp is 2-fold.

1. You need to add the EmailMessage object to the Parent object. (In this example I'll use Contact but you can replicate for Account etc)

a) Navigate to Setup->Custom Metadata Types b) Click Manage Records near the record for Timeline Configuration

image

c) Create a New record with the following values

image

Now when I navigate to a Contact record it will plot the EmailMessage records. These will have a golden colour instead of grey based on the setup above.

Note that at this point you might see the Task AND the EmailMessage corresponding to the same email.

2. You need to filter out Tasks corresponding to emails from Time Warp. You can either deactivate Tasks from showing by finding the metadata record for Contact_Tasks and unchecking the Active flag OR You can filter out tasks that correspond to emails. See config guide in the section Filtering Records where we walk through how to remove Tasks. https://quip.com/ahFCA9VBEKtr

inspired27 commented 7 months ago

Hi @inspired27. Technically the emails are stored as Tasks and EmailMessages when you turn on Enhanced Email - which creates 2 records for every email. The standard Timeline just ignores the Task. You can query or report on the Task - hidden but available.

The key to only show EmailMessages for Time Warp is 2-fold.

1. You need to add the EmailMessage object to the Parent object. (In this example I'll use Contact but you can replicate for Account etc)

a) Navigate to Setup->Custom Metadata Types b) Click Manage Records near the record for Timeline Configuration

image

c) Create a New record with the following values

image

Now when I navigate to a Contact record it will plot the EmailMessage records. These will have a golden colour instead of grey based on the setup above.

Note that at this point you might see the Task AND the EmailMessage corresponding to the same email.

2. You need to filter out Tasks corresponding to emails from Time Warp. You can either deactivate Tasks from showing by finding the metadata record for Contact_Tasks and unchecking the Active flag OR You can filter out tasks that correspond to emails. See config guide in the section Filtering Records where we walk through how to remove Tasks. https://quip.com/ahFCA9VBEKtr

Thanks for getting back to me. I have followed the instructions above created both contact and account, assume the icon is "/img/icon/t4v35/standard/email.svg" as in the screenshot it is cut off. However there is no change, I am still getting the same outcome as before same grey icon and task form no second task icon to filter out yet:

I have tried with Enhanced Email enabled and disabled and both do nothing same outcome:

Am I missing something do I have to do anything else?

image

image

image

inspired27 commented 7 months ago

Have you installed Time Warp on the current version of Salesforce and does the method above work for you?

deejay-hub commented 7 months ago

Yes. I see the task and the emailmessage record.

image

I have configured for Contact only. I amended the setup slightly from my earlier screenshot and made sure I logged out and back in again since the data is cached.

image
inspired27 commented 7 months ago

Yes. I see the task and the emailmessage record.

image

I have configured for Contact only. I amended the setup slightly from my earlier screenshot and made sure I logged out and back in again since the data is cached.

image

It is working now! for contacts but cannot see two entries for Accounts, have I got something wrong?

image

image

deejay-hub commented 7 months ago

EmailMessage relationships as far as I know are not supported on the Account object. So your metadata record for the Account object is ignored since the relationship doesn't exist.

To show indirect relationships (e.g. to see emails sent to Contacts of the Account) to replicate the standard Timeline you have to use ActivityHistory and OpenActivity relationships for Account.

This will plot the Task version of the email and not the EmailMessage. So whilst it shows the Email record correctly the drilldown behaviour will be to the Task.

To see the behaviour you need to inactivate the Account_Tasks metadata record

image

Then activate the records for Account_ActivityHistory and Account_OpenActivities

image

image

We don't support the ability to drilldown to the EmailMessage from the Account or to show fields from the EmailMessage record.

deejay-hub commented 7 months ago

We'll keep this open to look at how we can use the AlternateDetailId field on the ActivityHistory object to automatically drilldown to the EmailMessage for these use cases.

deejay-hub commented 7 months ago

Change logic to include AlternateDetailId is queries to ActivityHistory and OpenActivities. AlternateDetailId is only populated when Enhanced Email is active and is only used for EmailMessages.

When the AlternateDetailId is present then use the value as the recordId to drilldown to.

TimelineService

if (
    (objName == 'OpenActivity' || objName == 'ActivityHistory') &&
    !selectStatement.contains('AlternateDetailId')
) {
    selectStatement = selectStatement + ', AlternateDetailId' + '';
}

private class TimelineRecord {
    private String alternateDetailId;
}

timeline.js

.on('click', function (event, d) {
  let drilldownId = d.recordId;
  if (d.alternateDetailId !== '') {
      drilldownId = d.alternateDetailId;
  }
inspired27 commented 7 months ago

Change logic to include AlternateDetailId is queries to ActivityHistory and OpenActivities. AlternateDetailId is only populated when Enhanced Email is active and is only used for EmailMessages.

When the AlternateDetailId is present then use the value as the recordId to drilldown to.

TimelineService

if (
    (objName == 'OpenActivity' || objName == 'ActivityHistory') &&
    !selectStatement.contains('AlternateDetailId')
) {
    selectStatement = selectStatement + ', AlternateDetailId' + '';
}

private class TimelineRecord {
    private String alternateDetailId;
}

timeline.js

.on('click', function (event, d) {
  let drilldownId = d.recordId;
  if (d.alternateDetailId !== '') {
      drilldownId = d.alternateDetailId;
  }

Hi Dave, thanks very much for looking into this it is an important deal breaker feature for us to show email not 'task as email' in a timeline. Will the changes you have made be available in the Salesforce app exchange?

deejay-hub commented 7 months ago

Might be worth clarifying the change.

  1. Can I plot EmailMessage records on a Contact and Case - yes. Using the technique above.

  2. Can I plot EmailMessage records on an Account - no (not directly). This is because the Email records are indirectly related to the Account - the emails are linked to the Contact that is in turn linked to the Account. What we propose to do is show the Task version of the EmailMessage record (since they are a pair) using the ActivityHistory and OpenActivity relationship (since this includes the indirect records) then when someone clicks the 'Task' record corresponding to the EmailMessage it navigates them to the EmailMessage. From a users perspective it's seamless. They won't even notice it was the Task.

This change will be applied to the code base tomorrow in the epsilon branch and this issue will be flagged as closed.

As for the managed package on AppExchange. As it's a free, community managed package we don't commit to dates since we do this in our spare time. We loosely aim for 2 windows June and November. If it's a deal breaker you might need to find an alternative approach or package up a version from the source code.

Thanks for sharing the issue. Sorry we can't be more specific on timings.

inspired27 commented 7 months ago

Might be worth clarifying the change.

  1. Can I plot EmailMessage records on a Contact and Case - yes. Using the technique above.
  2. Can I plot EmailMessage records on an Account - no (not directly). This is because the Email records are indirectly related to the Account - the emails are linked to the Contact that is in turn linked to the Account. What we propose to do is show the Task version of the EmailMessage record (since they are a pair) using the ActivityHistory and OpenActivity relationship (since this includes the indirect records) then when someone clicks the 'Task' record corresponding to the EmailMessage it navigates them to the EmailMessage. From a users perspective it's seamless. They won't even notice it was the Task.

This change will be applied to the code base tomorrow in the epsilon branch and this issue will be flagged as closed.

As for the managed package on AppExchange. As it's a free, community managed package we don't commit to dates since we do this in our spare time. We loosely aim for 2 windows June and November. If it's a deal breaker you might need to find an alternative approach or package up a version from the source code.

Thanks for sharing the issue. Sorry we can't be more specific on timings.

Hi, thanks for adding the feature. Apologies I am not familiar with packaging, is it possible to package up and implement into a production environment or must it be via AppExchange? as we would like to implement now.

deejay-hub commented 7 months ago

The source code is right here. So if you're familiar with the process you can take the code and put it into whichever environment you like directly. You can also release your own unmanaged OR managed package.

Each approach has pros and cons. But if you go this route you become the custodian of the code you downloaded so any changes have to be managed.

https://trailhead.salesforce.com/content/learn/trails/sfdx_get_started

deejay-hub commented 7 months ago

Closed in v1.15