Email Message Model not returning any rows

I am creating a very simple model of type “Email Message” and then displaying all rows in a table.

For some reason the table returns “No email message to display”, however I can query the same object in Developer Console and it returns 5 rows.

There are not filter conditions on the model.

Here is where you want to dig into the developer tools in the browser and explore the model’s javascript objects in the console. (Not the Salesforce Developer Console)

Open the console and type:
skuid.$M(‘YourModelName’)  

This will return the full javascript object related to the model.   I look at the following nodes of that object.

data:   Here you will see whether you are actually getting data on your page.  If data is there,  there is a problem with the table component you put on the page.

accessible:   Here you will see whether skuid can actually query the model.

soql:   Here you will see the actual query passed to the database by skuid.  Does this match exactly what you put in the sf dev console?

Etc…   Happy debugging    

Thanks Rob for your response.

I followed your steps and looked at the javascript generated for the model. As per the js object’s properties :

isQueryable = True

accessible = true

query  = SELECT ActivityId,Subject,Id FROM EmailMessage LIMIT 21 (returning proper results in the console)

however data array is empty.

I also compared the javascript object with another contact model and everything looked exactly same.

I did some investigation into this - it seems that if an Email Message does not have a parent case, Skuid does not receive it in the model. However, running the query from the Skuid model in the Salesforce Developer Console returns records as expected.

@Rob - any ideas as to why this would be? Seems like something on the platform level, but no idea what…

We too are experiencing the same issue… 

Giovanni - try activating Enhanced Email under settings. The reason we had this issue was that in one of our sandboxes that received Summer 16 but another (where it wasn’t working) hadn’t. Once Summer 16 was released and we activated Enhanced Email, it worked as we expected.

Hope that helps!

Hi Gary, thanks for the suggestion: we checked and we already have the Enhanced Email activated. So the problem should be somwhere else…

What we are trying to achieve is to put in a table in the Lead View all the emails that were sent to each lead, so that our salespeople can see immediately what they already sent.
Right now we managed to connect to the Task model the description field, but that is quite ugly to see, as there is everything in one field.
We would like to put in the different fields for the EmailMessage model (like subject, body of the mail and so on).
We tried with this condition: activityId is in the set of values of the id field of the task model. 
We also tried putting in directly the id of a specific message, but the answer was always “No email message to display”

So right now we are trying to understand if it’s we that are missing something, of it’s a problem with Skuid…

I can’t check right now, but try having your model connect to Email or EmailMessage. If I get time, I’ll see if I can check what we did and reply, but may not be right away I’m afraid! Good luck!

My org is still running into the same issue. We are able to see the email on the task but want to pull it back through the EmailMessage. We have email templates with html and would like to display this for our users.

We have checked the following
1. We have enhanced email on
2. The model says it is accessible = true and  isQueryable = true



Is there a workaround for this? If not, will this be fixed in a skuid patch coming up?

Bump. I just ran into the same problem. Is there a workaround or an expected fix for this?

Enhanced Email is enabled for my org. The model should be working but gets no data. Console output:

Tim,

Maybe it’s a Skuid version problem?  I am seeing rows returned from a model on the EmailMessage object.  This is with Skuid 10.0.10 installed.

Thanks,

Bill

Tim, What version of Skuid are you running on?

Bill & Stephen, thanks for replying. I’m on package version 11.0.3.

Bill, what’s the related object (the whatID) of the Activity object in your EmailMessage model? In my model the whatID connects my Activity to a custom object.

Tim,

I see ActivityId as a field on EmailMessage, but I don’t have any records linked by this field.

I only see records linked to RelatedToId field.  Is this what you are asking?

Thanks,

Bill

Hmm, I guess that must be! What object are those records in the RelatedToId field?

Tim,

I see Opportunities and a custom object in the RelatedToId field.

Thanks,

Bill

Outstanding, now I understand. Thank you so much, Bill. We’ve arrived at different solutions – one can use RelatedToId to get EmailMessage records, and/or one can use ActivityID. But the information you provided helped me understand the EmailMessage object better, and got me on the right path.

What I’m working on is a Page Include with a table of Activities (aka Task model). I created a drawer to show the email body when the Activity is an email. I had an EmailMessage model with an ActivityID condition that was referring to my Task model … however I was not thinking correctly about this. I was relying on an EmailMessage model condition that looked to the Task model, but it just happened that the first Task model record had no EmailMessage record. Instead of a model condition, I needed a Row Context condition in the Field Editor.

I also had to learn about the urlDecode Global Merge:
https://docs.skuid.com/latest/en/skuid/merge-syntax/global-merge-variables.html
My EmailMessage template field now has this content: {{#urlDecode}}{{{HtmlBody}}}{{/urlDecode}}

I’m thrilled about this because with Skuid I’m now able to give my users a way to review email history on a record that is way better than Lightning, which doesn’t render html when viewing activities/“log a call” in a list or a report. We’ve been making big use of Lightning for Gmail, and trying out Cirrus Insight, which means our users are pushing in a lot of EmailMessage records. 

Tim,

Glad you got it working and thanks for posting your solution.  I have used the {{#urlEncode}} quite a lot, but I forgot that there is also a {{#urlDecode}}.  Makes it simple to render HTML from a field.

Thanks!

Bill