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…
- Models
- Activities
- Fields
- ContactsAccount
- Formula: MODEL_LOOKUP to Contacts model, returns Contact.Account
- LeadCompany
- Formula: MODELL_LOOKUP to Leads model, returns Lead.Company
- WhoId
- Looks up to both Contacts & Leads
- ContactsAccount
- Conditions
- ...
- Actions
- When model is queried, query Contacts & Leads model
- Fields
- Leads
- Fields
- Id
- Company
- Conditions
- Id is in Activities.WhoId
- Fields
- Contacts
- Fields
- Id
- Account
- Conditions
- In is in Activities.WhoId
- Fields
- Activities
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
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.