Empty custom placeholder replaced by dash (-)

A while ago someone had already made this suggestion: Empty placeholders, i.e.: How do I implement a "title" field?

The problem is simple: there are no logical branches in text modules. To be able to realize at least simple conditional text outputs, the output of empty text modules when they in fact are empty would be helpful.

Example: we create a simple text object “Salutation”. Depending on the origin of the ticket, the values are then set via API to, e.g., Mr., Ms., Mrs. Dr., etc. For tickets for which we have no information on the salutation, the field remains empty.

We can then specify the following in a text module:

Good day #{ticket.user.salutation} #{ticket.user.firstname} #{ticket.user.lastname}

If an empty text module would be outputted as it is (empty), the result would then be, for example:

Good day  Max Mustermann

not nice because of the extra space, but ok.

Currently, however, the output is:

Good day - Max Mustermann

→ that’s unusable… The more complex the use case, the more unusable

Maybe it would be an option to make the placeholder character configurable e.g. via a system variable? As default then gladly “-” but with the possibility to output an empty string instead?

What do you say?

1 Like

We currently work around this issue by using more generic templates of which you have to delete the unwanted parts.

Regarding the salutation we are using a template like “Dear Mr. / Dear Ms. Xyz”…

This is not ideal but better than the “-”

BR wucherpfennig

In fact, we have currently solved it in a similar way. But we find it so impolite to address customers in this way that we would like to change it.

And a configuration option with the hyphen as default would not change anything for users who expect the previous behaviour.

Of course, something like #{if} #{endif} would be even nicer, but with really empty placeholders there would at least be a few more possibilities.

Another use case for using really empty placeholders to further personalise communication:

We have a text object “greetings_to” and synchronise it via API with a localised string that refers to the customer’s place of residence if known, e.g. “to Mbarara”.

With this we could add in the signature:

Greetings #{ticket.user.greetings_to}

Result would be:

Greetings to Mbarara

If greetings_to is not set that should be the result:

Greetings

Since Zammad outputs a minus sign instead of empty placeholders, but the result is:

Greetings -

2 Likes