Client salutation using Nicknames on joint

I’m stumped and not sure if this is even possible. @Elizabeth

I would like to make a salutation using just first names whether coupled or single, but have it use the nicknames where there is one.

I’ve pulled the code for the salutation from the help page:

Just first names, whether coupled or single: {{ join(" & ", CurrentClient.Info.ID.FirstName, CurrentClient.Info.SpouseID.FirstName) }}
Use nickname if it is present: {{# CurrentClient.Info.ID.Nickname}} {{.}} {{/end}} {{# not(CurrentClient.Info.ID.Nickname)}} {{CurrentClient.Info.ID.FirstName }} {{/end}} {{CurrentClient.Info.ID.LastName}}

but I can’t make them work together.

Nicole

@grangers2016 It’s absolutely possible, but a chunk of code to get there! Interesting challenge for me to see if I can figure out the conditions. (Remember to pop this into a text editor to remove any formatting on the code before you paste it into the template editor.)

{{# not(coupled(CurrentClient))}}{{# CurrentClient.Info.ID.Nickname }}{{.}}{{/ CurrentClient.Info.ID.Nickname }}{{# not(CurrentClient.Info.ID.Nickname) }}{{CurrentClient.Info.ID.FirstName }}{{/ not(CurrentClient.Info.ID.Nickname) }}{{/ not(coupled(CurrentClient))}}{{# coupled(CurrentClient)}}{{# CurrentClient.Info.ID.Nickname }}{{# CurrentClient.Info.SpouseID.Nickname}}{{ join(" & ", CurrentClient.Info.ID.Nickname, CurrentClient.Info.SpouseID.Nickname) }}{{/ CurrentClient.Info.SpouseID.Nickname}}{{# not(CurrentClient.Info.SpouseID.Nickname)}}{{ join(" & ", CurrentClient.Info.ID.Nickname, CurrentClient.Info.SpouseID.FirstName) }}{{/ not(CurrentClient.Info.SpouseID.Nickname)}}
{{/ CurrentClient.Info.ID.Nickname }}{{# not(CurrentClient.Info.ID.Nickname) }}{{# CurrentClient.Info.SpouseID.Nickname}}{{ join(" & ", CurrentClient.Info.ID.FirstName, CurrentClient.Info.SpouseID.Nickname) }}{{/ CurrentClient.Info.SpouseID.Nickname}}{{# not(CurrentClient.Info.SpouseID.Nickname)}}{{ join(" & ", CurrentClient.Info.ID.FirstName, CurrentClient.Info.SpouseID.FirstName) }}{{/ not(CurrentClient.Info.SpouseID.Nickname)}}{{/ not(CurrentClient.Info.ID.Nickname) }}{{/ coupled(CurrentClient)}}

Basically, to break it down:

  1. It looks first to see if the person is NOT a coupled return {{# not(coupled(CurrentClient))}} and deals with the single taxpayers and showing the nickname if necessary.
  2. Then it looks at the coupled returns {{# coupled(CurrentClient)}} and deals with the different variations based on whether both people have a nickname or just the current client or just the spouse.

I think I’ve covered off the scenarios, but let me know if I missed something.

That’s amazing, But it did not work at first.

I found that the " needed fixing, not sure why, but they looked looked a little different. If you look at them some are curlier than others???

I changed them all (by deleting and re-keying) and it’s working now.

Here’s the fixed code:
{{# not(coupled(CurrentClient))}}{{# CurrentClient.Info.ID.Nickname }}{{.}}{{/ CurrentClient.Info.ID.Nickname }}{{# not(CurrentClient.Info.ID.Nickname) }}{{CurrentClient.Info.ID.FirstName }}{{/ not(CurrentClient.Info.ID.Nickname) }}{{/ not(coupled(CurrentClient))}}{{# coupled(CurrentClient)}}{{# CurrentClient.Info.ID.Nickname }}{{# CurrentClient.Info.SpouseID.Nickname}}{{ join(" & “, CurrentClient.Info.ID.Nickname, CurrentClient.Info.SpouseID.Nickname) }}{{/ CurrentClient.Info.SpouseID.Nickname}}{{# not(CurrentClient.Info.SpouseID.Nickname)}}{{ join(” & “, CurrentClient.Info.ID.Nickname, CurrentClient.Info.SpouseID.FirstName) }}{{/ not(CurrentClient.Info.SpouseID.Nickname)}}
{{/ CurrentClient.Info.ID.Nickname }}{{# not(CurrentClient.Info.ID.Nickname) }}{{# CurrentClient.Info.SpouseID.Nickname}}{{ join(” & “, CurrentClient.Info.ID.FirstName, CurrentClient.Info.SpouseID.Nickname) }}{{/ CurrentClient.Info.SpouseID.Nickname}}{{# not(CurrentClient.Info.SpouseID.Nickname)}}{{ join(” & ", CurrentClient.Info.ID.FirstName, CurrentClient.Info.SpouseID.FirstName) }}{{/ not(CurrentClient.Info.SpouseID.Nickname)}}{{/ not(CurrentClient.Info.ID.Nickname) }}{{/ coupled(CurrentClient)}}

Thanks @Elizabeth

Thanks @grangers2016 I see the issues. The mismatched curly quotes would definitely cause issues. I’ve updated the way it is displayed in my previous response so that the forum doesn’t convert them to curly quotes.

For future reference, it is also available on this page: Client Details | Templates | TaxCycle

And here, formatted as code:

{{# not(coupled(CurrentClient))}}{{# CurrentClient.Info.ID.Nickname }}{{.}}{{/ CurrentClient.Info.ID.Nickname }}{{# not(CurrentClient.Info.ID.Nickname) }}{{CurrentClient.Info.ID.FirstName }}{{/ not(CurrentClient.Info.ID.Nickname) }}{{/ not(coupled(CurrentClient))}}{{# coupled(CurrentClient)}}{{# CurrentClient.Info.ID.Nickname }}{{# CurrentClient.Info.SpouseID.Nickname}}{{ join(" & ", CurrentClient.Info.ID.Nickname, CurrentClient.Info.SpouseID.Nickname) }}{{/ CurrentClient.Info.SpouseID.Nickname}}{{# not(CurrentClient.Info.SpouseID.Nickname)}}{{ join(" & ", CurrentClient.Info.ID.Nickname, CurrentClient.Info.SpouseID.FirstName) }}{{/ not(CurrentClient.Info.SpouseID.Nickname)}}
{{/ CurrentClient.Info.ID.Nickname }}{{# not(CurrentClient.Info.ID.Nickname) }}{{# CurrentClient.Info.SpouseID.Nickname}}{{ join(" & ", CurrentClient.Info.ID.FirstName, CurrentClient.Info.SpouseID.Nickname) }}{{/ CurrentClient.Info.SpouseID.Nickname}}{{# not(CurrentClient.Info.SpouseID.Nickname)}}{{ join(" & ", CurrentClient.Info.ID.FirstName, CurrentClient.Info.SpouseID.FirstName) }}{{/ not(CurrentClient.Info.SpouseID.Nickname)}}{{/ not(CurrentClient.Info.ID.Nickname) }}{{/ coupled(CurrentClient)}}

Thank you for this! I’m updating my T1 templates now and this is very useful.

Also, if you want to use nicknames in the address as well, and your clients have different last names:

{{# CurrentClient.Info}}
{{# not(coupled(CurrentClient))}}
{{# ID.Nickname }}{{.}}{{/ ID.Nickname }}
{{# not(ID.Nickname) }}{{ID.FirstName }}{{/ not(ID.Nickname) }}
{{/ not(coupled(CurrentClient))}}
{{# coupled(CurrentClient)}}
{{# ID.LastName = SpouseID.LastName}}
{{# ID.Nickname }}
{{# SpouseID.Nickname}}
{{ join(" & ", ID.Nickname, SpouseID.Nickname) }} {{ID.LastName}}
{{/ SpouseID.Nickname}}
{{# not(SpouseID.Nickname)}}
{{ join(" & ", ID.Nickname, SpouseID.FirstName) }} {{ID.LastName}}
{{/ not(SpouseID.Nickname)}}
{{/ ID.Nickname }}
{{# not(ID.Nickname) }}
{{# SpouseID.Nickname}}
{{ join(" & ", ID.FirstName, SpouseID.Nickname) }} {{ID.LastName}}
{{/ SpouseID.Nickname}}
{{# not(SpouseID.Nickname)}}
{{ join(" & ", ID.FirstName, SpouseID.FirstName) }} {{ID.LastName}}
{{/ ID.LastName = SpouseID.LastName}}
{{# ID.LastName != SpouseID.LastName}}
{{# ID.Nickname }}{{# SpouseID.Nickname}}
{{ join(" & ", join(" ", ID.Nickname, ID.LastName), join(" ", SpouseID.Nickname, SpouseID.LastName)) }}{{/ SpouseID.Nickname}}
{{# not(SpouseID.Nickname)}}
{{ join(" & ", join(" ", ID.Nickname, ID.LastName), join(" ", SpouseID.FirstName, SpouseID.LastName)) }} {{/ not(SpouseID.Nickname)}}
{{/ ID.Nickname }}
{{# not(ID.Nickname) }}
{{# SpouseID.Nickname}}
{{ join(" & ", join(" ", ID.FirstName, ID.LastName), join(" ", SpouseID.Nickname, SpouseID.LastName)) }} {{/ SpouseID.Nickname}}
{{# not(SpouseID.Nickname)}}
{{ join(" & ", join(" ", ID.FirstName, ID.LastName), join(" ", SpouseID.FirstName, SpouseID.LastName)) }} {{/ not(ID.Nickname) }}
{{/ coupled(CurrentClient)}}
{{/ CurrentClient.Info}}