2022-08-01 13:47:55 -07:00
import { INodeProperties } from 'n8n-workflow' ;
2021-07-30 07:12:30 -07:00
2021-12-03 00:44:16 -08:00
export const dealOperations : INodeProperties [ ] = [
2021-07-30 07:12:30 -07:00
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2021-07-30 07:12:30 -07:00
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'deal' ] ,
2021-07-30 07:12:30 -07:00
} ,
} ,
options : [
{
name : 'Create' ,
value : 'create' ,
description : 'Create a deal' ,
2022-07-10 13:50:51 -07:00
action : 'Create a deal' ,
2021-07-30 07:12:30 -07:00
} ,
{
name : 'Delete' ,
value : 'delete' ,
description : 'Delete a deal' ,
2022-07-10 13:50:51 -07:00
action : 'Delete a deal' ,
2021-07-30 07:12:30 -07:00
} ,
{
name : 'Get' ,
value : 'get' ,
description : 'Retrieve a deal' ,
2022-07-10 13:50:51 -07:00
action : 'Get a deal' ,
2021-07-30 07:12:30 -07:00
} ,
{
2022-09-07 07:51:14 -07:00
name : 'Get Many' ,
2021-07-30 07:12:30 -07:00
value : 'getAll' ,
2022-09-13 03:36:36 -07:00
description : 'Retrieve many deals' ,
2022-09-08 08:10:13 -07:00
action : 'Get many deals' ,
2021-07-30 07:12:30 -07:00
} ,
{
name : 'Update' ,
value : 'update' ,
description : 'Update a deal' ,
2022-07-10 13:50:51 -07:00
action : 'Update a deal' ,
2021-07-30 07:12:30 -07:00
} ,
] ,
default : 'create' ,
} ,
2021-12-03 00:44:16 -08:00
] ;
2021-07-30 07:12:30 -07:00
2021-12-03 00:44:16 -08:00
export const dealFields : INodeProperties [ ] = [
2021-07-30 07:12:30 -07:00
// ----------------------------------------
// deal: create
// ----------------------------------------
{
displayName : 'Amount' ,
name : 'amount' ,
description : 'Value of the deal' ,
type : 'number' ,
required : true ,
default : 0 ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'deal' ] ,
operation : [ 'create' ] ,
2021-07-30 07:12:30 -07:00
} ,
} ,
} ,
{
displayName : 'Name' ,
name : 'name' ,
description : 'Name of the deal' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'deal' ] ,
operation : [ 'create' ] ,
2021-07-30 07:12:30 -07:00
} ,
} ,
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'deal' ] ,
operation : [ 'create' ] ,
2021-07-30 07:12:30 -07:00
} ,
} ,
options : [
{
displayName : 'Base Currency Amount' ,
name : 'base_currency_amount' ,
type : 'number' ,
default : 0 ,
description : 'Value of the deal in base currency' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Campaign Name or ID' ,
2021-07-30 07:12:30 -07:00
name : 'campaign_id' ,
type : 'options' ,
default : '' ,
typeOptions : {
loadOptionsMethod : 'getCampaigns' ,
} ,
2022-08-01 13:47:55 -07:00
description :
'ID of the campaign that landed this deal. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-07-30 07:12:30 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Currency Name or ID' ,
2021-07-30 07:12:30 -07:00
name : 'currency_id' ,
type : 'options' ,
default : '' ,
typeOptions : {
loadOptionsMethod : 'getCurrencies' ,
} ,
2022-08-01 13:47:55 -07:00
description :
'ID of the currency that the deal belongs to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-07-30 07:12:30 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Deal Payment Status Name or ID' ,
2021-07-30 07:12:30 -07:00
name : 'deal_payment_status_id' ,
type : 'options' ,
default : '' ,
typeOptions : {
loadOptionsMethod : 'getDealPaymentStatuses' ,
} ,
2022-08-01 13:47:55 -07:00
description :
'ID of the mode of payment for the deal. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-07-30 07:12:30 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Deal Pipeline Name or ID' ,
2021-07-30 07:12:30 -07:00
name : 'deal_pipeline_id' ,
type : 'options' ,
default : '' ,
typeOptions : {
loadOptionsMethod : 'getDealPipelines' ,
} ,
2022-08-01 13:47:55 -07:00
description :
'ID of the deal pipeline that it belongs to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-07-30 07:12:30 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Deal Product Name or ID' ,
2021-07-30 07:12:30 -07:00
name : 'deal_product_id' ,
type : 'options' ,
default : '' ,
typeOptions : {
loadOptionsMethod : 'getDealProducts' ,
} ,
2022-08-01 13:47:55 -07:00
description :
'ID of the product that the deal belongs to (in a multi-product company). Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-07-30 07:12:30 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Deal Reason Name or ID' ,
2021-07-30 07:12:30 -07:00
name : 'deal_reason_id' ,
type : 'options' ,
default : '' ,
typeOptions : {
loadOptionsMethod : 'getDealReasons' ,
} ,
2022-08-01 13:47:55 -07:00
description :
'ID of the reason for losing the deal. Can only be set if the deal is in \'Lost\' stage. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-07-30 07:12:30 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Deal Stage Name or ID' ,
2021-07-30 07:12:30 -07:00
name : 'deal_stage_id' ,
type : 'options' ,
default : '' ,
typeOptions : {
loadOptionsMethod : 'getDealStages' ,
} ,
2022-08-01 13:47:55 -07:00
description :
'ID of the deal stage that the deal belongs to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-07-30 07:12:30 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Deal Type Name or ID' ,
2021-07-30 07:12:30 -07:00
name : 'deal_type_id' ,
type : 'options' ,
default : '' ,
typeOptions : {
loadOptionsMethod : 'getDealTypes' ,
} ,
2022-08-01 13:47:55 -07:00
description :
'ID of the deal type that the deal belongs to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-07-30 07:12:30 -07:00
} ,
{
displayName : 'Lead Source ID' ,
name : 'lead_source_id' ,
type : 'string' , // not obtainable from API
default : '' ,
description : 'ID of the source where deal came from' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Owner Name or ID' ,
2021-07-30 07:12:30 -07:00
name : 'owner_id' ,
type : 'options' ,
default : '' ,
typeOptions : {
loadOptionsMethod : 'getUsers' ,
} ,
2022-08-01 13:47:55 -07:00
description :
'ID of the user to whom the deal is assigned. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-07-30 07:12:30 -07:00
} ,
{
displayName : 'Probability' ,
name : 'probability' ,
type : 'number' ,
default : 0 ,
typeOptions : {
minValue : 0 ,
maxValue : 100 ,
} ,
description : 'Probability of winning the deal as a number between 0 and 100' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Sales Account Name or ID' ,
2021-07-30 07:12:30 -07:00
name : 'sales_account_id' ,
type : 'options' ,
default : '' ,
typeOptions : {
loadOptionsMethod : 'getAccounts' ,
} ,
2022-08-01 13:47:55 -07:00
description :
'ID of the account that the deal belongs to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-07-30 07:12:30 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Territory Name or ID' ,
2021-07-30 07:12:30 -07:00
name : 'territory_id' ,
type : 'options' ,
default : '' ,
typeOptions : {
loadOptionsMethod : 'getTerritories' ,
} ,
2022-08-01 13:47:55 -07:00
description :
'ID of the territory that the deal belongs to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-07-30 07:12:30 -07:00
} ,
] ,
} ,
// ----------------------------------------
// deal: delete
// ----------------------------------------
{
displayName : 'Deal ID' ,
name : 'dealId' ,
description : 'ID of the deal to delete' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'deal' ] ,
operation : [ 'delete' ] ,
2021-07-30 07:12:30 -07:00
} ,
} ,
} ,
// ----------------------------------------
// deal: get
// ----------------------------------------
{
displayName : 'Deal ID' ,
name : 'dealId' ,
description : 'ID of the deal to retrieve' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'deal' ] ,
operation : [ 'get' ] ,
2021-07-30 07:12:30 -07:00
} ,
} ,
} ,
// ----------------------------------------
// deal: getAll
// ----------------------------------------
{
2022-06-03 10:23:49 -07:00
displayName : 'View Name or ID' ,
2021-07-30 07:12:30 -07:00
name : 'view' ,
type : 'options' ,
2022-08-01 13:47:55 -07:00
description :
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>' ,
2021-07-30 07:12:30 -07:00
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'deal' ] ,
operation : [ 'getAll' ] ,
2021-07-30 07:12:30 -07:00
} ,
} ,
typeOptions : {
loadOptionsMethod : 'getDealViews' ,
} ,
default : '' ,
} ,
{
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-01 13:47:55 -07:00
resource : [ 'deal' ] ,
operation : [ 'getAll' ] ,
2021-07-30 07:12:30 -07:00
} ,
} ,
} ,
{
displayName : 'Limit' ,
name : 'limit' ,
type : 'number' ,
default : 50 ,
2022-05-06 14:01:25 -07:00
description : 'Max number of results to return' ,
2021-07-30 07:12:30 -07:00
typeOptions : {
minValue : 1 ,
} ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'deal' ] ,
operation : [ 'getAll' ] ,
returnAll : [ false ] ,
2021-07-30 07:12:30 -07:00
} ,
} ,
} ,
// ----------------------------------------
// deal: update
// ----------------------------------------
{
displayName : 'Deal ID' ,
name : 'dealId' ,
description : 'ID of the deal to update' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'deal' ] ,
operation : [ 'update' ] ,
2021-07-30 07:12:30 -07:00
} ,
} ,
} ,
{
displayName : 'Update Fields' ,
name : 'updateFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'deal' ] ,
operation : [ 'update' ] ,
2021-07-30 07:12:30 -07:00
} ,
} ,
options : [
{
displayName : 'Amount' ,
name : 'amount' ,
type : 'number' ,
default : 0 ,
typeOptions : {
minValue : 0 ,
} ,
description : 'Value of the deal' ,
} ,
{
displayName : 'Base Currency Amount' ,
name : 'base_currency_amount' ,
type : 'number' ,
default : 0 ,
typeOptions : {
minValue : 0 ,
} ,
description : 'Value of the deal in base currency' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Campaign Name or ID' ,
2021-07-30 07:12:30 -07:00
name : 'campaign_id' ,
type : 'options' ,
default : '' ,
typeOptions : {
loadOptionsMethod : 'getCampaigns' ,
} ,
2022-08-01 13:47:55 -07:00
description :
'ID of the campaign that landed this deal. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-07-30 07:12:30 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Currency Name or ID' ,
2021-07-30 07:12:30 -07:00
name : 'currency_id' ,
type : 'options' ,
default : '' ,
typeOptions : {
loadOptionsMethod : 'getCurrencies' ,
} ,
2022-08-01 13:47:55 -07:00
description :
'ID of the currency that the deal belongs to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-07-30 07:12:30 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Deal Payment Status Name or ID' ,
2021-07-30 07:12:30 -07:00
name : 'deal_payment_status_id' ,
type : 'options' ,
default : '' ,
typeOptions : {
loadOptionsMethod : 'getDealPaymentStatuses' ,
} ,
2022-08-01 13:47:55 -07:00
description :
'ID of the mode of payment for the deal. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-07-30 07:12:30 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Deal Pipeline Name or ID' ,
2021-07-30 07:12:30 -07:00
name : 'deal_pipeline_id' ,
type : 'options' ,
default : '' ,
typeOptions : {
loadOptionsMethod : 'getDealPipelines' ,
} ,
2022-08-01 13:47:55 -07:00
description :
'ID of the deal pipeline that it belongs to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-07-30 07:12:30 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Deal Product Name or ID' ,
2021-07-30 07:12:30 -07:00
name : 'deal_product_id' ,
type : 'options' ,
default : '' ,
typeOptions : {
loadOptionsMethod : 'getDealProducts' ,
} ,
2022-08-01 13:47:55 -07:00
description :
'ID of the product that the deal belongs to (in a multi-product company). Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-07-30 07:12:30 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Deal Reason Name or ID' ,
2021-07-30 07:12:30 -07:00
name : 'deal_reason_id' ,
type : 'options' ,
default : '' ,
typeOptions : {
loadOptionsMethod : 'getDealReasons' ,
} ,
2022-08-01 13:47:55 -07:00
description :
'ID of the reason for losing the deal. Can only be set if the deal is in \'Lost\' stage. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-07-30 07:12:30 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Deal Stage Name or ID' ,
2021-07-30 07:12:30 -07:00
name : 'deal_stage_id' ,
type : 'options' ,
default : '' ,
typeOptions : {
loadOptionsMethod : 'getDealStages' ,
} ,
2022-08-01 13:47:55 -07:00
description :
'ID of the deal stage that the deal belongs to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-07-30 07:12:30 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Deal Type Name or ID' ,
2021-07-30 07:12:30 -07:00
name : 'deal_type_id' ,
type : 'options' ,
default : '' ,
typeOptions : {
loadOptionsMethod : 'getDealTypes' ,
} ,
2022-08-01 13:47:55 -07:00
description :
'ID of the deal type that the deal belongs to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-07-30 07:12:30 -07:00
} ,
{
displayName : 'Lead Source ID' ,
name : 'lead_source_id' ,
type : 'string' , // not obtainable from API
default : '' ,
description : 'ID of the source where deal came from' ,
} ,
{
displayName : 'Name' ,
name : 'name' ,
type : 'string' ,
default : '' ,
description : 'Name of the deal' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Owner Name or ID' ,
2021-07-30 07:12:30 -07:00
name : 'owner_id' ,
type : 'options' ,
default : '' ,
typeOptions : {
loadOptionsMethod : 'getUsers' ,
} ,
2022-08-01 13:47:55 -07:00
description :
'ID of the user to whom the deal is assigned. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-07-30 07:12:30 -07:00
} ,
{
displayName : 'Probability' ,
name : 'probability' ,
type : 'number' ,
default : 0 ,
typeOptions : {
minValue : 0 ,
maxValue : 100 ,
} ,
description : 'Probability of winning the deal as a number between 0 and 100' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Sales Account Name or ID' ,
2021-07-30 07:12:30 -07:00
name : 'sales_account_id' ,
type : 'options' ,
default : '' ,
typeOptions : {
loadOptionsMethod : 'getAccounts' ,
} ,
2022-08-01 13:47:55 -07:00
description :
'ID of the account that the deal belongs to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-07-30 07:12:30 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Territory Name or ID' ,
2021-07-30 07:12:30 -07:00
name : 'territory_id' ,
type : 'options' ,
default : '' ,
typeOptions : {
loadOptionsMethod : 'getTerritories' ,
} ,
2022-08-01 13:47:55 -07:00
description :
'ID of the territory that the deal belongs to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-07-30 07:12:30 -07:00
} ,
] ,
} ,
2021-12-03 00:44:16 -08:00
] ;