If-statement in slack templates


I am trying to implement a simple if-statement in the en.md.erb file for the slack integration
What I tried was this:

<% if #{ticket.updated_by.vip} != true %>
Update by non-VIP
<% else %>
Updated by the VIP #{ticket.updated_by.firstname}
<% end %>

But this syntax must be somehow broken, because the slack integration stopped working with this code in the file. Can anyone push me in right direction for the syntax?

Thanks! :slight_smile:

ticket.updated_by may be not available by the time Slack notification is sent. Try ticket.customer instead.

It should be there, as I can output it in slack
the line
#{ticket.updated_by.vip} will print true or false correctly.

it seems to be a problem with my syntax, as it stops working completely when i add the code above

What about something like this?

<% if @objects[:ticket].updated_by.vip != true %>

1 Like

That’s it, you rock! Thanks :slight_smile:

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