メインコンテンツへスキップ

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 人がこのページは参考になったと答えました

コメントを追加

コメントを投稿するには、ログインまたは登録が必要です。

パスワードをお忘れですか?