Conditional field based on reference field

  • 1
  • Question
  • Updated 2 years ago
  • Answered
I need to show certain fields/sections based on the value of another field (same model) that is a reference field...I've tried making the additional fields render based on the reference field name...and no dice. The problem here, I think, is that the value of said reference field doesn't populate until I save the model (because it's a reference to a related object). Yes, no? But even after I save and refresh, the conditioned fields don't appear. Ideas?
Photo of Lauren Ake

Lauren Ake

  • 368 Points 250 badge 2x thumb

Posted 2 years ago

  • 1
Photo of Will.I.Yam

Will.I.Yam

  • 216 Points 100 badge 2x thumb
It shouldn't require a save. Can you check to make sure you have both the reference field and the corresponding NAME field selected. 

For example:

Account 
Account.Name

Application
Application__r.Name

Something like that.

Can you also screenshot the Render condition setup you have?
Photo of Lauren Ake

Lauren Ake

  • 368 Points 250 badge 2x thumb
Both fields are in the field editor's model. Here's a screenshot (the specific value is set to "Child & Adolescent"

Photo of Will.I.Yam

Will.I.Yam

  • 216 Points 100 badge 2x thumb
Does your value in the field on the page composer include the quote marks? 
Photo of Lauren Ake

Lauren Ake

  • 368 Points 250 badge 2x thumb
No. Should it?
Photo of Will.I.Yam

Will.I.Yam

  • 216 Points 100 badge 2x thumb
No but it would have made me a rockstar!

Would you mind granting login access to us following these steps?

We can take a look at it from there
Photo of Lauren Ake

Lauren Ake

  • 368 Points 250 badge 2x thumb
Hi Will! I set this up. I've been waiting for a NDA to be signed.
Photo of Lauren Ake

Lauren Ake

  • 368 Points 250 badge 2x thumb
Hi Will! Any chance you might have a chance to look at this? I've granted login access to Skuid. Let me know!
Photo of Lauren Ake

Lauren Ake

  • 368 Points 250 badge 2x thumb
Oh, our org id is 00DA0000000H7PW
Photo of Chandra V

Chandra V, Champion

  • 6,966 Points 5k badge 2x thumb
When you create a condition with a string that contains & in it like yours, the string is getting converted to &amp behind the scenes - which is not what you want.  See below:



What you can do is go into your page xml and find this condition, and change it from 

value="Child & Adolescent"/>

to

value="Child & Adolescent"/>

and see if that works.  

You also may want to consider changing your picklist value from Child & Adolescent to Child and Adolescent to avoid any hiccups in the future, since & is a common programming character.
Photo of Lauren Ake

Lauren Ake

  • 368 Points 250 badge 2x thumb
I was wondering if that had something to do with it. I did change the condition reference to the HTML code but that didn't work. I'll just go change it to the word; that seems easiest. Thanks!
Photo of Lauren Ake

Lauren Ake

  • 368 Points 250 badge 2x thumb
Okay so I tried adding some conditions to a different value of that field (it's a reference field, btw, not a picklist...not sure if that makes a difference?) and it's still not working. Should I reference the record ID in the render condition?
Photo of Karl Li

Karl Li, Employee

  • 708 Points 500 badge 2x thumb
Hi Lauren, Will is unfortunately out for paternity leave. Which Skuid page are you looking at and which Salesforce field? Alternatively, if you share your email we could try and setup a short meeting to tackle this issue together.
(Edited)
Photo of Lauren Ake

Lauren Ake

  • 120 Points 100 badge 2x thumb
Here's my email: lauren.ake@eatingrecovery.com

Congrats to Will!!
Photo of Lauren Ake

Lauren Ake

  • 120 Points 100 badge 2x thumb
Hey Karl -- any thoughts on this? Or should I submit an email to help@skuid.com? Let me know!
Photo of Karl Li

Karl Li, Employee

  • 708 Points 500 badge 2x thumb
Hey Lauren, I'm glad you were able to resolve this...feel free to post any more questions you might have here on the Community!