Accept ticket

Accepting or assigning a ticket means to update ownedBy. You might also want to update the status and the last modified timestamps.

Ticket t;
t.load(1);

if (t.getValue("ownedBy") == "1") {
  t.setValue("ownedBy", "7");
  t.setValue("ticketStatus", "1");
  String now = getCurrentDateTime().toString();
  t.setValue("lastChanged", now);
  t.setValue("dbiLastModified", now);
  t.save();
}

Bool notifyEmail(Integer replyTemplateId)

Sends a notification email to the owner of the ticket.

Call notifyEmail() when you create a new ticket, add a new message to a ticket, and similar events.

Pass the ID of a suitable reply template.

Ticket t;
t.setValue("title", "No audio");
t.setValue("ownedBy", "3");
t.save();
t.notifyEmail(8);