Skip to main content

Our Sales team would like to be able to see the Company field of the Lead that their activity is connected to through the WhoId field.

However, the WhoId field looks up to two separate objects; Contact & Lead. When I try to select fields to lookup through the model it doesn’t show the Company field.

How can I modify the XML or field to see the Company field from the Lead Object through the WhoId field on the Task (Activity) Object?


I solved this problem by using 2 UI-Only formula fields. Each field uses a MODEL_LOOKUP that looks at another model. One model for Contacts and one model for Leads. The conditions on each of the models is set to load from the ids from the WhoId field on the Activities model.


This successfully pulls in data from either record (depending if the Who field is connected to a Lead or Contact) into the Activities model. Then I just use a template with the {{#field}} {{field}} {{/field}} to conditionally display whichever ui-field has data.


However, I’m running into another issue as now when I filter the table it doesn’t display the data…


The problem is the UI-Only formula fields that use the MODEL_LOOKUP function don’t refresh when I filter the Activities Model.


To explain…


  1. Models
    1. Activities
      1. Fields
        1. ContactsAccount
          1. Formula: MODEL_LOOKUP to Contacts model, returns Contact.Account

        2. LeadCompany
          1. Formula: MODELL_LOOKUP to Leads model, returns Lead.Company

        3. WhoId
          1. Looks up to both Contacts & Leads


      2. Conditions
        1. ...

      3. Actions
        1. When model is queried, query Contacts & Leads model


    2. Leads
      1. Fields
        1. Id

        2. Company


      2. Conditions
        1. Id is in Activities.WhoId


    3. Contacts
      1. Fields
        1. Id

        2. Account


      2. Conditions
        1. In is in Activities.WhoId




The above is a workaround to be able to pull in the Lead.Company & Contact.Account fields. It works on page load, but when i try to select a different filter and query on the Activities model it doesn't show the Lead.Company or Contact.Account anymore. If I do a manual refresh of all 3 models it works, but I can't get it to work off the Activities model actions.

Looking at the data with chrome console after I select a new filter shows that the models queried correctly, but the UI-Only Fields don't have any values until I do a manual query of all 3 models.


Hope this makes sense! I would really appreciate any help!

THank you

Reply