Field from Opportunities in Task Model


I need to have some opportunity fields in the task template to be used both on a display in a table or as filters. The link between the two models is task with id opportunity

Hi Andrea, This is a Salesforce limitation for polymorphic relationships. Only id and Name fields are accessible. There is a workaround though. You’d need: - the whatid on the task model - to ensure opps you need are in a Opp model - the id on the Opp model - UI only formula field with the model lookup function Pat

Thank You Vachon,

it works! How can I use UIonly formula as filter? 

Hmmm… You want to filter tasks based on Opp values?

Yes, for example all tasks where the stage field is “
qualified” or something like this

Well. Use a filter set based on a new Opp model and then create a model condition on Task Model using the Ids from it. The condition the condition to deactivate if now no rows. If you already have filters setup on the task table, then it’ll look a little odd, but this is the best option without going crazy in javascript.

Thank you Pat!
Unfortunatly in this way I receive Apex heap size too large

Set the new Opp model to not load on page load.