Prevent the customer from changing the status

  • Used Zammad version: 3.1.x
  • Used Zammad installation source: package
  • Operating system: CentOS 7
  • Browser + version: MF68esr

Expected behavior:

If a customer open the Zammad website and open one of his tickets, he should only be able to close his own ticket.

Actual behavior:

If the customer is watching his ticket, he can change the ticket state to open, close or in process. This states should be hidden.

Is there a possibility to filter unwanted states from the customers overview?
He should only have the opportunity to close the ticket… Not to change to “open” or “in process”.
Thx and have a great day!

Yours, Daniel.

I can’t help with that, maybe @thorsteneckel has a smooth solution without too much of hacking? :slight_smile:

Hey @Mr_P - yes, this possible but a bit advanced. You need to enter the Zammad rails console and do the following:

First find out the name of the states you want to be visible to the customer. To find out all available state names run Ticket::State.all.pluck(:name). This returns a list like that: ["open", "new", "pending reminder", "closed", "merged", "removed", "pending close"]. Now if you want the customer to be able to only close the ticket you have to pick the state closed. Next up we need to change the state ObjectManager Attribute to only show this state. We can do so by running the following commands:

# get the State ObjectManager Attribute
attribute = ObjectManager::Attribute.find_by(name: 'state_id')

# here comes the relevant part: Limit the State selection to the `ticket.customer` role to `closed` in the `edit` screen
attribute.screens['edit']['ticket.customer']['filter'] = Ticket::State.where(name: ['closed']).pluck(:id)

# save your changes
attribute.save!

That’s it. These changes are update save.

Hope this helps :+1:

3 Likes

Hi @thorsteneckel, thanks for your solution!

Here is my output:

If i understand this correctly, the filter is set to [2, 4, 9]… So open, closed and in process. :+1:
Now it works as desired. Thank you very much!

1 Like

I’ve created a pull request to have this in our docs for the future:

2 Likes

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