I have an output text field in visualforce page, which has a rendered condition. A few permission set does not have access to that object being checked in the rendered condition and we are getting this error:
The value 'null' is not valid for operator '>'. Error is in expression '{!cert.certiObj.Insured_Informations__r.size > 0}' in component in page dispositionpage`
Is there any work around to still render the page succecssfully to ignore the error?
<apex:outputText value="{!cert.certiObj.Insured_Informations__r[0].Insured_Info_Name__c}" rendered="{!cert.certiObj.Insured_Informations__r.size > 0}" id="prodName2"/>
How do I check if Cert.certiObj
is null then don't check for null on child obj?
Best Answer
You can check if your collection is null before comparing its size. Note this error indicates
cert.certiObj.Insured_Informations__r
is null, notcert.certiObj
.However, this approach is quite clunky, and it may be worth just caching the Boolean as a property:
Then in your markup simply: