0

Our Salesrep can write some text in a textbox field which is related to a campaign. This field should print on the letter. The Salesrep can use some words which are substitute in the process.

If the write in the text [LASTNAME] the process substitutes the word into the name of the campaign member.

Can I do this substitution in combination of an If condition like below?

If the Salesrep put [EZR_SALUTAION] to the textbox it should be substitute with MR if the gender is M.

<apex:outputText 
          escape="false" 
          value="{!SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(wrapper.Kamp_Textvorlage, 
                       '[FIRSTNAME]', wrapper.KampMem_Firstname),
                       '[LASTNAME]', wrapper.KampMem_Lastname),
                       '[EZR_SALUTATION]',
                       {!If(wrapper.Ezr_Gender = 'M', 'MR', 'MS')}),
          }" />

1 Answer 1

0

You almost have it -- you need to remove the {! and } from the IF. Once you start a merge expression in Visualforce with a {!, you don't use {! again until after the closing }

That is, to use a simple example ...

 {!SUBSTITUTE(wrapper.Kamp_Textvorlage,
    '[EZR_SALUTATION]',
    IF(wrapper.Ezr_Gender='M','Mr','Ms')
  )} 

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .