Can a context condition support multiple conditions and before load actions?

  • 1
  • Question
  • Updated 3 years ago
  • Answered
Hi All,

I am configuring a tab within a drawer, and I am facing some challenges getting the desired records to load.  

Setup
I am using an OR condition on a Task Model where the conditions are evaluating two Account Ids on the task object (Standard SFDC Account Id and a custom text field where an Account Id may be stamped by a flow).  For the two conditions, I assign the Id values in the before load actions (Account Id is set in a context condition).  Please find below screenshots of the settings I am using.

Result
I am able to get it to work when I test the conditions separately, but when I use them together with an OR, it does not work.

Any ideas on how to get this to work or what is happening?

Thanks,
Mason

Photo of Mason McMullin

Mason McMullin

  • 140 Points 100 badge 2x thumb

Posted 3 years ago

  • 1
Photo of Jack Sanford

Jack Sanford, Champion

  • 8,322 Points 5k badge 2x thumb
When you query the model in the before load action, are you using get more or completely replace?

I've had some issues with model conditions and before-load actions. So will be interesting to see what others say in response.
Photo of Mason McMullin

Mason McMullin

  • 140 Points 100 badge 2x thumb
Hey Jack,
I was using get more.  I just tried using the complete replace, and still no records are rendering.
Photo of Jack Sanford

Jack Sanford, Champion

  • 8,322 Points 5k badge 2x thumb
Get more is what you want, so you're only having to load the relevant records and can improve page load speed.

I have an idea, not sure if it will work - what if you activate and set one condition and then query the model, and then activate and set the other condition and query the model again, so four total actions instead of the three you've got now. Will that work?
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
So, Context conditions do not have a way of setting grouping logic.  (Though you may be able to do the grouping in the XML... No guarantees) I'm not sure you are going to get any joy here. 

But to debug this - I'd start by taking off all context conditions in your drawer tab component.  Does any data show up there? 
Then look at the actions that are enacted in the opening of the drawer.  Are you correctly setting the condition and requerying the model? 
Then I'd look at the condition on the model itself.  If you query that modle on page load and put its results in a table outside the drawer do you get data?
(Edited)
Photo of Mason McMullin

Mason McMullin

  • 140 Points 100 badge 2x thumb
Thanks Rob and Jack for your responses and suggestions.  After trying your suggestions and debugging.  I was still not able to get it to work.

I tried to implement the desired functionality differently by using two context conditions. I did notice the following:

When two context conditions were present - No data showed

When one context condition was present (tried each of the two conditions by themselves) - the correct data for that condition showed.

Since I was only changing the context conditions, I believe my opening drawer actions and model conditions were set properly.

Is it possible to have two context conditions on a table in a drawer?  Thoughts on what might be happening?  
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
The conditions are going to be put together with AND logic.  So if you want Apples that are Red OR Green,  you won't be able to get that with context conditions becuase NO Apple satisfies BOTH conditions.