> ## 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.

# Working with requests in CRMScript

> In CRMScript, how to create and update requests; get ticket info; accept ticket; add message to ticket; reply; priority and escalation; delegate; postpone; split and merge; close; delete

* [Create ticket][1]
* [Get ticket info][9]
* [Add a message][2]
* [Get message info][9]
* [Accept request][8]
* [Reply to customer][6]
* [Delegate a request][5]
* [Priority and escalation][11]
* [Split and merge tickets][10]
* [Samples][4]
* [Request logs][3]

## A word of caution

### Edit message

For obvious reasons, you should not alter the text in a message after the fact.

However, you might need to edit some properties for bookkeeping or compliance. For example:

* Time spent (accumulates)
* Invoicing info
* Access level (internal/external)
* Attachments (removal might be required)

### Delete tickets

<Danger>
  In general, we don't recommend deleting requests. It is usually preferable to add a comment and/or tag and mark it as closed.
</Danger>

Deleting a ticket will also delete all messages and attachments linked to it!

However, you may be required to delete a request to comply with your company's privacy policy. Proceed with caution! Use the same statements as for closing a ticket, just change the status code from 2 to 4.

## Reference

### Status

| Status | Description           |
| ------ | --------------------- |
| 0      | Unknown/uninitialized |
| 1      | Active                |
| 2      | Closed                |
| 3      | Postponed             |
| 4      | Deleted               |
| 5      | Merged/Linked         |

### Timestamp values - ticket

| Parameter      | Db field         | Description                                             |
| :------------- | :--------------- | :------------------------------------------------------ |
| activate       | activate         | When to activate a postponed ticket                     |
| createdAt      | created\_at      | When the ticket was created                             |
| repliedAt      | replied\_at      | When the 1st external message was added                 |
| stopEscalation | stop\_escalation |                                                         |
| readStatus     | read\_status     | Has the owner has read the ticket? (red, yellow, green) |
| deadline       | deadline         | The deadline of the ticket                              |
| timeToClose    | time\_to\_close  | Minutes between create and close                        |

For a complete list of fields, see the [database reference][16].

### Timestamp values - message

| Parameter  | Db field     | Description                             |
| :--------- | :----------- | :-------------------------------------- |
| createdAt  | created\_at  | When the message was posted             |
| timeSpent  | time\_spent  | Minutes used on this message            |
| timeCharge | time\_charge | Minutes to be invoiced for this message |

[1]: ./create

[2]: ./add-message

[3]: ./request-logs

[4]: ./samples

[5]: ./delegate

[6]: ./reply

[8]: ./accept

[9]: ./get-ticket-info

[10]: ./split-merge

[11]: ./escalate

[16]: ../../../../database/tables/ticket


## Related topics

- [Samples](/en/automation/crmscript/howto/request/samples.md)
- [Working with NS classes in CRMScript](/en/automation/crmscript/netserver/ns-classes.md)
- [Delegate request](/en/automation/crmscript/howto/request/delegate.md)
- [Create and update requests](/en/automation/crmscript/howto/request/create.md)
- [Working with follow-ups (appointments) in API](/en/diary/dev/index.md)
- [How to use a reply template in CRMScript](/en/automation/crmscript/howto/request/reply-templates.md)
- [Working with dashboards](/en/api/web-services/howto/dashboard/get-dashboard-rest.md)
