You need to sign in to do that
Don't have an account?
Matthew 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:
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:
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.
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>
<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 Vijay
Your syntax looks alright. Is the field level security all good?
Edwin Vijay
Could you post the code? or atleast the opening tag?
Matthew 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 2
Matthew, which version of the code ended up working for you?