How to insert condition in Visualforce page

How to insert condition in Visualforce page

Insert the following and try to predict what will be displayed if you save the page:
{! IF ( CONTAINS(‘salesforce.com’,’force.com’), ‘Yep’, ‘Nah’) }<br>
{! IF ( DAY(TODAY()) > 14, ‘After the 14th’, ‘On or before the 14th’) }
You’ll see something like this:
Yep
On or before the 14th
Of course, this all depends on when you run the code. After the 14th in a month, it looks different.

Sample Code:

<apex:page controller=”sample”>
    {! IF ( CONTAINS(‘salesforce.com’,’force.com’), ‘Yep’, ‘Nah’) }<br/>
    {! IF ( DAY(TODAY()) > 14, ‘After the 14th’, ‘On or before the 14th’) }
</apex:page>



Output:

Leave a Reply