2023-01-27 03:22:44 -08:00
import type { INodeProperties } from 'n8n-workflow' ;
2022-02-11 23:40:54 -08:00
export const ticketDescription : INodeProperties [ ] = [
// ----------------------------------
// operations
// ----------------------------------
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
noDataExpression : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'ticket' ] ,
2022-02-11 23:40:54 -08:00
} ,
} ,
options : [
{
name : 'Create' ,
value : 'create' ,
description : 'Create a ticket' ,
2022-07-10 13:50:51 -07:00
action : 'Create a ticket' ,
2022-02-11 23:40:54 -08:00
} ,
{
name : 'Delete' ,
value : 'delete' ,
description : 'Delete a ticket' ,
2022-07-10 13:50:51 -07:00
action : 'Delete a ticket' ,
2022-02-11 23:40:54 -08:00
} ,
{
name : 'Get' ,
value : 'get' ,
description : 'Retrieve a ticket' ,
2022-07-10 13:50:51 -07:00
action : 'Get a ticket' ,
2022-02-11 23:40:54 -08:00
} ,
{
2022-09-07 07:51:14 -07:00
name : 'Get Many' ,
2022-02-11 23:40:54 -08:00
value : 'getAll' ,
2022-09-13 03:36:36 -07:00
description : 'Retrieve many tickets' ,
2022-09-08 08:10:13 -07:00
action : 'Get many tickets' ,
2022-02-11 23:40:54 -08:00
} ,
] ,
default : 'create' ,
} ,
// ----------------------------------
// fields
// ----------------------------------
{
displayName : 'Title' ,
name : 'title' ,
type : 'string' ,
description : 'Title of the ticket to create' ,
default : '' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'ticket' ] ,
operation : [ 'create' ] ,
2022-02-11 23:40:54 -08:00
} ,
} ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Group Name or ID' ,
2022-02-11 23:40:54 -08:00
name : 'group' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'loadGroupNames' ,
} ,
placeholder : 'First-Level Helpdesk' ,
2022-08-17 08:50:24 -07:00
description :
'Group that will own the ticket to create. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2022-02-11 23:40:54 -08:00
default : '' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'ticket' ] ,
operation : [ 'create' ] ,
2022-02-11 23:40:54 -08:00
} ,
} ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Customer Email Name or ID' ,
2022-02-11 23:40:54 -08:00
name : 'customer' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'loadCustomerEmails' ,
} ,
2022-08-17 08:50:24 -07:00
description :
'Email address of the customer concerned in the ticket to create. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2022-02-11 23:40:54 -08:00
default : '' ,
placeholder : 'hello@n8n.io' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'ticket' ] ,
operation : [ 'create' ] ,
2022-02-11 23:40:54 -08:00
} ,
} ,
} ,
{
displayName : 'Ticket ID' ,
name : 'id' ,
type : 'string' ,
2022-08-17 08:50:24 -07:00
description :
'Ticket to retrieve. Specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2022-02-11 23:40:54 -08:00
default : '' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'ticket' ] ,
operation : [ 'get' ] ,
2022-02-11 23:40:54 -08:00
} ,
} ,
} ,
{
displayName : 'Ticket ID' ,
name : 'id' ,
type : 'string' ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'Ticket to delete. Specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2022-02-11 23:40:54 -08:00
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'ticket' ] ,
operation : [ 'delete' ] ,
2022-02-11 23:40:54 -08:00
} ,
} ,
} ,
{
displayName : 'Article' ,
name : 'article' ,
type : 'fixedCollection' ,
placeholder : 'Add Article' ,
required : true ,
default : { } ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'ticket' ] ,
operation : [ 'create' ] ,
2022-02-11 23:40:54 -08:00
} ,
} ,
options : [
{
displayName : 'Article Details' ,
name : 'articleDetails' ,
values : [
{
displayName : 'Subject' ,
name : 'subject' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Body' ,
name : 'body' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Visibility' ,
name : 'visibility' ,
type : 'options' ,
default : 'internal' ,
options : [
{
name : 'External' ,
value : 'external' ,
description : 'Visible to customers' ,
} ,
{
name : 'Internal' ,
value : 'internal' ,
description : 'Visible to help desk' ,
} ,
] ,
} ,
{
displayName : 'Article Type' ,
name : 'type' ,
type : 'options' ,
// https://docs.zammad.org/en/latest/api/ticket/articles.html
options : [
{
name : 'Chat' ,
value : 'chat' ,
} ,
{
name : 'Email' ,
value : 'email' ,
} ,
{
name : 'Fax' ,
value : 'fax' ,
} ,
{
name : 'Note' ,
value : 'note' ,
} ,
{
name : 'Phone' ,
value : 'phone' ,
} ,
{
name : 'SMS' ,
value : 'sms' ,
} ,
] ,
default : 'note' ,
} ,
] ,
} ,
] ,
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'ticket' ] ,
operation : [ 'create' ] ,
2022-02-11 23:40:54 -08:00
} ,
} ,
default : { } ,
placeholder : 'Add Field' ,
options : [
{
displayName : 'Custom Fields' ,
name : 'customFieldsUi' ,
type : 'fixedCollection' ,
2022-04-22 09:29:51 -07:00
default : { } ,
2022-02-11 23:40:54 -08:00
placeholder : 'Add Custom Field' ,
typeOptions : {
multipleValues : true ,
} ,
options : [
{
name : 'customFieldPairs' ,
displayName : 'Custom Field' ,
values : [
{
2022-06-03 10:23:49 -07:00
displayName : 'Field Name or ID' ,
2022-02-11 23:40:54 -08:00
name : 'name' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'loadTicketCustomFields' ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'Name of the custom field to set. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2022-02-11 23:40:54 -08:00
} ,
{
displayName : 'Value' ,
name : 'value' ,
type : 'string' ,
default : '' ,
description : 'Value to set on the custom field' ,
} ,
] ,
} ,
] ,
} ,
] ,
} ,
{
displayName : 'Return All' ,
name : 'returnAll' ,
type : 'boolean' ,
default : false ,
description : 'Whether to return all results or only up to a given limit' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'ticket' ] ,
operation : [ 'getAll' ] ,
2022-02-11 23:40:54 -08:00
} ,
} ,
} ,
{
displayName : 'Limit' ,
name : 'limit' ,
type : 'number' ,
default : 50 ,
description : 'Max number of results to return' ,
typeOptions : {
minValue : 1 ,
} ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'ticket' ] ,
operation : [ 'getAll' ] ,
returnAll : [ false ] ,
2022-02-11 23:40:54 -08:00
} ,
} ,
} ,
] ;