Following on from my previous thread about getting some kind of SLA system for support tickets and with help from Aldryic we've come up with this suitable workaround.
It's a simple hook that runs when a ticket is created so no need to hand out special links to hidden support departments or relying on escalation rules etc. I think this is a cleaner, more simple way of doing things especially from the customers point of view! This is based on client groups ("SLA Customer" for example) and a separate support department for SLA based tickets.
The script I'm using is somewhat modified to take in to account our own customisations for certain customers and integrates with Clickatell and other bits so I've stripped all of that out to leave the basic hook.
function SLATicket($vars) {
$adm = 'ADMINID';
$vals['clientid'] = $vars['userid'];
$vals['stats'] = true;
$cmd = 'getclientsdetails';
$client = localAPI($cmd, $vals, $adm);
if ($client[client]['groupid'] == GROUPID) {
localAPI('updateticket', array('ticketid' => $vars['ticketid'], 'deptid' => DEPTID), $adm);
}
}
add_hook("TicketOpen",1,"SLATicket");
?>
There are a few bits you need to change:
When a customer creates a new support ticket, in any department, the hook is run ('TicketOpen'). The hook checks to see if the customer opening the ticket belongs to the SLA customers group ('groupid') and if so, updates the ticket and places it in the SLA Customers support department ('deptid')
It's clean, simple and a lot less clumsy than other options out there. You can then use the email address associated with that support department to pipe data in to your other scripts. In our case, it's passed to a forwarder and an in-house script that sends out SMS alerts and the like.
It's a simple hook that runs when a ticket is created so no need to hand out special links to hidden support departments or relying on escalation rules etc. I think this is a cleaner, more simple way of doing things especially from the customers point of view! This is based on client groups ("SLA Customer" for example) and a separate support department for SLA based tickets.
The script I'm using is somewhat modified to take in to account our own customisations for certain customers and integrates with Clickatell and other bits so I've stripped all of that out to leave the basic hook.
- Create a new client group and assign it to your SLA customers.
- Create a new support department for SLA tickets, mark it as hidden so your normal customers can't access it.
- Create the hook code and place it in to /path/to/whmcs/includes/hooks/
function SLATicket($vars) {
$adm = 'ADMINID';
$vals['clientid'] = $vars['userid'];
$vals['stats'] = true;
$cmd = 'getclientsdetails';
$client = localAPI($cmd, $vals, $adm);
if ($client[client]['groupid'] == GROUPID) {
localAPI('updateticket', array('ticketid' => $vars['ticketid'], 'deptid' => DEPTID), $adm);
}
}
add_hook("TicketOpen",1,"SLATicket");
?>
There are a few bits you need to change:
- ADMINID should be changed to an active admin username
- GROUPID should be changed to the ID of the group you created in step 1
- DEPTID should be changed to the ID of the support department you created in step 2
When a customer creates a new support ticket, in any department, the hook is run ('TicketOpen'). The hook checks to see if the customer opening the ticket belongs to the SLA customers group ('groupid') and if so, updates the ticket and places it in the SLA Customers support department ('deptid')
It's clean, simple and a lot less clumsy than other options out there. You can then use the email address associated with that support department to pipe data in to your other scripts. In our case, it's passed to a forwarder and an in-house script that sends out SMS alerts and the like.
Last edited by a moderator: