+ Start a Discussion
David PoynterDavid Poynter 

What is wrong with this code???? "Syntax Error: Found 'Last_Name'

{!Last_Name}", "{!Nickname} IF({!Secondary_Nickname}="null", " " , " & " {!Secondary_Nickname} IF({!Last_Name}={!Secondary_Last_Name}, " " , {!Secondary_Last_Name}))


Basically I want Lastname, Nickname, and if there is a secondary nickname, add lastname nickname, unless they both have the same lastname, in which case exlude the second lastname. Does this make sense?
Best Answer chosen by David Poynter
David PoynterDavid Poynter
So I figured it out a couple hours later. I first went ahead and referenced the first - {!Last_Name}, {!Nickname} - in the value bar, and then created a formula resource with the IF statement as follows (that I referenced after the last name, nickname) -

IF({!Secondary_Nickname} = NULL, "", "& "&{!Secondary_Nickname} &IF({!Last_Name}={!Secondary_Last_Name}, "",", "& {!Secondary_Last_Name}))

The part I was missing was the fact that the references cannot have the quotes around them, just the non referenced strings. I also needed to add the & to concatinate the strings in quotes and the reference strings together. Knowing this I could now put the two codes together in the same formula, so it would all read as - 

{!Last_Name}&", "&{!Nickname} &IF({!Secondary_Nickname} = NULL, "", "& "&{!Secondary_Nickname} &IF({!Last_Name}={!Secondary_Last_Name}, "",", "& {!Secondary_Last_Name}))

Hope this makes sense. I REALLY think trailhead needs to create a trail just to teach "FlowDesigner", its a really powerful tool, but is not taught anywhere in trailhead very well at all!