Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

Issue in writing a plugin to do ticket auto assignment

Hi team,

We were building a plugin for OsTicket for doing auto assignment. We create a signal::connect on ticket model created and when we call $ticket->assignToStaff its throwing the below error:

"PHP message: PHP Fatal error:  Call to a member function addNote() on null in /var/www/html/osticket/include/class.ticket.php on line 2635"

It works fine when we write the logic in class.ticket.php. What could be the reason? Any fix can be done to do this? 

plugin.php : 

require_once(INCLUDE_DIR .'class.signal.php');
function bootstrap() {
Signal::connect('model.created', array($this, 'doAutoAssign'), 'Ticket');
}

function doAutoAssign($ticket) {
$ticket->assignToStaff(<staffid>, "SYSTEM (Random assignment)", $alert=true);
}

Tagged:

Comments

Sign In or Register to comment.