Using display values in text modules

  • Used Zammad version: 2.6.x
  • Operating system: Windows 10
  • Browser + version: Google Chrome 70.0.3538.77

We are facing a smaller issue with the text modules. We created a custom attribute on the user object (fieldname: salutation, type: select), with the choices ‘mr’ => “Herr”, ‘mrs’ => “Frau” etc.

In our text module we have “Guten Tag #{ticket.customer.salutation} #{ticket.customer.lastname},”
In general, this works, but it gives back the key of the custom field. (So the text module is transformed to “Guten Tag mrs Müller”.)
We would like to use the display information on the field though, instead of the key information. (So the value, which is also shown on the users profile, where ‘Frau’ is rendered as expected.)

I tried several ways to have the desired output:
#{ticket.customer.salutation.display}
#{ticket.customer.salutation.value}
#{ticket.customer.salutation_value}
#{ticket.customer.salutation_display}

But all of them break the text module.
Is anyone facing the same issue? Can anyone help?

Thank you,

Ole

I had a similar idea with the salutation, but I chose a different solution. I didn’t like the idea of storing the salutation in the user object because that would require manually editing the users and choosing the correct salutation before the text module works properly.

Instead I just created different text modules that already contain the salutation, e.g.:

::hf -> Hallo Frau #{ticket.customer.lastname},<2 new lines>
::hh -> Hallo Herr #{ticket.customer.lastname},<2 new lines>
::hv -> Hallo #{ticket.customer.firstname},<2 new lines>

Have you considered just using Herr, Frau etc. as keys? Using mrs and mr as keys doesn’t really seem advantageous in this situation, because there’s no way to specifiy different translations depending on the agent’s or user’s language anyway.

1 Like

We’re doing exactly the same thing @martin.von.wittich is doing.

hf - Hallo Frau #{ticket.customer.lastname}
hh - Hallo Herr #{ticket.customer.lastname}
hi - Hallo #{ticket.customer.firstname}

The reason is that our zammad admin (myself) is way to lazy to maintain the gender of every user in zammad (500+).

cheers

1 Like

We at Zammad use Martins approach as well. :>

Hello Everyone,

we are pushing the salutations out of a different system via API into Zammad. As the information is already existing, I would rather utilize them instead of creating more individual text blocks.

We changed the API and are now mapping the salutations from English to German. They are now existing in German in the Zammad Database and so the database value can be used with the placeholders.

Thanks,

Ole

Starting with Zammad 2.9.0, you are able to use #{ticket.customer.salutation.value} to access select field values.

This was implemented via: https://github.com/zammad/zammad/issues/1568

I’m closing this topic because your problem seems to be solved. Please open it again if you have further questions.

2 Likes