Gå til hovedindhold

I'm having trouble getting variables in custom phrases to work - Videnbase / Using Deskpro / Admin - Deskpro Support

I'm having trouble getting variables in custom phrases to work

Forfatterliste

Question:

I've created a custom phrase, but when I include a template variable in it, it is not replaced with the value. The variable works fine when I put it directly in the template. What's the problem?

 

Answer:

You can't include the standard template variables in a custom phrase. Instead, you use a special format when you include the phrase in the template.

Say you want your custom phrase to include the name of the assigned agent. In the template you'd use this variable:

{{ ticket.agent.display_name }}

 

But in the custom phrase you would include a variable like this:

{{agent-name}}

 

The exact name doesn't matter - this is a variable specific to the custom phrase, that you will reference from the template. Note that you don't put a space between the name and the double-curly brackets as you do with the standard template variables.

Then in the template you would put this:

 

{{ phrase('custom.ticket.auto-notification-agent', { agent-name:   ticket.agent.display_name }) }} 

 

This means that when an email is sent with the template, the value of ticket.agent.display_name is inserted into the custom phrase where you put {{agent-name}}. 

Hjælpsom Unyttig information

63 af 113 personer fandt denne side nyttig

Tilføj en kommentar

Log ind, eller opret dig for at skrive en kommentar.

Har du brug for en påmindelse om adgangskode?