2022-02-11 23:40:54 -08:00
import {
INodeProperties ,
} from 'n8n-workflow' ;
export const ticketDescription : INodeProperties [ ] = [
// ----------------------------------
// operations
// ----------------------------------
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
noDataExpression : true ,
displayOptions : {
show : {
resource : [
'ticket' ,
] ,
} ,
} ,
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
} ,
{
name : 'Get All' ,
value : 'getAll' ,
description : 'Retrieve all tickets' ,
2022-07-10 13:50:51 -07:00
action : 'Get all 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 : {
resource : [
'ticket' ,
] ,
operation : [
'create' ,
] ,
} ,
} ,
} ,
{
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-07-14 13:05:11 -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 : {
resource : [
'ticket' ,
] ,
operation : [
'create' ,
] ,
} ,
} ,
} ,
{
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-07-14 13:05:11 -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 : {
resource : [
'ticket' ,
] ,
operation : [
'create' ,
] ,
} ,
} ,
} ,
{
displayName : 'Ticket ID' ,
name : 'id' ,
type : 'string' ,
2022-07-14 13:05:11 -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 : {
resource : [
'ticket' ,
] ,
operation : [
'get' ,
] ,
} ,
} ,
} ,
{
displayName : 'Ticket ID' ,
name : 'id' ,
type : 'string' ,
default : '' ,
2022-07-14 13:05:11 -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 : {
resource : [
'ticket' ,
] ,
operation : [
'delete' ,
] ,
} ,
} ,
} ,
{
displayName : 'Article' ,
name : 'article' ,
type : 'fixedCollection' ,
placeholder : 'Add Article' ,
required : true ,
default : { } ,
displayOptions : {
show : {
resource : [
'ticket' ,
] ,
operation : [
'create' ,
] ,
} ,
} ,
options : [
{
displayName : 'Article Details' ,
name : 'articleDetails' ,
values : [
{
displayName : 'Subject' ,
name : 'subject' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Body' ,
name : 'body' ,
type : 'string' ,
default : '' ,
typeOptions : {
alwaysOpenEditWindow : true ,
} ,
} ,
{
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 : {
resource : [
'ticket' ,
] ,
operation : [
'create' ,
] ,
} ,
} ,
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-07-14 13:05:11 -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 : {
resource : [
'ticket' ,
] ,
operation : [
'getAll' ,
] ,
} ,
} ,
} ,
{
displayName : 'Limit' ,
name : 'limit' ,
type : 'number' ,
default : 50 ,
description : 'Max number of results to return' ,
typeOptions : {
minValue : 1 ,
} ,
displayOptions : {
show : {
resource : [
'ticket' ,
] ,
operation : [
'getAll' ,
] ,
returnAll : [
false ,
] ,
} ,
} ,
} ,
] ;