> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superoffice.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Accept ticket

> How to accept ticket with CRMScript.

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

```crmscript theme={null}
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][4].

```crmscript theme={null}
Ticket t;
t.setValue("title", "No audio");
t.setValue("ownedBy", "3");
t.save();
t.notifyEmail(8);
```

[4]: ./reply-templates


## Related topics

- [Accept Tickets](/en/api/reference/restful/agent/ticket_agent/accept-tickets.md)
- [SuperOffice.WebApi.Data.Ticket AcceptTicketsRequest](/en/api/reference/webapi/SuperOffice.WebApi.Data.Ticket_AcceptTicketsRequest.md)
- [SuperOffice.WebApi.Agents.TicketAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.TicketAgent.md)
- [SuperOffice.WebApi.Agents.ITicketAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.ITicketAgent.md)
- [Tickets](/en/api/reference/restful/rest/person/tickets.md)
