Infos:
- Used Zammad version: 3.4
- Used Zammad installation source: source
- Operating system: Ubuntu 18.04.4
- Browser + version: Google Chrome Version 83.0.4103.106 (Official Build) (64-bit)
I not familiar with Rails, and I try follow the documentation to add a new ticket state but comes out error.
Expected behavior:
Documentation: https://docs.zammad.org/en/latest/admin/console/working-on-tickets.html
-
sudo zammad run rails c
-
Ticket::State.create_or_update(
name: ‘resolved’,
state_type: Ticket::StateType.find_by(name: ‘resolved’),
ignore_escalation: true,
active:true,
created_by_id: 1,
updated_by_id: 1,
) -
attribute = ObjectManager::Attribute.get(
object: ‘Ticket’,
name: ‘state_id’,
)
attribute.data_option[:filter] = Ticket::State.by_category(:viewable).pluck(:id)
attribute.screens[:create_middle][‘ticket.agent’][:filter] = Ticket::State.by_category(:viewable_agent_new).pluck(:id)
attribute.screens[:create_middle][‘ticket.customer’][:filter] = Ticket::State.by_category(:viewable_customer_new).pluck(:id)
attribute.screens[:edit][‘ticket.agent’][:filter] = Ticket::State.by_category(:viewable_agent_edit).pluck(:id)
attribute.screens[:edit][‘ticket.customer’][:filter] = Ticket::State.by_category(:viewable_customer_edit).pluck(:id)
attribute.save! -
The ticketing UI, new States “resolved” should appear in the selection list.
Actual behavior:
When run the rails command to add new state:
Ticket::State.create_or_update(
name: ‘resolved’,
state_type: Ticket::StateType.find_by(name: ‘resolved’),
ignore_escalation: true,
active:true,
created_by_id: 1,
updated_by_id: 1,
)
ERROR: NotNullViolation on “state_type_id”