Unable to render 2 fields using a basic Condition. Please Help!

  • 2
  • Question
  • Updated 7 months ago
  • Answered
Objective: I have 2 nos of same fields in a field - editor. (AADHAR Status)



1. When the Value is Y (Field 1 should get display) - This has a CSS - Green



2. When the Value is not Y (Field 2 should get display) - This has a CSS - Red



The desired output: Only one Field should be visible at a time. If the value in Y then the 1st one (with Green CSS) and when the value is not Y then the 2nd one (with Red CSS)

But, I am unable to render the fields properly. Instead, I am getting the following Result.



Any help will be highly appreciated.

Thanks
Photo of Nikita Ladia

Nikita Ladia

  • 214 Points 100 badge 2x thumb
  • confused

Posted 7 months ago

  • 2
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Try just one of the fields and see if that one works.
Photo of Nikita Ladia

Nikita Ladia

  • 214 Points 100 badge 2x thumb
Yes it works.
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
So having two of the same field with separate render conditions is causing both to appear? If so, my suspicion is correct. You've found a bug.

What version are you using? Can you test in a sandbox with newer versions?

Does the field need to be editable? If not, you can use a template field to conditionally render the "Y" with custom css using a formula field in the template.

You'd create a UI-Only Boolean called AADHARIsYes. Using this you could set the class of the div in the template field. Something like this.

<div class="{{#AADHARIsYes}}yesClass{{/AADHARIsYes}}{{^AADHARIsYes}}noClass{{/AADHARIsYes}}">{{AADHAR__c}}</div>
Photo of Mike Dwyer

Mike Dwyer

  • 3,390 Points 3k badge 2x thumb
We have to make some assumptions about the code that is not included. Is "AADHAR Status" the label for Aadhar_Authenticate_Aadhaar__c? One also is curious about Aadhar_ and Aadhaar_ . That should be correct using the designer field lists, but field names can change. Rendering rules don't throw errors like SOQL would.

(Pat, I'm am missing something; I don't understand your suggestion.)
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
When using a Template field you can conditionally include text using Boolean fields.

My example calculates in UI-Only Boolean formula field AADHARIsYes as True or False. The formula would be TEXT({{AADHAR__c}}  == "Y".

Using {{#AADHARIsYes}}yesClass{{/AADHARIsYes}}{{^AADHARIsYes}}noClass{{/AADHARIsYes}}">{{AADHAR__c}} would render as class="yesClass" when AADHARIsYes is True and lass="noClass" when AADHARIsYes is False.

The # is for True and ^ is for False.