Need help with Event Data Model

  • 1
  • Question
  • Updated 5 years ago
This is a pretty basic question.  I want to display all events that are related to multiple Account records that meet a certain criteria. I am having trouble pulling in the related event records.

What is the best way to approach this?  

For example, I have hundreds of account records with a picklist equal to 'Office B'.  I want to list all events that are tied to any of these account records.  

Thanks!  

Photo of Peter Herzog

Peter Herzog

  • 1,664 Points 1k badge 2x thumb
  • skuidish

Posted 5 years ago

  • 1
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Your condition on the Events model needs to reference the value of the Event's parent account picklists field.   Some options:
1. You can hard code the condition to a particular picklist field,  
2. You can have this picklist field value be passed into the page as a URL Parameter - and then use that parameter to populate the value of the condition.  
3.  If that picklist field is already selected in another model on the page,  you can use the "Field from another model" content property to connect the Event model condition to the other model. 

Hopefully those explanations will work for you.  If not, don't hesitate to let us know. 
Photo of Peter Herzog

Peter Herzog

  • 1,664 Points 1k badge 2x thumb
Thanks Rob!  I understand the items you list however here is what I am seeing.  

I have a model "Office B Accounts" that pulls all the account records that meet the criteria.  That is working properly.

Then I have a model based on the Event-Object that has the condition:

WhatID = (Office B Accounts)(Id)

The latter model is not pulling any Event records.  

What am I doing wrong?
Photo of ktyler

ktyler

  • 9,244 Points 5k badge 2x thumb
Peter,
Have you tried substituting a literal account id in condition on the event-object to see if it pulls in the event records you expect ? That would let you know where the problem is.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
The problem is that the WhatID object really doesn't bring with it any of the information from the underlying information.  So you can't make a condition that directly asks "show me Events whose WhatID accounts are of type X"    All the What ID object has is really the account id, its name and a type reference 

What you can do is create a subquery condition.

Step 1.  Create first Condition: 

(I used a task model because it had more data)

Field:  WhatID
Value:   Content - Result of a Subquery, 
              Join object:  Account
              Join Field:   Id  (the Account ID)

Step 2.  Create the sub-condition. 

Here you replicate the condition you built to filter the accounts.  I just did account type = press  because I knew that would return my test data.  Value for this condition could be a param id,  a field from another model etc. 

Hopefully that will help you out.