Conditions help

  • 1
  • Question
  • Updated 3 years ago
Ok, I need some help setting up conditions. There's probably an obvious way to do this, but I'm not seeing it. Here's the deal.

I have two Models (A and B) on different objects. Both have a multipicklist field called List__c. We'll call them ListA and ListB

When a user changes ListA, I need to set a condition on B such that if any of the values of ListB for rows in B are in ListA, those rows will pass the condition.

For example:
ListA is set to Apple;Orange

The Object B has rows:
Row. ListB
  1. Apple;Orange
  2. Orange
  3. Banana;Lemon
  4. Orange;Lemon
What should my condition look like so that a query on B returns rows 1,2,4?

I've been trying to use a 'field from another model' condition, but both 'includes' and 'is in' don't seem to work the way I want.

Do I have to use a 'multiple specified values' condition and inject the value every time it's changed?
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
Multi picklists may be the issue. I had a similar problem a while ago that I never solved so I changed from multi picklists to a many-to-many relationship set up where I created a custom object to store my picklist options and used a junction object to allow many to many relationships.
Another work around if you can't get it to work the way you want might be to create a Salesforce formula field for each picklist option. It is convoluted, but you could separate out each picklist item into a separate field by having the result of the formula be "Orange" if the picklist Includes Orange etc....
Then you could put multiple conditions on ModelB with "or" condition logic ( i.e.: 1 or 2 or 3 or 4).
Not an eloquent solution to say the least.....
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Thanks, Raymond. I have the comfort of knowing now that this isn't a trivial problem I just couldn't figure out easily. But now I have to solve a convoluted problem...
;)
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
I have faith in you!