function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Damien RibbansDamien Ribbans 

Help with evaluating an apex:outputField to yes/no.

I am new to VF and trying to display a simple field showing a contacts name and whether they have completed two questionnaires (which are stored on the contact record via a Lookup Field to the Questionnaire_Instance__c object. So far I have:
 
<apex:page standardController="Contact" showheader="false" lightningstylesheets="True">
    <apex:pageBlock title="Participant Session Block Details">
    <Apex:PageBlockSection columns="1" >
        <apex:outputField value="{!contact.Name}"/>
        <apex:outputField label="Has the start questionnaire been completed?" value="{!contact.Start_Questionnaire_Instance__c}"/>
        <apex:outputField label="Has the end questionnaire been completed?" value="{!contact.End_Questionnaire_Instance__c}"/>
        </Apex:PageBlockSection>
    </apex:pageBlock>
</apex:page>
I would like the start and end questionnaire instances to return 'Yes' if the field has a value in it, and 'No' if it is empty. How do I do that please?
 
Best Answer chosen by Damien Ribbans
ANUTEJANUTEJ (Salesforce Developers) 
Hi Damien,

Although there could be multiple ways to implement this use case one of the way I could think of is to do the checking on the object side and update two fields then you could try accessing those two fields from the contact record.

I hope this helps.

Regards,
Anutej 

All Answers

ANUTEJANUTEJ (Salesforce Developers) 
Hi Damien,

Although there could be multiple ways to implement this use case one of the way I could think of is to do the checking on the object side and update two fields then you could try accessing those two fields from the contact record.

I hope this helps.

Regards,
Anutej 
This was selected as the best answer
Damien RibbansDamien Ribbans
Thanks - I will give that a go. It may be more useful actually, given that I want to access a couple of different objects at some point on that page. I was a little confused as I thought I could use dot notation for the relationships, but this may be a better way of achieving it anyways :)