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

Having Issues with Simple IF Statement

Trying to create an Visualforce email template but having issues using IF statement to displaying a field if another field is not blank but getting an error message:


Error: Syntax error. Missing '}'


Here is the code below:


{!IF(relatedTo.Prior_Campaign_Link__c != ''), relatedTo.Prior_Campaign__r.Name, '')}




You got an extra close parentheses inside your IF statement.


The correct syntax is:


{! if (relatedTo.Propr_Campaign_Luck__c != '' , relatedTo.Prior_Campaign__r.Name, '') }


The "IF" statement takes 3 params: the condition, true condition, false condition.


For more information about "IF" statement and other formula functions, please see the Visualforce Developer's Guide.




correct syntax to use if condition in visual force templates is