跳到主要内容

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

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

作者列表

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}}. 

有帮助 没有帮助

113 人中 63 人认为这个页面有帮助

添加一条评论

请登录或注册以提交评论。

是否需要密码提醒?