Your request (Ticket##{ticket.number}) has been received and will be reviewed by our support staff.
To provide additional information, please reply to this email or click on the following link: #{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id}
Zammad, your customer support system
', 'recipient' => 'ticket_customer', 'subject' => 'Thanks for your inquiry (#{ticket.title})', }, }, disable_notification: true, active: true, created_by_id: 1, updated_by_id: 1, ) trigger2 = Trigger.create_or_update( name: 'auto reply (on follow up of tickets)', condition: { 'ticket.action' => { 'operator' => 'is', 'value' => 'update', }, 'article.sender_id' => { 'operator' => 'is', 'value' => Ticket::Article::Sender.lookup(name: 'Customer').id, }, 'article.type_id' => { 'operator' => 'is', 'value' => [ Ticket::Article::Type.lookup(name: 'email').id, Ticket::Article::Type.lookup(name: 'phone').id, Ticket::Article::Type.lookup(name: 'web').id, ], }, }, perform: { 'notification.email' => { 'body' => 'Your follow up for (#{config.ticket_hook}##{ticket.number}) has been received and will be reviewed by our support staff.
To provide additional information, please reply to this email or click on the following link: #{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id}
Zammad, your customer support system
', 'recipient' => 'ticket_customer', 'subject' => 'Thanks for your follow up (#{ticket.title})', }, }, active: true, created_by_id: 1, updated_by_id: 1, ) trigger3 = Trigger.create_or_update( name: 'not matching', condition: { 'ticket.action' => { 'operator' => 'is', 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is', 'value' => Ticket::State.lookup(name: 'closed').id.to_s, } }, perform: { 'notification.email' => { 'body' => '2some textThe owner of ticket (Ticket##{ticket.number}) has changed.
To provide additional information, please reply to this email or click on the following link: #{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id}
Zammad, your customer support system
', 'recipient' => 'ticket_customer', 'subject' => 'Owner has changed (#{ticket.title})', }, }, disable_notification: true, active: true, created_by_id: 1, updated_by_id: 1, ) # process mail without Precedence header content = IO.binread('test/fixtures/ticket_trigger/mail1.box') ticket_p, article_p, user_p, mail = Channel::EmailParser.new.process({}, content) assert_equal('aaäöüßad asd', ticket_p.title) assert_equal('Users', ticket_p.group.name) assert_equal('new', ticket_p.state.name) assert_equal(1, ticket_p.articles.count) article_p = ticket_p.articles.last Observer::Transaction.commit ticket_p.owner = agent1 ticket_p.save! Observer::Transaction.commit assert_equal('aaäöüßad asd', ticket_p.title, 'ticket_p.title verify') assert_equal('Users', ticket_p.group.name, 'ticket_p.group verify') assert_equal('new', ticket_p.state.name, 'ticket_p.state verify') assert_equal('2 normal', ticket_p.priority.name, 'ticket_p.priority verify') assert_equal(2, ticket_p.articles.count, 'ticket_p.articles verify') #p ticket_p.articles.last.inspect article_p = ticket_p.articles.last assert_match('Owner has changed', article_p.subject) assert_match('ZammadThe owner of ticket (Ticket##{ticket.number}) has changed.
To provide additional information, please reply to this email or click on the following link: #{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id}
Zammad, your customer support system
', 'recipient' => 'ticket_customer', 'subject' => 'Owner has changed (#{ticket.title})', }, }, disable_notification: true, active: true, created_by_id: 1, updated_by_id: 1, ) # process mail without Precedence header content = IO.binread('test/fixtures/ticket_trigger/mail1.box') ticket_p, article_p, user_p, mail = Channel::EmailParser.new.process({}, content) assert_equal('aaäöüßad asd', ticket_p.title) assert_equal('Users', ticket_p.group.name) assert_equal('new', ticket_p.state.name) assert_equal(1, ticket_p.articles.count) article_p = ticket_p.articles.last Observer::Transaction.commit assert_equal(1, ticket_p.articles.count) ticket_p.priority = Ticket::Priority.lookup(name: '1 low') ticket_p.save! Observer::Transaction.commit assert_equal(1, ticket_p.articles.count) ticket_p.priority = Ticket::Priority.lookup(name: '3 high') ticket_p.save! Observer::Transaction.commit assert_equal(1, ticket_p.articles.count) ticket_p.owner = agent1 ticket_p.save! Observer::Transaction.commit assert_equal('aaäöüßad asd', ticket_p.title, 'ticket_p.title verify') assert_equal('Users', ticket_p.group.name, 'ticket_p.group verify') assert_equal('new', ticket_p.state.name, 'ticket_p.state verify') assert_equal('3 high', ticket_p.priority.name, 'ticket_p.priority verify') assert_equal(2, ticket_p.articles.count, 'ticket_p.articles verify') #p ticket_p.articles.last.inspect article_p = ticket_p.articles.last assert_match('Owner has changed', article_p.subject) assert_match('ZammadThe owner of ticket (Ticket##{ticket.number}) has changed.
To provide additional information, please reply to this email or click on the following link: #{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id}
Zammad, your customer support system
', 'recipient' => 'ticket_customer', 'subject' => 'Owner has changed (#{ticket.title})', }, }, disable_notification: true, active: true, created_by_id: 1, updated_by_id: 1, ) # process mail without Precedence header content = IO.binread('test/fixtures/ticket_trigger/mail1.box') ticket_p, article_p, user_p, mail = Channel::EmailParser.new.process({}, content) assert_equal('aaäöüßad asd', ticket_p.title) assert_equal('Users', ticket_p.group.name) assert_equal('new', ticket_p.state.name) assert_equal(1, ticket_p.articles.count) article_p = ticket_p.articles.last Observer::Transaction.commit assert_equal(1, ticket_p.articles.count) ticket_p.priority = Ticket::Priority.lookup(name: '1 low') ticket_p.save! Observer::Transaction.commit assert_equal(1, ticket_p.articles.count) ticket_p.priority = Ticket::Priority.lookup(name: '3 high') ticket_p.save! Observer::Transaction.commit assert_equal(1, ticket_p.articles.count) ticket_p.owner = agent1 ticket_p.save! Observer::Transaction.commit assert_equal('aaäöüßad asd', ticket_p.title, 'ticket_p.title verify') assert_equal('Users', ticket_p.group.name, 'ticket_p.group verify') assert_equal('new', ticket_p.state.name, 'ticket_p.state verify') assert_equal('3 high', ticket_p.priority.name, 'ticket_p.priority verify') assert_equal(2, ticket_p.articles.count, 'ticket_p.articles verify') #p ticket_p.articles.last.inspect article_p = ticket_p.articles.last assert_match('Owner has changed', article_p.subject) assert_match('ZammadThe owner of ticket (Ticket##{ticket.number}) has changed.
To provide additional information, please reply to this email or click on the following link: #{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id}
Zammad, your customer support system
', 'recipient' => 'ticket_customer', 'subject' => 'Owner has changed (#{ticket.title})', }, }, disable_notification: true, active: true, created_by_id: 1, updated_by_id: 1, ) # process mail without Precedence header content = IO.binread('test/fixtures/ticket_trigger/mail1.box') ticket_p, article_p, user_p, mail = Channel::EmailParser.new.process({}, content) assert_equal(1, ticket_p.articles.count) Observer::Transaction.commit assert_equal(1, ticket_p.articles.count) ticket_p.owner = agent1 ticket_p.save! Observer::Transaction.commit assert_equal(1, ticket_p.articles.count) end test '5 notify owner' do trigger1 = Trigger.create_or_update( name: 'aaa notify mail', condition: { 'ticket.state_id' => { 'operator' => 'is', 'value' => Ticket::State.all.pluck(:id), }, 'ticket.action' => { 'operator' => 'is', 'value' => 'update', }, }, perform: { 'notification.email' => { 'body' => 'some lala', 'recipient' => 'ticket_owner', 'subject' => 'CC NOTE (#{ticket.title})!', }, }, disable_notification: true, active: true, created_by_id: 1, updated_by_id: 1, ) groups = Group.where(name: 'Users') roles = Role.where(name: 'Agent') agent = User.create_or_update( login: 'agent@example.com', firstname: 'Trigger', lastname: 'Agent1', email: 'agent@example.com', password: 'agentpw', active: true, roles: roles, groups: groups, updated_by_id: 1, created_by_id: 1, ) ticket1 = Ticket.create!( title: 'test 123', owner: agent, group: Group.lookup(name: 'Users'), customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( ticket_id: ticket1.id, from: 'some_sender@example.com', to: 'some_recipient@example.com', subject: 'some subject', message_id: 'some@id', body: "some message note\nnew line", internal: false, sender: Ticket::Article::Sender.find_by(name: 'Agent'), type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) assert_equal('test 123', ticket1.title, 'ticket1.title verify') assert_equal('Users', ticket1.group.name, 'ticket1.group verify') assert_equal('new', ticket1.state.name, 'ticket1.state verify') assert_equal('2 normal', ticket1.priority.name, 'ticket1.priority verify') assert_equal(1, ticket1.articles.count, 'ticket1.articles verify') assert_equal([], ticket1.tag_list) Observer::Transaction.commit assert_equal(1, ticket1.articles.count) Ticket::Article.create!( ticket_id: ticket1.id, from: 'some_sender@example.com', to: 'some_recipient@example.com', subject: 'update', message_id: 'some@id', content_type: 'text/html', body: 'update', internal: false, sender: Ticket::Article::Sender.find_by(name: 'Agent'), type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) Observer::Transaction.commit assert_equal(3, ticket1.articles.count) trigger1 = Trigger.create_or_update( name: 'aaa notify mail 2', condition: { 'ticket.state_id' => { 'operator' => 'is', 'value' => Ticket::State.all.pluck(:id), }, 'ticket.action' => { 'operator' => 'is', 'value' => 'update', }, }, perform: { 'notification.email' => { 'body' => 'some lala', 'recipient' => 'ticket_owner', 'subject' => 'CC NOTE (#{ticket.title})!', }, }, disable_notification: true, active: true, created_by_id: 1, updated_by_id: 1, ) Ticket::Article.create!( ticket_id: ticket1.id, from: 'some_sender@example.com', to: 'some_recipient@example.com', subject: 'update', message_id: 'some@id', content_type: 'text/html', body: 'update', internal: false, sender: Ticket::Article::Sender.find_by(name: 'Agent'), type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) Observer::Transaction.commit assert_equal(6, ticket1.articles.count) end test '6 owner auto assignment' do trigger1 = Trigger.create_or_update( name: 'aaa auto assignment', condition: { 'ticket.owner_id' => { 'operator' => 'is', 'pre_condition' => 'not_set', 'value' => '', 'value_completion' => '', }, 'ticket.action' => { 'operator' => 'is', 'value' => 'update', }, }, perform: { 'ticket.owner_id' => { 'pre_condition' => 'current_user.id', 'value' => '', 'value_completion' => '', }, }, disable_notification: true, active: true, created_by_id: 1, updated_by_id: 1, ) groups = Group.where(name: 'Users') roles = Role.where(name: 'Agent') agent = User.create_or_update( login: 'agent@example.com', firstname: 'Trigger', lastname: 'Agent1', email: 'agent@example.com', password: 'agentpw', active: true, roles: roles, groups: groups, updated_by_id: 1, created_by_id: 1, ) ticket1 = Ticket.create!( title: 'test 123', #owner: agent, group: Group.lookup(name: 'Users'), customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( ticket_id: ticket1.id, from: 'some_sender@example.com', to: 'some_recipient@example.com', subject: 'some subject', message_id: 'some@id', body: "some message note\nnew line", internal: false, sender: Ticket::Article::Sender.find_by(name: 'Agent'), type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) Observer::Transaction.commit assert_equal('test 123', ticket1.title, 'ticket1.title verify') assert_equal('Users', ticket1.group.name, 'ticket1.group verify') assert_equal(1, ticket1.owner_id, 'ticket1.owner_id verify') assert_equal('new', ticket1.state.name, 'ticket1.state verify') assert_equal('2 normal', ticket1.priority.name, 'ticket1.priority verify') assert_equal(1, ticket1.articles.count, 'ticket1.articles verify') assert_equal([], ticket1.tag_list) UserInfo.current_user_id = agent.id Ticket::Article.create!( ticket_id: ticket1.id, from: 'some_sender@example.com', to: 'some_recipient@example.com', subject: 'update', message_id: 'some@id', content_type: 'text/html', body: 'update', internal: false, sender: Ticket::Article::Sender.find_by(name: 'Agent'), type: Ticket::Article::Type.find_by(name: 'note'), ) Observer::Transaction.commit UserInfo.current_user_id = nil ticket1.reload assert_equal('test 123', ticket1.title, 'ticket1.title verify') assert_equal('Users', ticket1.group.name, 'ticket1.group verify') assert_equal(agent.id, ticket1.owner_id, 'ticket1.owner_id verify') assert_equal('new', ticket1.state.name, 'ticket1.state verify') assert_equal('2 normal', ticket1.priority.name, 'ticket1.priority verify') assert_equal(2, ticket1.articles.count, 'ticket1.articles verify') assert_equal([], ticket1.tag_list) UserInfo.current_user_id = agent.id ticket1.owner_id = 1 ticket1.save! Observer::Transaction.commit UserInfo.current_user_id = nil assert_equal('test 123', ticket1.title, 'ticket1.title verify') assert_equal('Users', ticket1.group.name, 'ticket1.group verify') assert_equal(1, ticket1.owner_id, 'ticket1.owner_id verify') assert_equal('new', ticket1.state.name, 'ticket1.state verify') assert_equal('2 normal', ticket1.priority.name, 'ticket1.priority verify') assert_equal(2, ticket1.articles.count, 'ticket1.articles verify') assert_equal([], ticket1.tag_list) end test '6.1 owner auto assignment based on organization' do trigger1 = Trigger.create_or_update( name: 'aaa auto assignment', condition: { 'ticket.organization_id' => { 'operator' => 'is not', 'pre_condition' => 'not_set', 'value' => '', 'value_completion' => '', }, 'ticket.action' => { 'operator' => 'is', 'value' => 'update', }, }, perform: { 'ticket.owner_id' => { 'pre_condition' => 'current_user.id', 'value' => '', 'value_completion' => '', }, }, disable_notification: true, active: true, created_by_id: 1, updated_by_id: 1, ) roles = Role.where(name: 'Agent') groups = Group.where(name: 'Users') agent = User.create_or_update( login: 'agent@example.com', firstname: 'Trigger', lastname: 'Agent1', email: 'agent@example.com', password: 'agentpw', active: true, roles: roles, groups: groups, updated_by_id: 1, created_by_id: 1, ) roles = Role.where(name: 'Customer') customer = User.create_or_update( login: 'customer@example.com', firstname: 'Trigger', lastname: 'Customer1', email: 'customer@example.com', password: 'customerpw', vip: true, active: true, roles: roles, updated_by_id: 1, created_by_id: 1, ) ticket1 = Ticket.create!( title: 'test 123', group: Group.lookup(name: 'Users'), customer: customer, updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( ticket_id: ticket1.id, from: 'some_sender@example.com', to: 'some_recipient@example.com', subject: 'some subject', message_id: 'some@id', body: "some message note\nnew line", internal: false, sender: Ticket::Article::Sender.find_by(name: 'Agent'), type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) Observer::Transaction.commit assert_equal('test 123', ticket1.title, 'ticket1.title verify') assert_equal('Users', ticket1.group.name, 'ticket1.group verify') assert_equal(1, ticket1.owner_id, 'ticket1.owner_id verify') assert_equal('new', ticket1.state.name, 'ticket1.state verify') assert_equal('2 normal', ticket1.priority.name, 'ticket1.priority verify') assert_equal(1, ticket1.articles.count, 'ticket1.articles verify') assert_equal([], ticket1.tag_list) ticket1.update!(customer: User.lookup(email: 'nicole.braun@zammad.org') ) UserInfo.current_user_id = agent.id Ticket::Article.create!( ticket_id: ticket1.id, from: 'some_sender@example.com', to: 'some_recipient@example.com', subject: 'update', message_id: 'some@id', content_type: 'text/html', body: 'update', internal: false, sender: Ticket::Article::Sender.find_by(name: 'Agent'), type: Ticket::Article::Type.find_by(name: 'note'), ) Observer::Transaction.commit UserInfo.current_user_id = nil ticket1.reload assert_equal('test 123', ticket1.title, 'ticket1.title verify') assert_equal('Users', ticket1.group.name, 'ticket1.group verify') assert_equal(agent.id, ticket1.owner_id, 'ticket1.owner_id verify') assert_equal('new', ticket1.state.name, 'ticket1.state verify') assert_equal('2 normal', ticket1.priority.name, 'ticket1.priority verify') assert_equal(2, ticket1.articles.count, 'ticket1.articles verify') assert_equal([], ticket1.tag_list) end test '6.2 owner auto assignment based on organization' do trigger1 = Trigger.create_or_update( name: 'aaa auto assignment', condition: { 'ticket.organization_id' => { 'operator' => 'is', 'pre_condition' => 'not_set', 'value' => '', 'value_completion' => '', }, 'ticket.action' => { 'operator' => 'is', 'value' => 'update', }, }, perform: { 'ticket.owner_id' => { 'pre_condition' => 'current_user.id', 'value' => '', 'value_completion' => '', }, }, disable_notification: true, active: true, created_by_id: 1, updated_by_id: 1, ) groups = Group.where(name: 'Users') roles = Role.where(name: 'Agent') agent = User.create_or_update( login: 'agent@example.com', firstname: 'Trigger', lastname: 'Agent1', email: 'agent@example.com', password: 'agentpw', active: true, roles: roles, groups: groups, updated_by_id: 1, created_by_id: 1, ) roles = Role.where(name: 'Customer') customer = User.create_or_update( login: 'customer@example.com', firstname: 'Trigger', lastname: 'Customer1', email: 'customer@example.com', password: 'customerpw', vip: true, active: true, roles: roles, updated_by_id: 1, created_by_id: 1, ) ticket1 = Ticket.create!( title: 'test 123', group: Group.lookup(name: 'Users'), customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( ticket_id: ticket1.id, from: 'some_sender@example.com', to: 'some_recipient@example.com', subject: 'some subject', message_id: 'some@id', body: "some message note\nnew line", internal: false, sender: Ticket::Article::Sender.find_by(name: 'Agent'), type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) Observer::Transaction.commit assert_equal('test 123', ticket1.title, 'ticket1.title verify') assert_equal('Users', ticket1.group.name, 'ticket1.group verify') assert_equal(1, ticket1.owner_id, 'ticket1.owner_id verify') assert_equal('new', ticket1.state.name, 'ticket1.state verify') assert_equal('2 normal', ticket1.priority.name, 'ticket1.priority verify') assert_equal(1, ticket1.articles.count, 'ticket1.articles verify') assert_equal([], ticket1.tag_list) ticket1.update!(customer: customer ) UserInfo.current_user_id = agent.id Ticket::Article.create!( ticket_id: ticket1.id, from: 'some_sender@example.com', to: 'some_recipient@example.com', subject: 'update', message_id: 'some@id', content_type: 'text/html', body: 'update', internal: false, sender: Ticket::Article::Sender.find_by(name: 'Agent'), type: Ticket::Article::Type.find_by(name: 'note'), ) Observer::Transaction.commit UserInfo.current_user_id = nil ticket1.reload assert_equal('test 123', ticket1.title, 'ticket1.title verify') assert_equal('Users', ticket1.group.name, 'ticket1.group verify') assert_equal(agent.id, ticket1.owner_id, 'ticket1.owner_id verify') assert_equal('new', ticket1.state.name, 'ticket1.state verify') assert_equal('2 normal', ticket1.priority.name, 'ticket1.priority verify') assert_equal(2, ticket1.articles.count, 'ticket1.articles verify') assert_equal([], ticket1.tag_list) end test '7 owner auto assignment' do trigger1 = Trigger.create_or_update( name: 'aaa auto assignment', condition: { 'ticket.owner_id' => { 'operator' => 'is', 'pre_condition' => 'not_set', 'value' => '', 'value_completion' => '', }, 'article.type_id' => { 'operator' => 'is', 'value' => Ticket::Article::Type.find_by(name: 'note'), }, 'article.sender_id' => { 'operator' => 'is', 'value' => Ticket::Article::Sender.find_by(name: 'Agent'), }, }, perform: { 'ticket.owner_id' => { 'pre_condition' => 'current_user.id', 'value' => '', 'value_completion' => '', }, }, disable_notification: true, active: true, created_by_id: 1, updated_by_id: 1, ) groups = Group.where(name: 'Users') roles = Role.where(name: 'Agent') agent1 = User.create_or_update( login: 'agent@example.com', firstname: 'Trigger', lastname: 'Agent1', email: 'agent@example.com', password: 'agentpw', active: true, roles: roles, groups: groups, updated_by_id: 1, created_by_id: 1, ) agent2 = User.create_or_update( login: 'agent@example.com', firstname: 'Trigger', lastname: 'Agent2', email: 'agent@example.com', password: 'agentpw', active: true, roles: roles, groups: groups, updated_by_id: 1, created_by_id: 1, ) ticket1 = Ticket.create!( title: 'test 123', #owner: agent, group: Group.lookup(name: 'Users'), customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( ticket_id: ticket1.id, from: 'some_sender@example.com', to: 'some_recipient@example.com', subject: 'some subject', message_id: 'some@id', body: "some message note\nnew line", internal: false, sender: Ticket::Article::Sender.find_by(name: 'Agent'), type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) Observer::Transaction.commit assert_equal('test 123', ticket1.title, 'ticket1.title verify') assert_equal('Users', ticket1.group.name, 'ticket1.group verify') assert_equal(1, ticket1.owner_id, 'ticket1.owner_id verify') assert_equal('new', ticket1.state.name, 'ticket1.state verify') assert_equal('2 normal', ticket1.priority.name, 'ticket1.priority verify') assert_equal(1, ticket1.articles.count, 'ticket1.articles verify') assert_equal([], ticket1.tag_list) UserInfo.current_user_id = agent1.id Ticket::Article.create!( ticket_id: ticket1.id, from: 'some_sender@example.com', to: 'some_recipient@example.com', subject: 'update', message_id: 'some@id', content_type: 'text/html', body: 'update', internal: false, sender: Ticket::Article::Sender.find_by(name: 'Agent'), type: Ticket::Article::Type.find_by(name: 'note'), ) Observer::Transaction.commit UserInfo.current_user_id = nil ticket1.reload assert_equal('test 123', ticket1.title, 'ticket1.title verify') assert_equal('Users', ticket1.group.name, 'ticket1.group verify') assert_equal(agent1.id, ticket1.owner_id, 'ticket1.owner_id verify') assert_equal('new', ticket1.state.name, 'ticket1.state verify') assert_equal('2 normal', ticket1.priority.name, 'ticket1.priority verify') assert_equal(2, ticket1.articles.count, 'ticket1.articles verify') assert_equal([], ticket1.tag_list) UserInfo.current_user_id = agent1.id ticket1.owner_id = 1 ticket1.save! Observer::Transaction.commit UserInfo.current_user_id = nil assert_equal('test 123', ticket1.title, 'ticket1.title verify') assert_equal('Users', ticket1.group.name, 'ticket1.group verify') assert_equal(1, ticket1.owner_id, 'ticket1.owner_id verify') assert_equal('new', ticket1.state.name, 'ticket1.state verify') assert_equal('2 normal', ticket1.priority.name, 'ticket1.priority verify') assert_equal(2, ticket1.articles.count, 'ticket1.articles verify') assert_equal([], ticket1.tag_list) UserInfo.current_user_id = agent1.id Ticket::Article.create!( ticket_id: ticket1.id, from: 'some_sender@example.com', to: 'some_recipient@example.com', subject: 'update', message_id: 'some@id', content_type: 'text/html', body: 'update', internal: false, sender: Ticket::Article::Sender.find_by(name: 'Customer'), type: Ticket::Article::Type.find_by(name: 'note'), ) Observer::Transaction.commit UserInfo.current_user_id = nil ticket1.reload assert_equal('test 123', ticket1.title, 'ticket1.title verify') assert_equal('Users', ticket1.group.name, 'ticket1.group verify') assert_equal(1, ticket1.owner_id, 'ticket1.owner_id verify') assert_equal('new', ticket1.state.name, 'ticket1.state verify') assert_equal('2 normal', ticket1.priority.name, 'ticket1.priority verify') assert_equal(3, ticket1.articles.count, 'ticket1.articles verify') assert_equal([], ticket1.tag_list) UserInfo.current_user_id = agent2.id ticket1.owner_id = agent2.id ticket1.save! Observer::Transaction.commit UserInfo.current_user_id = nil assert_equal('test 123', ticket1.title, 'ticket1.title verify') assert_equal('Users', ticket1.group.name, 'ticket1.group verify') assert_equal(agent2.id, ticket1.owner_id, 'ticket1.owner_id verify') assert_equal('new', ticket1.state.name, 'ticket1.state verify') assert_equal('2 normal', ticket1.priority.name, 'ticket1.priority verify') assert_equal(3, ticket1.articles.count, 'ticket1.articles verify') assert_equal([], ticket1.tag_list) UserInfo.current_user_id = agent1.id Ticket::Article.create!( ticket_id: ticket1.id, from: 'some_sender@example.com', to: 'some_recipient@example.com', subject: 'update', message_id: 'some@id', content_type: 'text/html', body: 'update', internal: false, sender: Ticket::Article::Sender.find_by(name: 'Agent'), type: Ticket::Article::Type.find_by(name: 'note'), ) Observer::Transaction.commit UserInfo.current_user_id = nil ticket1.reload assert_equal('test 123', ticket1.title, 'ticket1.title verify') assert_equal('Users', ticket1.group.name, 'ticket1.group verify') assert_equal(agent1.id, ticket1.owner_id, 'ticket1.owner_id verify') assert_equal('new', ticket1.state.name, 'ticket1.state verify') assert_equal('2 normal', ticket1.priority.name, 'ticket1.priority verify') assert_equal(4, ticket1.articles.count, 'ticket1.articles verify') assert_equal([], ticket1.tag_list) end test '8 owner auto assignment' do trigger1 = Trigger.create_or_update( name: 'aaa auto assignment', condition: { 'ticket.owner_id' => { 'operator' => 'is', 'pre_condition' => 'not_set', 'value' => '', 'value_completion' => '', }, 'ticket.priority_id' => { 'operator' => 'has changed', 'pre_condition' => '', 'value' => '2', 'value_completion' => '', }, 'ticket.action' => { 'operator' => 'is', 'value' => 'update', }, }, perform: { 'ticket.owner_id' => { 'pre_condition' => 'current_user.id', 'value' => '', 'value_completion' => '', }, }, disable_notification: true, active: true, created_by_id: 1, updated_by_id: 1, ) groups = Group.where(name: 'Users') roles = Role.where(name: 'Agent') agent = User.create_or_update( login: 'agent@example.com', firstname: 'Trigger', lastname: 'Agent1', email: 'agent@example.com', password: 'agentpw', active: true, roles: roles, groups: groups, updated_by_id: 1, created_by_id: 1, ) ticket1 = Ticket.create!( title: 'test 123', #owner: agent, group: Group.lookup(name: 'Users'), customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( ticket_id: ticket1.id, from: 'some_sender@example.com', to: 'some_recipient@example.com', subject: 'some subject', message_id: 'some@id', body: "some message note\nnew line", internal: false, sender: Ticket::Article::Sender.find_by(name: 'Agent'), type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) Observer::Transaction.commit assert_equal('test 123', ticket1.title, 'ticket1.title verify') assert_equal('Users', ticket1.group.name, 'ticket1.group verify') assert_equal(1, ticket1.owner_id, 'ticket1.owner_id verify') assert_equal('new', ticket1.state.name, 'ticket1.state verify') assert_equal('2 normal', ticket1.priority.name, 'ticket1.priority verify') assert_equal(1, ticket1.articles.count, 'ticket1.articles verify') assert_equal([], ticket1.tag_list) UserInfo.current_user_id = agent.id Ticket::Article.create!( ticket_id: ticket1.id, from: 'some_sender@example.com', to: 'some_recipient@example.com', subject: 'update', message_id: 'some@id', content_type: 'text/html', body: 'update', internal: false, sender: Ticket::Article::Sender.find_by(name: 'Agent'), type: Ticket::Article::Type.find_by(name: 'note'), ) Observer::Transaction.commit UserInfo.current_user_id = nil ticket1.reload assert_equal('test 123', ticket1.title, 'ticket1.title verify') assert_equal('Users', ticket1.group.name, 'ticket1.group verify') assert_equal(1, ticket1.owner_id, 'ticket1.owner_id verify') assert_equal('new', ticket1.state.name, 'ticket1.state verify') assert_equal('2 normal', ticket1.priority.name, 'ticket1.priority verify') assert_equal(2, ticket1.articles.count, 'ticket1.articles verify') assert_equal([], ticket1.tag_list) UserInfo.current_user_id = agent.id ticket1.priority = Ticket::Priority.find_by(name: '1 low') ticket1.save! Observer::Transaction.commit UserInfo.current_user_id = nil ticket1.reload assert_equal('test 123', ticket1.title, 'ticket1.title verify') assert_equal('Users', ticket1.group.name, 'ticket1.group verify') assert_equal(agent.id, ticket1.owner_id, 'ticket1.owner_id verify') assert_equal('new', ticket1.state.name, 'ticket1.state verify') assert_equal('1 low', ticket1.priority.name, 'ticket1.priority verify') assert_equal(2, ticket1.articles.count, 'ticket1.articles verify') assert_equal([], ticket1.tag_list) UserInfo.current_user_id = agent.id ticket1.owner_id = 1 ticket1.save! Observer::Transaction.commit UserInfo.current_user_id = nil ticket1.reload assert_equal('test 123', ticket1.title, 'ticket1.title verify') assert_equal('Users', ticket1.group.name, 'ticket1.group verify') assert_equal(1, ticket1.owner_id, 'ticket1.owner_id verify') assert_equal('new', ticket1.state.name, 'ticket1.state verify') assert_equal('1 low', ticket1.priority.name, 'ticket1.priority verify') assert_equal(2, ticket1.articles.count, 'ticket1.articles verify') assert_equal([], ticket1.tag_list) UserInfo.current_user_id = agent.id ticket1.owner_id = agent.id ticket1.save! Observer::Transaction.commit UserInfo.current_user_id = nil ticket1.reload assert_equal('test 123', ticket1.title, 'ticket1.title verify') assert_equal('Users', ticket1.group.name, 'ticket1.group verify') assert_equal(agent.id, ticket1.owner_id, 'ticket1.owner_id verify') assert_equal('new', ticket1.state.name, 'ticket1.state verify') assert_equal('1 low', ticket1.priority.name, 'ticket1.priority verify') assert_equal(2, ticket1.articles.count, 'ticket1.articles verify') assert_equal([], ticket1.tag_list) end test '9 vip priority set' do trigger1 = Trigger.create_or_update( name: 'aaa vip priority', condition: { 'customer.vip' => { 'operator' => 'is', 'value' => true, }, }, perform: { 'ticket.priority_id' => { 'value' => Ticket::Priority.find_by(name: '3 high').id, }, }, disable_notification: true, active: true, created_by_id: 1, updated_by_id: 1, ) groups = Group.where(name: 'Users') roles = Role.where(name: 'Agent') agent = User.create_or_update( login: 'agent@example.com', firstname: 'Trigger', lastname: 'Agent1', email: 'agent@example.com', password: 'agentpw', active: true, roles: roles, groups: groups, updated_by_id: 1, created_by_id: 1, ) roles = Role.where(name: 'Customer') customer = User.create_or_update( login: 'customer@example.com', firstname: 'Trigger', lastname: 'Customer1', email: 'customer@example.com', password: 'customerpw', vip: true, active: true, roles: roles, updated_by_id: 1, created_by_id: 1, ) ticket1 = Ticket.create!( title: 'test 123', owner: agent, customer: customer, group: Group.lookup(name: 'Users'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( ticket_id: ticket1.id, from: 'some_sender@example.com', to: 'some_recipient@example.com', subject: 'some subject', message_id: 'some@id', body: "some message note\nnew line", internal: false, sender: Ticket::Article::Sender.find_by(name: 'Agent'), type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) assert_equal('test 123', ticket1.title, 'ticket1.title verify') assert_equal('Users', ticket1.group.name, 'ticket1.group verify') assert_equal(agent.id, ticket1.owner_id, 'ticket1.owner_id verify') assert_equal(customer.id, ticket1.customer_id, 'ticket1.customer_id verify') assert_equal('new', ticket1.state.name, 'ticket1.state verify') assert_equal('2 normal', ticket1.priority.name, 'ticket1.priority verify') assert_equal(1, ticket1.articles.count, 'ticket1.articles verify') assert_equal([], ticket1.tag_list) Observer::Transaction.commit ticket1.reload assert_equal('test 123', ticket1.title, 'ticket1.title verify') assert_equal('Users', ticket1.group.name, 'ticket1.group verify') assert_equal(agent.id, ticket1.owner_id, 'ticket1.owner_id verify') assert_equal(customer.id, ticket1.customer_id, 'ticket1.customer_id verify') assert_equal('new', ticket1.state.name, 'ticket1.state verify') assert_equal('3 high', ticket1.priority.name, 'ticket1.priority verify') assert_equal(1, ticket1.articles.count, 'ticket1.articles verify') assert_equal([], ticket1.tag_list) customer.vip = false customer.save! ticket2 = Ticket.create!( title: 'test 123', owner: agent, customer: customer, group: Group.lookup(name: 'Users'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( ticket_id: ticket2.id, from: 'some_sender@example.com', to: 'some_recipient@example.com', subject: 'some subject', message_id: 'some@id', body: "some message note\nnew line", internal: false, sender: Ticket::Article::Sender.find_by(name: 'Agent'), type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) assert_equal('test 123', ticket2.title, 'ticket2.title verify') assert_equal('Users', ticket2.group.name, 'ticket2.group verify') assert_equal(agent.id, ticket2.owner_id, 'ticket2.owner_id verify') assert_equal(customer.id, ticket2.customer_id, 'ticket2.customer_id verify') assert_equal('new', ticket2.state.name, 'ticket2.state verify') assert_equal('2 normal', ticket2.priority.name, 'ticket2.priority verify') assert_equal(1, ticket2.articles.count, 'ticket2.articles verify') assert_equal([], ticket2.tag_list) Observer::Transaction.commit ticket2.reload assert_equal('test 123', ticket2.title, 'ticket2.title verify') assert_equal('Users', ticket2.group.name, 'ticket2.group verify') assert_equal(agent.id, ticket2.owner_id, 'ticket2.owner_id verify') assert_equal(customer.id, ticket2.customer_id, 'ticket2.customer_id verify') assert_equal('new', ticket2.state.name, 'ticket2.state verify') assert_equal('2 normal', ticket2.priority.name, 'ticket2.priority verify') assert_equal(1, ticket2.articles.count, 'ticket2.articles verify') assert_equal([], ticket2.tag_list) end test '10 owner auto assignment notify to customer' do trigger1 = Trigger.create_or_update( name: 'aaa auto assignment', condition: { 'ticket.owner_id' => { 'operator' => 'has changed', 'pre_condition' => '', 'value' => '2', 'value_completion' => '', }, }, perform: { 'notification.email' => { 'body' => 'some lala', 'recipient' => 'ticket_customer', 'subject' => 'NEW OWNER (#{ticket.title})!', }, }, disable_notification: true, active: true, created_by_id: 1, updated_by_id: 1, ) groups = Group.where(name: 'Users') roles = Role.where(name: 'Agent') agent1 = User.create_or_update( login: 'agent1@example.com', firstname: 'Trigger', lastname: 'Agent1', email: 'agent1@example.com', password: 'agentpw', active: true, roles: roles, groups: groups, updated_by_id: 1, created_by_id: 1, ) agent2 = User.create_or_update( login: 'agent2@example.com', firstname: 'Trigger', lastname: 'Agent2', email: 'agent2@example.com', password: 'agentpw', active: true, roles: roles, groups: groups, updated_by_id: 1, created_by_id: 1, ) ticket1 = Ticket.create!( title: 'test 123', group: Group.lookup(name: 'Users'), customer: User.lookup(email: 'nicole.braun@zammad.org'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( ticket_id: ticket1.id, from: 'some_sender@example.com', to: 'some_recipient@example.com', subject: 'some subject', message_id: 'some@id', body: "some message note\nnew line", internal: false, sender: Ticket::Article::Sender.find_by(name: 'Agent'), type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) Observer::Transaction.commit assert_equal('test 123', ticket1.title, 'ticket1.title verify') assert_equal('Users', ticket1.group.name, 'ticket1.group verify') assert_equal(1, ticket1.owner_id, 'ticket1.owner_id verify') assert_equal('new', ticket1.state.name, 'ticket1.state verify') assert_equal('2 normal', ticket1.priority.name, 'ticket1.priority verify') assert_equal(1, ticket1.articles.count, 'ticket1.articles verify') assert_equal([], ticket1.tag_list) UserInfo.current_user_id = agent1.id ticket1.owner_id = agent1.id ticket1.save! Observer::Transaction.commit UserInfo.current_user_id = nil ticket1.reload assert_equal('test 123', ticket1.title, 'ticket1.title verify') assert_equal('Users', ticket1.group.name, 'ticket1.group verify') assert_equal(agent1.id, ticket1.owner_id, 'ticket1.owner_id verify') assert_equal('new', ticket1.state.name, 'ticket1.state verify') assert_equal('2 normal', ticket1.priority.name, 'ticket1.priority verify') assert_equal(2, ticket1.articles.count, 'ticket1.articles verify') assert_equal([], ticket1.tag_list) UserInfo.current_user_id = agent1.id ticket1.owner_id = agent1.id ticket1.save! Observer::Transaction.commit UserInfo.current_user_id = nil ticket1.reload assert_equal('test 123', ticket1.title, 'ticket1.title verify') assert_equal('Users', ticket1.group.name, 'ticket1.group verify') assert_equal(agent1.id, ticket1.owner_id, 'ticket1.owner_id verify') assert_equal('new', ticket1.state.name, 'ticket1.state verify') assert_equal('2 normal', ticket1.priority.name, 'ticket1.priority verify') assert_equal(2, ticket1.articles.count, 'ticket1.articles verify') assert_equal([], ticket1.tag_list) UserInfo.current_user_id = agent1.id ticket1.owner_id = agent2.id ticket1.save! Observer::Transaction.commit UserInfo.current_user_id = nil ticket1.reload assert_equal('test 123', ticket1.title, 'ticket1.title verify') assert_equal('Users', ticket1.group.name, 'ticket1.group verify') assert_equal(agent2.id, ticket1.owner_id, 'ticket1.owner_id verify') assert_equal('new', ticket1.state.name, 'ticket1.state verify') assert_equal('2 normal', ticket1.priority.name, 'ticket1.priority verify') assert_equal(3, ticket1.articles.count, 'ticket1.articles verify') assert_equal([], ticket1.tag_list) end test '11 notify to customer on public note' do trigger1 = Trigger.create_or_update( name: 'aaa notify to customer on public note', condition: { 'article.internal' => { 'operator' => 'is', 'value' => 'false', }, 'article.sender_id' => { 'operator' => 'is', 'value' => Ticket::Article::Sender.lookup(name: 'Agent').id, }, 'article.type_id' => { 'operator' => 'is', 'value' => [ Ticket::Article::Type.lookup(name: 'note').id, ], }, }, perform: { 'notification.email' => { 'body' => 'some lala', 'recipient' => 'ticket_customer', 'subject' => 'UPDATE (#{ticket.title})!', }, }, disable_notification: true, active: true, created_by_id: 1, updated_by_id: 1, ) groups = Group.where(name: 'Users') roles = Role.where(name: 'Agent') agent = User.create_or_update( login: 'agent@example.com', firstname: 'Trigger', lastname: 'Agent1', email: 'agent@example.com', password: 'agentpw', active: true, roles: roles, groups: groups, updated_by_id: 1, created_by_id: 1, ) roles = Role.where(name: 'Customer') customer = User.create_or_update( login: 'customer@example.com', firstname: 'Trigger', lastname: 'Customer1', email: 'customer@example.com', password: 'customerpw', vip: true, active: true, roles: roles, updated_by_id: 1, created_by_id: 1, ) ticket1 = Ticket.create!( title: 'test 123', owner: agent, customer: customer, group: Group.lookup(name: 'Users'), updated_by_id: 1, created_by_id: 1, ) Ticket::Article.create!( ticket_id: ticket1.id, from: 'some_sender@example.com', to: 'some_recipient@example.com', subject: 'some subject', message_id: 'some@id', body: "some message note\nnew line", internal: false, sender: Ticket::Article::Sender.find_by(name: 'Agent'), type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) Observer::Transaction.commit ticket1.reload assert_equal('test 123', ticket1.title, 'ticket1.title verify') assert_equal('Users', ticket1.group.name, 'ticket1.group verify') assert_equal(agent.id, ticket1.owner_id, 'ticket1.owner_id verify') assert_equal(customer.id, ticket1.customer_id, 'ticket1.customer_id verify') assert_equal('new', ticket1.state.name, 'ticket1.state verify') assert_equal('2 normal', ticket1.priority.name, 'ticket1.priority verify') assert_equal(2, ticket1.articles.count, 'ticket1.articles verify') assert_equal([], ticket1.tag_list) Ticket::Article.create!( ticket_id: ticket1.id, from: 'some_sender@example.com', to: 'some_recipient@example.com', subject: 'some subject', message_id: 'some@id', body: "some message note\nnew line", internal: true, sender: Ticket::Article::Sender.find_by(name: 'Agent'), type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) Observer::Transaction.commit ticket1.reload assert_equal('test 123', ticket1.title, 'ticket1.title verify') assert_equal('Users', ticket1.group.name, 'ticket1.group verify') assert_equal(agent.id, ticket1.owner_id, 'ticket1.owner_id verify') assert_equal(customer.id, ticket1.customer_id, 'ticket1.customer_id verify') assert_equal('new', ticket1.state.name, 'ticket1.state verify') assert_equal('2 normal', ticket1.priority.name, 'ticket1.priority verify') assert_equal(3, ticket1.articles.count, 'ticket1.articles verify') assert_equal([], ticket1.tag_list) Ticket::Article.create!( ticket_id: ticket1.id, from: 'some_sender@example.com', to: 'some_recipient@example.com', subject: 'some subject', message_id: 'some@id', body: "some message note\nnew line", internal: false, sender: Ticket::Article::Sender.find_by(name: 'Agent'), type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) Observer::Transaction.commit ticket1.reload assert_equal('test 123', ticket1.title, 'ticket1.title verify') assert_equal('Users', ticket1.group.name, 'ticket1.group verify') assert_equal(agent.id, ticket1.owner_id, 'ticket1.owner_id verify') assert_equal(customer.id, ticket1.customer_id, 'ticket1.customer_id verify') assert_equal('new', ticket1.state.name, 'ticket1.state verify') assert_equal('2 normal', ticket1.priority.name, 'ticket1.priority verify') assert_equal(5, ticket1.articles.count, 'ticket1.articles verify') assert_equal([], ticket1.tag_list) ticket1.priority = Ticket::Priority.find_by(name: '3 high') ticket1.save! article = Ticket::Article.create!( ticket_id: ticket1.id, from: 'some_sender@example.com', to: 'some_recipient@example.com', subject: 'some subject', message_id: 'some@id', body: "some message note\nnew line", internal: true, sender: Ticket::Article::Sender.find_by(name: 'Agent'), type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) Observer::Transaction.commit ticket1.reload assert_equal('test 123', ticket1.title, 'ticket1.title verify') assert_equal('Users', ticket1.group.name, 'ticket1.group verify') assert_equal(agent.id, ticket1.owner_id, 'ticket1.owner_id verify') assert_equal(customer.id, ticket1.customer_id, 'ticket1.customer_id verify') assert_equal('new', ticket1.state.name, 'ticket1.state verify') assert_equal('3 high', ticket1.priority.name, 'ticket1.priority verify') assert_equal(6, ticket1.articles.count, 'ticket1.articles verify') assert_equal([], ticket1.tag_list) article.internal = false article.save! Observer::Transaction.commit ticket1.reload assert_equal('test 123', ticket1.title, 'ticket1.title verify') assert_equal('Users', ticket1.group.name, 'ticket1.group verify') assert_equal(agent.id, ticket1.owner_id, 'ticket1.owner_id verify') assert_equal(customer.id, ticket1.customer_id, 'ticket1.customer_id verify') assert_equal('new', ticket1.state.name, 'ticket1.state verify') assert_equal('3 high', ticket1.priority.name, 'ticket1.priority verify') assert_equal(6, ticket1.articles.count, 'ticket1.articles verify') assert_equal([], ticket1.tag_list) Ticket::Article.create!( ticket_id: ticket1.id, from: 'some_sender@example.com', to: 'some_recipient@example.com', subject: 'some subject', message_id: 'some@id', body: "some message note\nnew line", internal: true, sender: Ticket::Article::Sender.find_by(name: 'Customer'), type: Ticket::Article::Type.find_by(name: 'note'), updated_by_id: 1, created_by_id: 1, ) Observer::Transaction.commit ticket1.reload assert_equal('test 123', ticket1.title, 'ticket1.title verify') assert_equal('Users', ticket1.group.name, 'ticket1.group verify') assert_equal(agent.id, ticket1.owner_id, 'ticket1.owner_id verify') assert_equal(customer.id, ticket1.customer_id, 'ticket1.customer_id verify') assert_equal('new', ticket1.state.name, 'ticket1.state verify') assert_equal('3 high', ticket1.priority.name, 'ticket1.priority verify') assert_equal(7, ticket1.articles.count, 'ticket1.articles verify') assert_equal([], ticket1.tag_list) end test '12 notify on owner change' do trigger1 = Trigger.create_or_update( name: 'aaa notify to customer on public note', condition: { 'ticket.owner_id' => { 'operator' => 'has changed', 'pre_condition' => 'current_user.id', 'value' => '', 'value_completion' => '', } }, perform: { 'notification.email' => { 'body' => 'some lala', 'recipient' => 'ticket_customer', 'subject' => 'UPDATE (#{ticket.title})!', }, }, disable_notification: true, active: true, created_by_id: 1, updated_by_id: 1, ) Trigger.create_or_update( name: 'auto reply (on new tickets)', condition: { 'ticket.action' => { 'operator' => 'is', 'value' => 'create', }, 'ticket.state_id' => { 'operator' => 'is not', 'value' => Ticket::State.lookup(name: 'closed').id, }, 'article.type_id' => { 'operator' => 'is', 'value' => [ Ticket::Article::Type.lookup(name: 'email').id, Ticket::Article::Type.lookup(name: 'phone').id, Ticket::Article::Type.lookup(name: 'web').id, ], }, 'article.sender_id' => { 'operator' => 'is', 'value' => Ticket::Article::Sender.lookup(name: 'Customer').id, }, }, perform: { 'notification.email' => { 'body' => '