2022-08-01 13:47:55 -07:00
|
|
|
import { INodeProperties } from 'n8n-workflow';
|
2021-04-02 10:12:19 -07:00
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
export const opportunityOperations: INodeProperties[] = [
|
2021-04-02 10:12:19 -07:00
|
|
|
{
|
|
|
|
displayName: 'Operation',
|
|
|
|
name: 'operation',
|
|
|
|
type: 'options',
|
2022-05-20 14:47:24 -07:00
|
|
|
noDataExpression: true,
|
2021-04-02 10:12:19 -07:00
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
resource: ['opportunity'],
|
2021-04-02 10:12:19 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'Create',
|
|
|
|
value: 'create',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Create an opportunity',
|
2021-04-02 10:12:19 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Delete',
|
|
|
|
value: 'delete',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Delete an opportunity',
|
2021-04-02 10:12:19 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Get',
|
|
|
|
value: 'get',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Get an opportunity',
|
2021-04-02 10:12:19 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Get All',
|
|
|
|
value: 'getAll',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Get all opportunities',
|
2021-04-02 10:12:19 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Update',
|
|
|
|
value: 'update',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Update an opportunity',
|
2021-04-02 10:12:19 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
default: 'create',
|
|
|
|
},
|
2021-12-03 00:44:16 -08:00
|
|
|
];
|
2021-04-02 10:12:19 -07:00
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
export const opportunityFields: INodeProperties[] = [
|
2021-04-02 10:12:19 -07:00
|
|
|
// ----------------------------------------
|
|
|
|
// opportunity: create
|
|
|
|
// ----------------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Name',
|
|
|
|
name: 'name',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Name of the opportunity to create',
|
2021-04-02 10:12:19 -07:00
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
default: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
resource: ['opportunity'],
|
|
|
|
operation: ['create'],
|
2021-04-02 10:12:19 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Customer Source ID',
|
|
|
|
name: 'customerSourceId',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'ID of the customer source that generated this opportunity',
|
2021-04-02 10:12:19 -07:00
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
resource: ['opportunity'],
|
|
|
|
operation: ['create'],
|
2021-04-02 10:12:19 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Primary Contact ID',
|
|
|
|
name: 'primaryContactId',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'ID of the primary company associated with this opportunity',
|
2021-04-02 10:12:19 -07:00
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
resource: ['opportunity'],
|
|
|
|
operation: ['create'],
|
2021-04-02 10:12:19 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// ----------------------------------------
|
|
|
|
// opportunity: delete
|
|
|
|
// ----------------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Opportunity ID',
|
|
|
|
name: 'opportunityId',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'ID of the opportunity to delete',
|
2021-04-02 10:12:19 -07:00
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
default: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
resource: ['opportunity'],
|
|
|
|
operation: ['delete'],
|
2021-04-02 10:12:19 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// ----------------------------------------
|
|
|
|
// opportunity: get
|
|
|
|
// ----------------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Opportunity ID',
|
|
|
|
name: 'opportunityId',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'ID of the opportunity to retrieve',
|
2021-04-02 10:12:19 -07:00
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
default: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
resource: ['opportunity'],
|
|
|
|
operation: ['get'],
|
2021-04-02 10:12:19 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// ----------------------------------------
|
|
|
|
// opportunity: getAll
|
|
|
|
// ----------------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Return All',
|
|
|
|
name: 'returnAll',
|
|
|
|
type: 'boolean',
|
|
|
|
default: false,
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Whether to return all results or only up to a given limit',
|
2021-04-02 10:12:19 -07:00
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
resource: ['opportunity'],
|
|
|
|
operation: ['getAll'],
|
2021-04-02 10:12:19 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Limit',
|
|
|
|
name: 'limit',
|
|
|
|
type: 'number',
|
|
|
|
default: 5,
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Max number of results to return',
|
2021-04-02 10:12:19 -07:00
|
|
|
typeOptions: {
|
|
|
|
minValue: 1,
|
|
|
|
maxValue: 1000,
|
|
|
|
},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
resource: ['opportunity'],
|
|
|
|
operation: ['getAll'],
|
|
|
|
returnAll: [false],
|
2021-04-02 10:12:19 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Filters',
|
|
|
|
name: 'filterFields',
|
|
|
|
type: 'collection',
|
|
|
|
placeholder: 'Add Filter',
|
|
|
|
default: {},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
resource: ['opportunity'],
|
|
|
|
operation: ['getAll'],
|
2021-04-02 10:12:19 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Company IDs',
|
|
|
|
name: 'company_ids',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Comma-separated IDs of the primary companies to filter by',
|
2021-04-02 10:12:19 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Customer Source IDs',
|
|
|
|
name: 'customer_source_ids',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Comma-separated IDs of the customer sources to filter by',
|
2021-04-02 10:12:19 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
|
|
|
|
// ----------------------------------------
|
|
|
|
// opportunity: update
|
|
|
|
// ----------------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Opportunity ID',
|
|
|
|
name: 'opportunityId',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'ID of the opportunity to update',
|
2021-04-02 10:12:19 -07:00
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
default: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
resource: ['opportunity'],
|
|
|
|
operation: ['update'],
|
2021-04-02 10:12:19 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Update Fields',
|
|
|
|
name: 'updateFields',
|
|
|
|
type: 'collection',
|
|
|
|
placeholder: 'Add Field',
|
|
|
|
default: {},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-01 13:47:55 -07:00
|
|
|
resource: ['opportunity'],
|
|
|
|
operation: ['update'],
|
2021-04-02 10:12:19 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Customer Source ID',
|
|
|
|
name: 'customer_source_id',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'ID of the primary company associated with this opportunity',
|
2021-04-02 10:12:19 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Name',
|
|
|
|
name: 'name',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Name to set for the opportunity',
|
2021-04-02 10:12:19 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Primary Contact ID',
|
|
|
|
name: 'primary_contact_id',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'ID of the customer source that generated this opportunity',
|
2021-04-02 10:12:19 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2021-12-03 00:44:16 -08:00
|
|
|
];
|