Model Condition contains or starts with first 3 letters of Object ID

  • 1
  • Question
  • Updated 3 years ago
  • Answered
We are starting to use tasks heavily and my users are asking for a Correlation page where they can quickly look at tasks related to homes, tasks related to clients, tasks related to vehicles in one page instead of having to jump from Object detail page to Object detail page.  

In my mind I could create multiple models with a condition that says if WhatID contains (or more preferably begins with) a03, or 001 etc (the first three letters of the record id = the object).  In this way I would be able to show a list of tasks related to a home, client or other custom object.  Or I could show all objects and apply filter buttons that quickly filter out the list to just home tasks etc.  IS there any way to do this using conditions on a model?
Photo of Rich Slack

Rich Slack

  • 4,134 Points 4k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Rich,

Not sure if you want to do this, but I think you could add a formula field to return the text of the first three characters from your WhatID, and then create a condition on that field. 
Photo of Anna Wiersema

Anna Wiersema

  • 10,890 Points 10k badge 2x thumb
Dear Rich, it's totally possible to create a page like this. I think the best way to do it is to create one model & table on Tasks and then add an automatic select option filter on the What.Type field. (You get to this field by clicking on the arrow-thingy next to the Related To / WhatId  field and then selecting the Type field).  This way  will do all the hard work for you!

You could also create a filterable condition on the What.Type field on your Tasks model and then create a manual select option filter so that you can specify only the objects you want to appear in the list (in this case I think it'll be like Home__c, Client__c for custom objects, and Contact, Lead for standard objects).

You could (even fancier) do the manual select option filter and choose "model" as the source and then create a new *aggregate* task model, with a grouping on the what.type field, and then do your filter's option source the aggregate model and use the type field as the label (e.g. {{whatType}} ), so you only have objects show up in the picklist that are actually currently associated with tasks.

Were you able to follow all that? Was it helpful for you?  Let us know if you have further questions, I'd definitely be willing to send you the XML for the test page I created to help me answer this question ;)
Photo of Rich Slack

Rich Slack

  • 4,134 Points 4k badge 2x thumb
I ended up using the {{whatType}} field with the name of the object or custom object and it works beautifully. Thank you for the suggestion. I did not realize Salesforce identified those tasks so cleanly. It works perfectly.
(Edited)
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Glad you got it figured out Rich.  Thanks for letting us know your solution. . .