Solved

Using signature variables as conditions

  • 27 October 2023
  • 3 replies
  • 132 views

Userlevel 3
Badge +5

We’re looking to use signature templates with custom variables, but can’t find a syntax to add a constant string only when a variable is populated. Front’s variable syntax resembles Twig, but it doesn’t seem to be compatible.

 

If a title exists, we want:

{{user.name}}, {{user.custom.title}}

If no title exists, we want:

{{user.name}}

Not:

{{user.name}}, 

 

Same thing for phone numbers. Bonus points if you can tell me syntax to conditionally include a carriage return.

 

This sample {{recipient.first_name | 'there'}} from the article gives me hope that it’s possible, but we need the opposite (text if exists) or to be able to inject a variable between strings. This is what I really want to do:

{{user.custom.direct} ? ‘Direct ’ + {user.custom.direct} : ‘ | ’}Main 555-555-5555

icon

Best answer by justin 27 October 2023, 22:59

View original

3 replies

Userlevel 3
Badge +8

Hi!

Justin here with the support engineering team 👋

As it turns out, this feature is not currently available in Front, BUT I’m still very happy you reached out about it. I'd be happy to pass this along to our Product team and file it as a feature request. 

Perhaps there's a workaround that could get similar results by placing the comma in the comma in the user.custom.title custom field value. For instance:" , Assitant to the Regional Manager". 

In this implementation, you could then place the variables next to one another like so:

{user.name}{user.custom.title}

This would result in the following:

Dwight Schrute, Assitant to the Regional Manager

If no custom field exists for the variable, no text should populate, leaving just the name. 

 

If there are any other questions, please do not hesitate to reach out!

Userlevel 3
Badge +5

@justin thank you! That was the best workaround we were coming up with too. It works alright except for custom fields synced from clean data in Entra ID. Our short term plan is to just make sure everyone has the fields populated!

Badge

Thank you~

Reply