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
Diederik VerstraeteDiederik Verstraete 

Execute different visualforce page based on record field value

Hi, 

I have a basic use case. I need to execute code based on a field value on my record. I have on my Quote object a field "Quote_language__c" with picklist values French and Dutch. 

So normally to send a signrequest, I have a detail page button that executes the signrequest page (send_signrequest). 

What I think is that I need 2 visualforce pages, one for Dutch and one for French. How do I make an "IF-clause" to read the quote language, and execute the correct visualforce page/code based on the field value? 

I have two visualforce pages (send_signrequestFR and send_signrequest) that are actually the same, but the body of the emailmessage is in French and in Dutch. 

I was thinking about Flow to assess criteria, but you can not call a visualforce page from Flow. 

Or can I implement an IF clause in my visualforce code? Something like:

<visualforce page>

<if (Quote_language__c == french)>
   <visualforce page code>

<if (Quote_language__c == dutch)>
   <visualforce page code>

</visualforce page>
Alain CabonAlain Cabon
@Diederik Verstraete

You can use formulae in Visualforce page and play with the property "rendered" of panels.

https://developer.salesforce.com/forums/?id=9060G0000005hMzQAI