0

I have a custom visualforce page that has page blocks. When the render condition is false, I receive the expected results when previewing.

The issue is when I change the render criteria to true and preview the page, the page is blank.

I know for a fact the "true" render condition should display at least one record.

Why does the true condition not display the expected result.

rendered="{!IF(Record.Is_Reviewed__c=False,true,false)}"

vs rendered="{!IF(Record.Is_Reviewed__c=True,true,false)}"*

Page

<apex:page lightningStylesheets="true" standardController="BMCServiceDesk__Incident__c" recordSetVar="Records" showQuickActionVfHeader="false">

<apex:form >  
  <!-- Incident Record -->
  <apex:repeat value="{!Records}" var="Record">          
  <apex:pageBlock rendered="{!Record.Is_Reviewed__c==True}">       
      <apex:outputField value="{!Record.BMCServiceDesk__Launch_console__c}" />
      <apex:commandButton value="Save" action="{!save}"/>

  </apex:pageBlock> 
  </apex:repeat> 
</apex:form>            
</apex:page>

Example: I've added the is reviewed check box after the ticket number. If true its blank - the check box doesn't display at all. If false it renders the check box empty box. ANY field I use has the same results.

False render condition

^ True render condition

6
  • Is Is_Reviewed__c boolean field or text field? and secondly use rendered="{!Record.Is_Reviewed__c}" as it displayes based on true condition Sep 21, 2018 at 5:51
  • 2
    You can always replace IF(somecondition, true, false) with simply somecondition. Also you can even replace record.Is_Reviewed__c=true with simply record.Is_Reviewed__c. Regardless, check your Field Level Security.
    – Adrian Larson
    Sep 21, 2018 at 5:54
  • Is_Reviewed__c is a boolean field. I tried removing the if condition and I still encounter the same issue. When is record.Is_Reviewed__c=true the page is blank, when record.Is_Reviewed__c=false the page displays results. Thanks for your help!
    – Gabriel M
    Sep 21, 2018 at 16:08
  • a convenient way to debug this (and verify the FLS hypothesis) is to add <apex:outputField value="{!Record.Is_reviewed__c}"/> as a sort of debug statement right below the apex:repeat.
    – cropredy
    Sep 22, 2018 at 4:11
  • The field level security permissions are enabled for the profile. When the field has no or false render conditions then it displays results. When set to true the page is blank. It doesn't matter what field I use, all true conditions result in a blank page. The visualforce code looks correct according to what everyone has commented and after implementing all suggestions the issue remains.
    – Gabriel M
    Sep 23, 2018 at 1:34

2 Answers 2

1

You need to change the rendered condition like:

<apex:pageBlock rendered="{!IF(Record.Is_Reviewed__c==True, true, false)}">

or

<apex:pageBlock rendered="{!IF(Record.Is_Reviewed__c, true, false)}">

or

<apex:pageBlock rendered="{!Record.Is_Reviewed__c}"> <!--I recommend -->
1
  • Thanks Reshma, sadly the issue is persisting. I tried the suggested render conditions and the issue seems to only effect true values. Because if I change the values to false then the page shows results, while true values display a blank page.
    – Gabriel M
    Sep 21, 2018 at 16:13
0

The issue was with the controller. The reason false values were showing is because that is the default value for the field. True values weren't assigned by the controller so the visualforce render condition was working correctly. I made an extension class and resolved the issue.

Thanks everyone for your assistance.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .