Search code examples
salesforcesalesforce-marketing-cloudampscript

AMPscript question - need precise syntax to show copy dynamically


I'm trying to write a bit of AMPscript that does the following:

IF firstname exists say "John, your"

IF no firstname say "Your"

I tried this, but it doesn't work:

%%=iif(empty(@firstName),"Your", concat(propercase(@firstName, "your")))=%%

I know it's a simple answer, help would be greatly appreciated!


Solution

  • %%[
    set @Firstname = Propercase[Fristname]
    If empty(@Firstname) then
    set @Firstname = "Your"
    endif
    ]%%
    

    Then you can use @Firstname wherein you want show the name, for example: %%=v(@Firstname)=%% is "your"