You are not logged in.
Pages: 1
Topic closed
Hello guys,
How do I create a ticket via plugin?
I'm trying to create a plugin to automatize ticket creation via asynschronous messaging.
I've been searching for this on the documentation, but no luck yet.
Thanks in advance!
Offline
Hi
To create a ticket via a plugin, create an instance of a Ticket object, then call the method add()
$ticket = new Ticket();
$ticket->add([
'name' => 'my name',
'description' => 'some text',
// add other properties here, depending on your needs
]
A ticket is a rather complex itemtype. Read the method Ticket::prepareInputForAdd() to get more information about the expected keys you may set in the array passed ti the add() method.
You may have a look into the plugin Formcreator. Its job is actually to create tickets from forms designed by an administrator. If you check this plugin, read the file inc/targetticket.class.php metod save().
Last edited by btry (2018-03-12 23:23:43)
No support with MP - Always run an upgrade task on a testing instance before running it on production! Always backup before any upgrade task!
Offline
Thanks!
It helped me a lot!
Offline
Pages: 1
Topic closed