Render conditions when value comes from another model

  • 1
  • Question
  • Updated 3 years ago
  • Answered
  • (Edited)
I'm searching for ideas on how to conditionally render a field from Model A based on whether or not a field in Model B contains a value from a field in Model C.

1) Conditional Rendering field (A) based on field in another model (B) using the "contains" will not work because Conditional Rendering does not apply merge syntax on the "value" property (C).
2) Formula fields do not have a "Contains" operator so unable to add UI only field to Model B and check if field contains value from field in Model C

Example (note that example is not real world, just demonstrating the use case):
Model A - Contact has field "MyField"
Model B - Account has field "Members" which is a comma delimited list of aliases
Model C - User has a field "Alias"
Rule - Show Contact.MyField if Account.Members contains User.Alias

The only solution I've come up with thus far is to resort to javascript with a UI only model and creating the row programatically.

I have 100+ pages and they all will have some need for this - the largest pages could have upwards of 50+ of these conditional fields.

Anyone have any suggestions/ideas outside of javascript?  Am I overlooking a way formula fields could be used?  I'm hoping that I'm just really really tired and overthinking this :)

Appreciate any insight/thoughts/suggestions, thank you!
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
Anyone have any ideas here?  Thanks!
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
I"m thinking out loud here. 

Create a model D that is really just an indicator. No fields really needed.   It has conditions that return the same account as B, but only if the Members Field contains the alias value from model C. 

Then do your conditional rendering based on the presense of rows in model D. 

This is untested.  so YMMV... 
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
Thanks Rob.  This should work, however some screen that I am building have 50+ fields that need this type of logic but each field would "pivot" on a different field from Model B.  Translated, this would require 50+ additional models so unfortunately, it's a non-starter.

Any other ideas/suggestions?