Editing Default Templates

Infos:

  • Used Zammad version: 5.2.x
  • Used Zammad installation type: Package
  • Operating system: Debian 11
  • Browser + version: Chrome 106.0.5249.61

This is more of a question than a bug report.

I am using the Scheduler to escalate stagnant tickets.

I want to edit the default template /opt/zammad/app/views/mailer/ticket_update/en.html.erb to include the body of the article, so that once a ticket is escalated to 2nd level they can just view the ticket body in the mail. I am having issues with this. I am not very familiar with the variables and how they are implemented. Any assistance appreciated.

When I get the mail now, instead of seeing the article body where I want to see it, I see this:

Information:
#{article / no such object}

I believe I should see the article body where I see #{article / no such object} (this is my understanding). My ticket_update/en.html.erb looks like this:

Updated Ticket (#{ticket.title})

<div>Hi #{recipient.firstname},</div>
<br>
<div>Ticket: (#{ticket.title}) has been updated by "<b>#{current_user.longname}</b>".</div>
<br>
<div>
#{t('Group')}: #{ticket.group.name}<br>
#{t('Owner')}: #{ticket.owner.fullname}<br>
#{t('State')}: #{t(ticket.state.name)}<br>
</div>
<br>
<% if @objects[:article] %>
  <div>
  #{t('Information')}:
  <blockquote type="cite">
  #{article.body_as_html}
  </blockquote>
  </div>
<% end %>
<% if @objects[:changes].present? %>
  <div>
  #{t('Changes:')}:<br>
  <% @objects[:changes].each do |key, value| %>
    <%= t key %>: <%= h value[0] %> -&gt; <%= h value[1] %><br>
  <% end %>
  #{t('Information')}:
  <blockquote type="cite">
  #{article.body_as_html}
  </blockquote>
  </div>
<% end %>
<br>
<div>
  <a href="#{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id}" target="zammad_app">#{t('View this in Zammad')}</a>
</div>

So I thought I would see the content of article.body_as_html - but in place, I see #{article / no such object}

Its probably something very simple.

The resulting email looks like this:

Hi Mark,

Ticket: (Escalation check 3) has been updated by “-”.

Group: 2nd Level Support
Owner: -
State: new>

Changes - edited by Mark:
Group: 1st Level → 2nd Level Support
Information:
#{article / no such object}

View this in Zammad

I made the #{article / no such object} bold to highlight it

I want it to look like:

Hi Mark,

Ticket: (Escalation check 3) has been updated by “-”.

Group: 2nd Level Support
Owner: -
State: new

Changes - edited by Mark:
Group: 1st Level → 2nd Level Support
Information:
Hi, this is a customer sending an email to your support desk. This is the most recent response from the customer.

View this in Zammad

What am I doing wrong? I am just copying what I see in other templates to this one - but I am definitely getting it wrong.

Again, any help, tips or pointers appreciated.

So it seems that many of the variables available in Articles — Zammad documentation are not valid.

They are returning incorrectly, even if they show up properly in other templates.

I have found a workaround by using the built in SLA function - but I think this is not how this is supposed to behave. I cant understand why article.body would return no such object - the object exists in other templates.

Ill keep trying to figure this out so that I can perhaps be of help to the community - it seems that help is sorely lacking on this forum.

Because the object in question is not available in the scope you’re trying to use it.
The notification in question does not fire due to a specific new article but due to a ticket escalating which is missing article scopes. They’re just not needed in that scope within the core.

This is a free community without any guaranteed reply or help.
If you need in time answers due to your business needing that, consider a support contract.

I understand its a free community. That is why I am trying to offer my experience (however limited) to try and assist others like me who may stumble on my post. I have not contacted anyone directly asking for assistance.

I had no intention of offending anyone. I just don’t want people like me to think that there is no help on offer - so I am offering mine.

I now understand why its not working as expected - I still don’t understand the reasoning behind not making these variables available globally - perhaps its a ruby thing I just don’t understand yet. At least I have a useable workaround.

I fear I might have to learn Ruby to make use of Zammad effectively. I would get a support contract, but for my limited use, the cost of the support is simply too high.

Feel free to trash this post if it breaks any community guidelines.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.