Call log chart, but likely have issues with polymorphic whatid and whoid from Task Object

  • 1
  • Question
  • Updated 4 years ago
I'm being asked to build a chart for the Calls in the Task object. I can filter based on the Names of WhatId and WhoId using other models to do this. Issue I have is that I'm not sure how to get the labels on the chart to reflect data in the models used to populate whatid and whoid of the Task object.

Does anyone follow?

Thinking maybe I label the chart with the relevant Id's, and replace them with javascript after the chart is loaded.

Thoughts
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb

Posted 4 years ago

  • 1
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Wait, I think I can do this I think. Same thing I did in another post where I feed the conditions from another model with the name and ID for a multiselect filter.
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
The question is then, are the fields used to display in the table filter going to show up in the chart.
Photo of J.

J., Official Rep

  • 7,470 Points 5k badge 2x thumb
Pat,

I may not be understanding what you're trying to do, but does it not work to use a Split Template of {{Who.Name}}?

Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
I need to access fields other than Id and Name on a custom object.
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
This is an interesting thought on models. I think the following is correct, but I'm trying to follow some logic in order to flesh out how models and/or SOQL work.

When providing only the AccountId for a new contact, none of the related fields on the Account are viewable on the Contact row until the row is saved.

When providing the AccountId for a new contact by making an AccountId condition point to the Id of an Account model, the related fields on the Account are viewable on the Contact row before the row is saved.

Is this is a function of Skuid "linking" them together or something else going on?
Is this something SOQL does?

In above example example, the reference field is a master-detail and thus not polymorphic.

The whatid of the Task model would not allow for this as the fields, other than Id and Name, can't be included in the model/SOQL as it is polymorphic. One interesting twist on this though is that the Task model can be filtered by the whatid using id's from another model. Those id's can be represented by "Display" fields of your choosing in a filter on a table component.

My question is this, are the fields as "Display" fields in the filter accessible for the chart labels? ie. Show Qty of Tasks for each Account by week?

If not, can I simply use the IDs for the chart labels, and upon completion of the chart loading, replace the Id's with the fields of my choosing in javascript?
(Edited)
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
bump
Photo of Glenn Elliott

Glenn Elliott, Champion

  • 7,738 Points 5k badge 2x thumb
You're entering a world of pain here. The standard Activity object (which subtypes into Event and Task) is a labyrinthine mess of nuances, restrictions, semi-documented "features" and mostly unrelenting agony. Just when you kill off one of its beastly goblins, it'll launch a new horde at you, with different superpowers. I wish you well.

In PractiFI, we abandoned it entirely and went custom.
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Oh man! Now I want to figure it our even more!
Photo of J.

J., Official Rep

  • 7,470 Points 5k badge 2x thumb
Pat,

I haven't tried this, but I think your idea about swapping the Ids out for what you actually want to show will work. The gist of the strategy would be...
  1. Create models to pull in what you actually want to show on the Chart for the labels
  2. Associate the Chart with your Task model and set the labels to the Id field
  3. In a Before Render Snippet, loop through the chartObj.series array, and swap out the Name property for whatever you want to show on the chart
I'd use a JS object, keyed off Salesforce Id, with the values being whatever you want to show for that record as a map in your loop for matching/swapping. Make sense?