Model Lookup

  • 1
  • Question
  • Updated 1 year ago
  • In Progress
I'm trying to create a simple Model Lookup formula with page with two models, ContactData and a task model.  It won't return any values.  What am I doing wrong?

MODEL_LOOKUP("ContactData","Household","ID",{{WhoId}})
Photo of Allison

Allison

  • 1,158 Points 1k badge 2x thumb

Posted 1 year ago

  • 1
Photo of Stephen Sells

Stephen Sells, Official Rep

  • 16,856 Points 10k badge 2x thumb
What is the setup of your underlying Salesforce Organization? Have you checked the Schema Builder?
Photo of Allison

Allison

  • 1,158 Points 1k badge 2x thumb
I think they are linked correctly because I am able to pull the Who.ID in the task object correctly in a separate field, and it matches the correct contact ID. 

The schema builder image is below.
Photo of Michael Pierce

Michael Pierce

  • 544 Points 500 badge 2x thumb
Allison, I'm relatively certain your problem is that you've used "ID" instead of "Id" in your MODEL_LOOKUP formula, which is very sensitive to syntax in my experience. Give that simple change a try and see if it helps.
Photo of Allison

Allison

  • 1,158 Points 1k badge 2x thumb
Thanks Michael.  I was using "ID" but changed to "Id" and same results.  Any other ideas?
Photo of Allison

Allison

  • 1,158 Points 1k badge 2x thumb
Hmmm, I tried switching and still not getting anything.
Photo of Michael Pierce

Michael Pierce

  • 544 Points 500 badge 2x thumb
I see you have an Email2 field. Are you completely certain you have data in the Email field you're referencing in the MODEL_LOOKUP field?
Photo of Allison

Allison

  • 1,158 Points 1k badge 2x thumb
Yes, and I've adjust the field pulled to another and still nothing coming through.
Photo of Stephen Sells

Stephen Sells, Official Rep

  • 16,836 Points 10k badge 2x thumb
What are you hoping will show in the lookup field?
Photo of Allison

Allison

  • 1,158 Points 1k badge 2x thumb
The email address from the matching contact object.
Photo of Bill McCullough

Bill McCullough, Champion

  • 12,436 Points 10k badge 2x thumb
Allison,

Can you share the XML for the ContactData and Household models?

Thanks,

Bill
Photo of Allison

Allison

  • 1,158 Points 1k badge 2x thumb

Thanks Bill.  I updated the code and the page works but still doesn't produce any data :(

Photo of Bill McCullough

Bill McCullough, Champion

  • 12,436 Points 10k badge 2x thumb
Allison,

I don't think your ContactData model is getting any contact records that would match a WhoId in you task model.  Install my page and take a look at the condition on the ContactData model.  I am getting contact records where the Id of the Contact is 'IN' the set of WhoId returned by the task model.  I am guaranteeing some matches.

You can verify this manually if you view the models in your console or add the Who.Id field to your table and add another table to display the contact Id's.

Thanks,

Bill
Photo of Allison

Allison

  • 1,158 Points 1k badge 2x thumb
Thanks Bill.  I appreciate all the help but something still isn't matching up correctly.  I'm having the table also just display the WhoIDs.  I can then go and manually search for them on a different contact table and find the data manually.  The lookup feature just isn't working (or I'm not doing something right! :/ ...
Photo of Allison

Allison

  • 1,158 Points 1k badge 2x thumb
The really frustrating thing is that I can get this to work in the basic Salesforce reporting menu too.  Not very often that SF native is easier to figure out than Skuid!
Photo of Bill McCullough

Bill McCullough, Champion

  • 12,436 Points 10k badge 2x thumb
Allison,

I recommend that you install my sample page and see if it returns email addresses.

I think what is happening is that your ContactData model is not returning enough records to find a match in your Task model.  You could increase the record limit on your ContactData model to 1000 and see if you get some matches.  The better option is to add a condition to your ContactData model to return contacts who are in the list of Tasks that you are viewing (that is where the ContactData contact Id matches the WhoId from your Task model).

Thanks,

Bill