تخطي إلى المحتوى الرئيس

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

مفيد. غير مفيد

وجد 63 من 113 شخص هذه الصفحة مفيدة

أضف تعليق

الرجاء تسجيل الدخول أو التسجيل لتقديم تعليق.

هل تحتاج إلى تذكير بكلمة المرور؟