Runs before saving a ticket. Use it to validate the form and optionally block the save.
Parameters
| Name |
Type |
Description |
| values |
{Object} |
the input values of ticket form See Values object |
Returns
| Type |
Comment |
| {Boolean} |
– Return true → proceed with save. – Return false → block save; the UI remains on the form. – Throw / return non-boolean → treated as false; log appears in console; use vcc.alert('...') to inform the agent. |
Values object
| Key |
Type |
Description |
| contactId |
{String} |
The selected contact id. Format: (projectId-contactId). |
| customerId |
{String} |
The selected customer id. Format: (projectId-customerId). |
| description |
{String} |
Optional. The description of the ticket. |
| objectFields |
{Array} |
Optional. The custom objectField values of the ticket. See objectFields |
| prefUserId |
{Int} |
Optional. The selected responsible agent’s id. |
| softDeadline |
{String} |
The soft deadline of the ticket (Time). |
| subStatus |
{Int} |
The sub-status id of the ticket. |
| textFields |
{Array} |
Optional. The custom text field values of the ticket. See textFields |
| title |
{String} |
The title of the ticket. |
| type |
{String} |
Optional. The type id of the ticket. Format: (projectId-ticketTypeId) |
textFields
| Key |
Type |
Description |
| name |
{String} |
The name of the field. |
| value |
{String} |
The value of the field. |
objectFields
| Key |
Type |
Description |
| name |
{String} |
The name of the object field. |
| values |
{Array} |
The values of the object field. See objectField values |
objectField values
| Key |
Type |
Description |
| id |
{String} |
The id of the value. Format: (projectId-id). |
| value |
{String} |
The value. |
Example
Allows saving the ticket if the suggestion text field has a value.
$().beforeSaveTicket = function (values) {
const suggestionValue = values.textFields.find((field) => field.name == 'suggestion')
if (suggestionValue?.value?.length == 0) {
vcc.alert('Suggestion is required');
return false;
}
return true;
};
Values object example
{
"contactId": "33-10",
"customerId": "33-1",
"description": "Customer asked for a callback tomorrow.",
"objectFields": [
{
"name": "severity",
"values": [
{
"id": "33-12",
"value": "High"
}
]
}
],
"prefUserId": 43,
"softDeadline": "2026-02-27T09:00:00Z",
"subStatus": 2,
"textFields": [
{
"name": "suggestion",
"value": "Give the customer a clear example."
}
],
"title": "High priority follow-up",
"type": "33-3"
}
Comments
Can’t find what you need? Use the comment section below to connect with others, get answers from our experts, or share your ideas with us.
There are no comments yet.