2020-01-21 08:00:40 -08:00
import { INodeProperties } from 'n8n-workflow' ;
2021-12-03 00:44:16 -08:00
export const dealOperations : INodeProperties [ ] = [
2020-01-21 08:00:40 -08:00
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2020-01-21 08:00:40 -08:00
displayOptions : {
show : {
resource : [
'deal' ,
] ,
} ,
} ,
options : [
{
name : 'Create' ,
value : 'create' ,
description : 'Create a deal' ,
2022-07-10 13:50:51 -07:00
action : 'Create a deal' ,
2020-01-21 08:00:40 -08:00
} ,
{
2020-01-22 00:17:29 -08:00
name : 'Delete' ,
value : 'delete' ,
description : 'Delete a deal' ,
2022-07-10 13:50:51 -07:00
action : 'Delete a deal' ,
2020-01-21 08:00:40 -08:00
} ,
{
name : 'Get' ,
value : 'get' ,
description : 'Get a deal' ,
2022-07-10 13:50:51 -07:00
action : 'Get a deal' ,
2020-01-21 08:00:40 -08:00
} ,
{
name : 'Get All' ,
value : 'getAll' ,
2020-07-24 03:56:41 -07:00
description : 'Get all deals' ,
2022-07-10 13:50:51 -07:00
action : 'Get all deals' ,
2020-01-21 08:00:40 -08:00
} ,
{
2020-01-22 00:17:29 -08:00
name : 'Update' ,
value : 'update' ,
description : 'Update a deal' ,
2022-07-10 13:50:51 -07:00
action : 'Update a deal' ,
2020-01-21 08:00:40 -08:00
} ,
] ,
default : 'create' ,
} ,
2021-12-03 00:44:16 -08:00
] ;
2020-01-21 08:00:40 -08:00
2021-12-03 00:44:16 -08:00
export const dealFields : INodeProperties [ ] = [
2020-01-21 08:00:40 -08:00
/* -------------------------------------------------------------------------- */
/* deal:create */
/* -------------------------------------------------------------------------- */
{
displayName : 'Title' ,
name : 'title' ,
type : 'string' ,
default : '' ,
displayOptions : {
show : {
resource : [
'deal' ,
] ,
operation : [
'create' ,
] ,
} ,
} ,
required : true ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Owner Name or ID' ,
2020-01-21 08:00:40 -08:00
name : 'owner' ,
type : 'options' ,
2022-06-20 07:54:01 -07:00
description : 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>' ,
2020-01-21 08:00:40 -08:00
default : '' ,
typeOptions : {
loadOptionsMethod : 'getUsers' ,
} ,
displayOptions : {
show : {
resource : [
'deal' ,
] ,
operation : [
'create' ,
] ,
} ,
} ,
required : true ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Primary Contact Name or ID' ,
2020-01-21 08:00:40 -08:00
name : 'primaryContact' ,
type : 'options' ,
default : '' ,
typeOptions : {
loadOptionsMethod : 'getContacts' ,
} ,
displayOptions : {
show : {
resource : [
'deal' ,
] ,
operation : [
'create' ,
] ,
} ,
} ,
2022-06-03 10:23:49 -07:00
description : 'Primary contact for the deal. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>.' ,
2020-01-21 08:00:40 -08:00
required : true ,
} ,
{
displayName : 'Pipeline' ,
name : 'pipeline' ,
type : 'options' ,
options : [
{
name : 'Sales' ,
value : 'Sales' ,
} ,
] ,
default : '' ,
displayOptions : {
show : {
resource : [
'deal' ,
] ,
operation : [
'create' ,
] ,
} ,
} ,
required : true ,
} ,
{
displayName : 'Status' ,
name : 'status' ,
type : 'options' ,
default : 'Open' ,
options : [
{
name : 'Open' ,
value : 'Open' ,
} ,
{
name : 'Close' ,
value : 'Close' ,
} ,
{
name : 'Lost' ,
value : 'Lost' ,
} ,
] ,
displayOptions : {
show : {
resource : [
'deal' ,
] ,
operation : [
'create' ,
] ,
} ,
} ,
required : true ,
} ,
{
displayName : 'Stage' ,
name : 'stage' ,
type : 'options' ,
default : '' ,
2022-06-03 10:23:49 -07:00
// eslint-disable-next-line n8n-nodes-base/node-param-options-type-unsorted-items
2020-01-21 08:00:40 -08:00
options : [
{
name : 'New (Untouched)' ,
value : 'New (Untouched)' ,
} ,
{
name : 'Contacted' ,
value : 'Contacted' ,
} ,
{
name : 'Qualified' ,
value : 'Qualified' ,
} ,
{
name : 'In Negotiation' ,
value : 'In Negotiation' ,
} ,
2022-06-03 10:23:49 -07:00
{
name : 'Proposal Presented' ,
value : 'Proposal Presented' ,
} ,
2020-01-21 08:00:40 -08:00
] ,
displayOptions : {
show : {
resource : [
'deal' ,
] ,
operation : [
'create' ,
] ,
} ,
} ,
required : true ,
} ,
{
displayName : 'Currency' ,
name : 'currency' ,
type : 'string' ,
default : '' ,
displayOptions : {
show : {
resource : [
'deal' ,
] ,
operation : [
'create' ,
] ,
} ,
} ,
required : true ,
} ,
{
displayName : 'RAW Data' ,
name : 'rawData' ,
type : 'boolean' ,
displayOptions : {
show : {
resource : [
'deal' ,
] ,
operation : [
'create' ,
] ,
} ,
} ,
default : false ,
2022-06-20 07:54:01 -07:00
description : 'Whether the data should include the fields details' ,
2020-01-21 08:00:40 -08:00
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
resource : [
'deal' ,
] ,
operation : [
'create' ,
] ,
} ,
} ,
options : [
{
displayName : 'Description' ,
name : 'description' ,
typeOptions : {
alwaysOpenEditWindow : true ,
} ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'This field contains details related to the deal' ,
2020-01-21 08:00:40 -08:00
} ,
{
displayName : 'Tags' ,
name : 'tags' ,
type : 'string' ,
default : '' ,
description : 'This field contains tags associated with an deal' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Primary Company Name or ID' ,
2020-01-21 08:00:40 -08:00
name : 'primaryCompany' ,
type : 'options' ,
2022-06-20 07:54:01 -07:00
description : 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>' ,
2020-01-21 08:00:40 -08:00
typeOptions : {
loadOptionsMethod : 'getCompanies' ,
} ,
default : '' ,
} ,
{
displayName : 'Source' ,
name : 'source' ,
type : 'options' ,
options : [
{
name : 'Ads' ,
value : 'Ads' ,
} ,
{
name : 'Referrals' ,
value : 'Referrals' ,
} ,
{
name : 'Website' ,
value : 'Website' ,
} ,
{
2022-06-03 10:23:49 -07:00
name : 'Word of Mouth' ,
2020-01-21 08:00:40 -08:00
value : 'Word of mouth' ,
} ,
] ,
default : 'Ads' ,
} ,
{
displayName : 'Estimated Close Date' ,
name : 'estimatedCloseDate' ,
type : 'dateTime' ,
default : '' ,
} ,
{
displayName : 'Deal Value' ,
name : 'dealValue' ,
type : 'number' ,
typeOptions : {
numberPrecision : 2 ,
} ,
default : 0 ,
} ,
{
displayName : 'Priority' ,
name : 'priority' ,
type : 'options' ,
default : 'Medium' ,
options : [
{
name : 'High' ,
value : 'High' ,
} ,
{
name : 'Medium' ,
value : 'Medium' ,
} ,
{
name : 'Low' ,
value : 'Low' ,
} ,
] ,
} ,
] ,
} ,
/* -------------------------------------------------------------------------- */
/* deal:update */
/* -------------------------------------------------------------------------- */
{
displayName : 'Deal ID' ,
name : 'id' ,
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
resource : [
'deal' ,
] ,
operation : [
'update' ,
] ,
} ,
} ,
} ,
{
displayName : 'RAW Data' ,
name : 'rawData' ,
type : 'boolean' ,
displayOptions : {
show : {
resource : [
'deal' ,
] ,
operation : [
'update' ,
] ,
} ,
} ,
default : false ,
2022-06-20 07:54:01 -07:00
description : 'Whether the data should include the fields details' ,
2020-01-21 08:00:40 -08:00
} ,
{
displayName : 'Update Fields' ,
name : 'updateFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
resource : [
'deal' ,
] ,
operation : [
'update' ,
] ,
} ,
} ,
options : [
{
displayName : 'Title' ,
name : 'title' ,
type : 'string' ,
default : '' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Owner Name or ID' ,
2020-01-21 08:00:40 -08:00
name : 'owner' ,
type : 'options' ,
2022-06-20 07:54:01 -07:00
description : 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>' ,
2020-01-21 08:00:40 -08:00
default : '' ,
typeOptions : {
loadOptionsMethod : 'getUsers' ,
} ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Primary Contact Name or ID' ,
2020-01-21 08:00:40 -08:00
name : 'primaryContact' ,
type : 'options' ,
2022-06-20 07:54:01 -07:00
description : 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>' ,
2020-01-21 08:00:40 -08:00
default : '' ,
typeOptions : {
loadOptionsMethod : 'getContacts' ,
} ,
} ,
{
displayName : 'Pipeline' ,
name : 'pipeline' ,
type : 'options' ,
options : [
{
name : 'Sales' ,
value : 'Sales' ,
} ,
] ,
default : '' ,
} ,
{
displayName : 'Status' ,
name : 'status' ,
type : 'options' ,
default : 'Open' ,
options : [
{
name : 'Open' ,
value : 'Open' ,
} ,
{
name : 'Close' ,
value : 'Close' ,
} ,
{
name : 'Lost' ,
value : 'Lost' ,
} ,
] ,
} ,
{
displayName : 'Stage' ,
name : 'stage' ,
type : 'options' ,
default : '' ,
options : [
{
name : 'Contacted' ,
value : 'Contacted' ,
} ,
{
2022-06-03 10:23:49 -07:00
name : 'In Negotiation' ,
value : 'In Negotiation' ,
} ,
{
name : 'New (Untouched)' ,
value : 'New (Untouched)' ,
2020-01-21 08:00:40 -08:00
} ,
{
name : 'Proposal Presented' ,
value : 'Proposal Presented' ,
} ,
{
2022-06-03 10:23:49 -07:00
name : 'Qualified' ,
value : 'Qualified' ,
2020-01-21 08:00:40 -08:00
} ,
] ,
} ,
{
displayName : 'Currency' ,
name : 'currency' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Description' ,
name : 'description' ,
typeOptions : {
alwaysOpenEditWindow : true ,
} ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'This field contains details related to the deal' ,
2020-01-21 08:00:40 -08:00
} ,
{
displayName : 'Tags' ,
name : 'tags' ,
type : 'string' ,
default : '' ,
description : 'This field contains tags associated with an deal' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Primary Company Name or ID' ,
2020-01-21 08:00:40 -08:00
name : 'primaryCompany' ,
type : 'options' ,
2022-06-20 07:54:01 -07:00
description : 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>' ,
2020-01-21 08:00:40 -08:00
typeOptions : {
loadOptionsMethod : 'getCompanies' ,
} ,
default : '' ,
} ,
{
displayName : 'Source' ,
name : 'source' ,
type : 'options' ,
options : [
{
name : 'Ads' ,
value : 'Ads' ,
} ,
{
name : 'Referrals' ,
value : 'Referrals' ,
} ,
{
name : 'Website' ,
value : 'Website' ,
} ,
{
2022-06-03 10:23:49 -07:00
name : 'Word of Mouth' ,
2020-01-21 08:00:40 -08:00
value : 'Word of mouth' ,
} ,
] ,
default : 'Ads' ,
} ,
{
displayName : 'Estimated Close Date' ,
name : 'estimatedCloseDate' ,
type : 'dateTime' ,
default : '' ,
} ,
{
displayName : 'Deal Value' ,
name : 'dealValue' ,
type : 'number' ,
typeOptions : {
numberPrecision : 2 ,
} ,
default : 0 ,
} ,
{
displayName : 'Priority' ,
name : 'priority' ,
type : 'options' ,
default : 'Medium' ,
options : [
{
name : 'High' ,
value : 'High' ,
} ,
{
name : 'Medium' ,
value : 'Medium' ,
} ,
{
name : 'Low' ,
value : 'Low' ,
} ,
] ,
} ,
] ,
} ,
/* -------------------------------------------------------------------------- */
/* deal:get */
/* -------------------------------------------------------------------------- */
{
displayName : 'Deal ID' ,
name : 'id' ,
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
resource : [
'deal' ,
] ,
operation : [
'get' ,
] ,
} ,
} ,
} ,
{
displayName : 'RAW Data' ,
name : 'rawData' ,
type : 'boolean' ,
displayOptions : {
show : {
resource : [
'deal' ,
] ,
operation : [
'get' ,
] ,
} ,
} ,
default : false ,
2022-06-20 07:54:01 -07:00
description : 'Whether the data should include the fields details' ,
2020-01-21 08:00:40 -08:00
} ,
/* -------------------------------------------------------------------------- */
/* deal:getAll */
/* -------------------------------------------------------------------------- */
{
displayName : 'Return All' ,
name : 'returnAll' ,
type : 'boolean' ,
displayOptions : {
show : {
resource : [
'deal' ,
] ,
operation : [
'getAll' ,
] ,
} ,
} ,
default : false ,
2022-05-06 14:01:25 -07:00
description : 'Whether to return all results or only up to a given limit' ,
2020-01-21 08:00:40 -08:00
} ,
{
displayName : 'Limit' ,
name : 'limit' ,
type : 'number' ,
displayOptions : {
show : {
resource : [
'deal' ,
] ,
operation : [
'getAll' ,
] ,
returnAll : [
false ,
] ,
} ,
} ,
typeOptions : {
minValue : 1 ,
maxValue : 25 ,
} ,
default : 10 ,
2022-05-06 14:01:25 -07:00
description : 'Max number of results to return' ,
2020-01-21 08:00:40 -08:00
} ,
{
displayName : 'JSON Parameters' ,
name : 'jsonParameters' ,
type : 'boolean' ,
default : false ,
displayOptions : {
show : {
operation : [
'getAll' ,
] ,
resource : [
'deal' ,
] ,
} ,
} ,
} ,
{
displayName : 'Options' ,
name : 'options' ,
type : 'collection' ,
placeholder : 'Add Option' ,
default : { } ,
displayOptions : {
show : {
resource : [
'deal' ,
] ,
operation : [
'getAll' ,
] ,
} ,
} ,
options : [
{
displayName : 'Fields' ,
name : 'fields' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Comma-separated list of fields to return' ,
2020-01-21 08:00:40 -08:00
} ,
{
displayName : 'Sort By' ,
name : 'sortBy' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The field to sort by' ,
2020-01-21 08:00:40 -08:00
} ,
{
displayName : 'Sort Order' ,
name : 'sortOrder' ,
type : 'options' ,
options : [
{
2020-01-22 00:17:29 -08:00
name : 'ASC' ,
2020-01-21 08:00:40 -08:00
value : 'asc' ,
} ,
{
2020-01-22 00:17:29 -08:00
name : 'DESC' ,
2020-01-21 08:00:40 -08:00
value : 'desc' ,
} ,
] ,
default : 'desc' ,
2020-10-22 06:46:03 -07:00
} ,
2020-01-21 08:00:40 -08:00
] ,
} ,
{
displayName : 'Filters' ,
name : 'filtersJson' ,
type : 'json' ,
typeOptions : {
alwaysOpenEditWindow : true ,
} ,
default : '' ,
displayOptions : {
show : {
operation : [
'getAll' ,
] ,
resource : [
'deal' ,
] ,
jsonParameters : [
true ,
] ,
} ,
} ,
} ,
{
displayName : 'Filters' ,
name : 'filters' ,
placeholder : 'Add filter' ,
type : 'fixedCollection' ,
typeOptions : {
multipleValues : false ,
} ,
displayOptions : {
show : {
resource : [
'deal' ,
] ,
operation : [
'getAll' ,
] ,
jsonParameters : [
false ,
] ,
} ,
} ,
default : { } ,
options : [
{
name : 'filtersUi' ,
displayName : 'Filters' ,
values : [
{
displayName : 'Operator' ,
name : 'operator' ,
type : 'options' ,
options : [
{
2020-01-22 00:17:29 -08:00
name : 'AND' ,
2020-01-21 08:00:40 -08:00
value : 'AND' ,
} ,
{
2020-01-22 00:17:29 -08:00
name : 'OR' ,
2020-01-21 08:00:40 -08:00
value : 'OR' ,
} ,
] ,
default : 'AND' ,
} ,
{
displayName : 'Conditions' ,
name : 'conditions' ,
placeholder : 'Add Condition' ,
type : 'fixedCollection' ,
typeOptions : {
multipleValues : true ,
} ,
default : { } ,
options : [
{
name : 'conditionsUi' ,
displayName : 'Conditions' ,
values : [
{
displayName : 'Field' ,
name : 'field' ,
type : 'options' ,
options : [
{
name : 'Title' ,
value : 'title' ,
} ,
{
name : 'Tags' ,
value : 'tags' ,
} ,
{
name : 'Last Communication Mode' ,
value : 'lastCommunicationMode' ,
} ,
] ,
default : 'title' ,
} ,
{
displayName : 'Condition' ,
name : 'condition' ,
type : 'options' ,
2022-06-03 10:23:49 -07:00
// eslint-disable-next-line n8n-nodes-base/node-param-options-type-unsorted-items
2020-01-21 08:00:40 -08:00
options : [
{
name : 'Equals' ,
value : 'EQUALS' ,
} ,
{
name : 'Not Equals' ,
value : 'NOT_EQUALS' ,
} ,
{
name : 'CONTAINS' ,
value : 'Contains' ,
} ,
{
name : 'Does Not Contains' ,
value : 'DOES_NOT_CONTAINS' ,
2022-06-03 10:23:49 -07:00
} ,
{
name : 'Empty' ,
value : 'EMPTY' ,
} ,
{
name : 'Not Empty' ,
value : 'NOT_EMPTY' ,
2020-01-21 08:00:40 -08:00
} ,
{
name : 'Starts With' ,
value : 'STARTS_WITH' ,
} ,
{
name : 'Ends With' ,
value : 'ENDS_WITH' ,
} ,
] ,
default : 'EQUALS' ,
2022-05-06 14:01:25 -07:00
description : 'Value of the property to set' ,
2020-01-21 08:00:40 -08:00
} ,
{
displayName : 'Value' ,
name : 'value' ,
type : 'string' ,
default : '' ,
2020-10-22 06:46:03 -07:00
} ,
] ,
2020-01-21 08:00:40 -08:00
} ,
] ,
} ,
2020-10-22 06:46:03 -07:00
] ,
2020-01-21 08:00:40 -08:00
} ,
] ,
} ,
/* -------------------------------------------------------------------------- */
/* deal:delete */
/* -------------------------------------------------------------------------- */
{
displayName : 'Deal ID' ,
name : 'id' ,
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
resource : [
'deal' ,
] ,
operation : [
'delete' ,
] ,
} ,
} ,
description : 'If more than one deal add them separated by ,' ,
} ,
2021-12-03 00:44:16 -08:00
] ;