Show tasks related to a Contact related to an Account

  • 1
  • Question
  • Updated 4 years ago
  • Answered
Right now on our standard account page, we can see all tasks related to an account as well as all tasks related to a contact that is related to the account.

So if Ben and Jerry work and "Ben & Jerry's"

If I log a task under Ben with the WhoID of Ben (even without a WhatID for Ben & Jerry's) it will show up on the accounts page under the historical tasks.

I can't seem to figure out how to replicate this in Skuid.

Using the standard xml account page provided by Skuid, I noticed the condition for TaskHistory is that the WhatId equal that of the AccountData Model's ID.  So I figured, if I had an OR condition that looked for the WhoId of the Contact Model... maybe that would work... it sort of it... it basically attached a task that had the same contact as the account, but missed other contacts.

I am guessing the WhoId would have to equal the Contact Id of a Contact related to that account...

Thoughts?

Again, I am just looking to make sure that all of Ben's and Jerry's tasks show up under the Ben and Jerry tasks related list (table)  In our regular version of salesforce this appears in the related lists, but I can't replicate in Skuid
Photo of Kramer Keller

Kramer Keller

  • 330 Points 250 badge 2x thumb

Posted 4 years ago

  • 1
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
The best way to ensure this is to build your condition on AccountId field on the task.  Salesforce automatically populates that field pretty effectively.  See this from the official doc: 

The AccountId is determined as follows.
If the value of WhatId is any of the following objects, then Salesforce uses that object’s AccountId.
  • Account
  • Opportunity
  • Contract
  • Custom object that is a child of Account
If the value of the WhatIdfield is any other object, and the value of the WhoId field is a Contact object, then Salesforce uses that contact’s AccountId. (If your organization uses Shared Activities, then Salesforce uses the AccountId of the primary contact.)
Otherwise, Salesforce sets the value of the AccountId field to null.
This should work.... 

Photo of Kramer Keller

Kramer Keller

  • 330 Points 250 badge 2x thumb
Okay, so apparently our old tasks only had a 15 character ID vs the 18 Character ID.  So it is mostly working, except for older tasks that we had prior to our salesforce migration.  So basically any tasks prior to 2014 for us.

Can I write a condition to include tasks where the AccountId = (AccountData)(Id15)?

I feel like if I could pull in the Id15 it would work... but I don't think that option is available, at least not using a "Field from another model".  Could I accomplish this using the sub-query option?
(Edited)
Photo of Rachel King

Rachel King

  • 80 Points 75 badge 2x thumb
Hey Kramer - all records have a 15 digit ID and an 18 digit case safe ID.  The reason it's not working is that tasks are automatically archived by Salesforce after 1 year.  You can see them in the standard UI but not generally report on them.  That being said, you can get around this when building your model - there is a query deleted/archived records checkbox that if you uncheck should bring in those old tasks; also verify there isn't a max # of record limit defined on the model as the default is 20. 
Photo of Kramer Keller

Kramer Keller

  • 330 Points 250 badge 2x thumb
Ah thanks