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
Matthew Parker 6Matthew Parker 6 

Render outputtext value if account field equals/contains string

Hello,

I'm composing an email template that will have variable text only if the account subtype (custom field) validates against a set value for premium customers. The end results would be something like:
 
"You are now certified to sell our products and you have access to our premium services."

I have tried every combination of IF and CONTAINS I can think of, defining the premium text as both an inline value and as the contents of a containing tag, including the examples below:
 
<apex:outputtext value=" and you have access to our premium services" rendered="{!IF(Account.Sub_Type__c == "B2B - Premium Customer")}" />

<apex:outputtext value=" and you have access to our premium services" rendered="{!CONTAINS(Account.Sub_Type__c, "Premium Customer")}" />

<apex:outputtext value=" and you have access to our premium services" rendered="{!IF(CONTAINS(Account.Sub_Type__c, "Premium Customer"), true, false)}" />

<apex:outputtext rendered="{!IF(CONTAINS(Account.Sub_Type__c, "Premium Customer"), true, false)}"> and you have access to our premium services</apex:outputtext>

Is this a syntax issue, is this a problem with outputText? Can I not validate account fields in an email to a contact? Any help you can provide would be appreciated.
Edwin VijayEdwin Vijay
Your syntax looks alright. Is the field level security all good?
Edwin VijayEdwin Vijay
Could you post the code? or atleast the opening tag?
Matthew Parker 6Matthew Parker 6
Ugh, I hate to admit it but this was a rookie mistake. I had cloned an existing HTML template without thinking much about it. Once ported into a Visualforce template, everything works as expected. (-‸ლ) :: face palm ::
Cem Kolukisa 2Cem Kolukisa 2
Matthew, which version of the code ended up working for you?