🔀 Merge branch 'RicardoE105-feature/salesforce' into oauth-support

This commit is contained in:
Jan Oberhauser 2020-02-12 22:36:48 -08:00
commit 4bcd0bc073
21 changed files with 6818 additions and 0 deletions

View file

@ -0,0 +1,40 @@
import {
ICredentialType,
NodePropertyTypes,
} from 'n8n-workflow';
export class SalesforceOAuth2Api implements ICredentialType {
name = 'salesforceOAuth2Api';
extends = [
'oAuth2Api',
];
displayName = 'Salesforce OAuth2 API';
properties = [
{
displayName: 'Authorization URL',
name: 'authUrl',
type: 'hidden' as NodePropertyTypes,
default: 'https://login.salesforce.com/services/oauth2/authorize',
required: true,
},
{
displayName: 'Access Token URL',
name: 'accessTokenUrl',
type: 'string' as NodePropertyTypes,
default: 'https://yourcompany.salesforce.com/services/oauth2/token',
required: true,
},
{
displayName: 'Scope',
name: 'scope',
type: 'hidden' as NodePropertyTypes,
default: 'full',
},
{
displayName: 'Auth URI Query Parameters',
name: 'authQueryParameters',
type: 'hidden' as NodePropertyTypes,
default: '',
},
];
}

View file

@ -0,0 +1,700 @@
import { INodeProperties } from 'n8n-workflow';
export const accountOperations = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
displayOptions: {
show: {
resource: [
'account',
],
},
},
options: [
{
name: 'Add Note',
value: 'addNote',
description: 'Add note to an account',
},
{
name: 'Create',
value: 'create',
description: 'Create an account',
},
{
name: 'Get',
value: 'get',
description: 'Get an account',
},
{
name: 'Get All',
value: 'getAll',
description: 'Get all accounts',
},
{
name: 'Get Summary',
value: 'getSummary',
description: `Returns an overview of account's metadata.`,
},
{
name: 'Delete',
value: 'delete',
description: 'Delete an account',
},
{
name: 'Update',
value: 'update',
description: 'Update an account',
},
],
default: 'create',
description: 'The operation to perform.',
},
] as INodeProperties[];
export const accountFields = [
/* -------------------------------------------------------------------------- */
/* account:create */
/* -------------------------------------------------------------------------- */
{
displayName: 'Name',
name: 'name',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'account',
],
operation: [
'create',
]
},
},
description: 'Name of the account. Maximum size is 255 characters.',
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'account',
],
operation: [
'create',
],
},
},
options: [
{
displayName: 'Account Source',
name: 'accountSource',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getAccountSources',
},
default: '',
description: 'The source of the account record',
},
{
displayName: 'Annual Revenue',
name: 'annualRevenue',
type: 'number',
typeOptions: {
numberPrecision: 2,
},
default: '',
description: 'Estimated annual revenue of the account.',
},
{
displayName: 'Billing City',
name: 'billingCity',
type: 'string',
default: '',
description: 'Details for the billing address of this account. Maximum size is 40 characters.',
},
{
displayName: 'Billing Country',
name: 'billingCountry',
type: 'string',
default: '',
description: 'Details for the billing address of this account. Maximum size is 80 characters.',
},
{
displayName: 'Billing Postal Code',
name: 'billingPostalCode',
type: 'string',
default: '',
description: 'Details for the billing address of this account. Maximum size is 20 characters.',
},
{
displayName: 'Billing State',
name: 'billingState',
type: 'string',
default: '',
description: 'Details for the billing address of this account. Maximum size is 80 characters.',
},
{
displayName: 'Billing Street',
name: 'billingStreet',
type: 'string',
default: '',
description: 'Street address for the billing address of this account.',
},
{
displayName: 'Description',
name: 'description',
type: 'string',
typeOptions: {
alwaysOpenEditWindow: true,
},
default: '',
description: 'Text description of the account. Limited to 32,000 KB.',
},
{
displayName: 'Fax',
name: 'fax',
type: 'string',
default: '',
description: 'Fax number for the account.',
},
{
displayName: 'Jigsaw',
name: 'jigsaw',
type: 'string',
default: '',
description: 'references the ID of a company in Data.com',
},
{
displayName: 'Industry',
name: 'industry',
type: 'string',
default: '',
description: 'The website of this account. Maximum of 255 characters.',
},
{
displayName: 'Number Of Employees',
name: 'numberOfEmployees',
type: 'integer',
default: '',
description: 'Number of employees',
},
{
displayName: 'Owner',
name: 'owner',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
default: '',
description: 'The owner of the account.',
},
{
displayName: 'Phone',
name: 'phone',
type: 'string',
default: '',
description: 'Phone number for the account.',
},
{
displayName: 'SicDesc',
name: 'sicDesc',
type: 'string',
typeOptions: {
alwaysOpenEditWindow: true,
},
description: 'A brief description of an organizations line of business, based on its SIC code.',
},
{
displayName: 'Type',
name: 'type',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getAccountTypes',
},
description: 'Type of account',
},
{
displayName: 'Parent Id',
name: 'parentId',
type: 'string',
default: '',
description: 'ID of the parent object, if any.',
},
{
displayName: 'Shipping City',
name: 'shippingCity',
type: 'string',
default: '',
description: 'Details of the shipping address for this account. City maximum size is 40 characters',
},
{
displayName: 'Shipping Country',
name: 'shippingCountry',
type: 'string',
default: '',
description: 'Details of the shipping address for this account. Country maximum size is 80 characters.',
},
{
displayName: 'Shipping Postal Code',
name: 'shippingPostalCode',
type: 'string',
default: '',
description: 'Details of the shipping address for this account. Postal code maximum size is 20 characters.',
},
{
displayName: 'Shipping State',
name: 'shippingState',
type: 'string',
default: '',
description: 'Details of the shipping address for this account. State maximum size is 80 characters.',
},
{
displayName: 'Shipping Street',
name: 'shippingStreet',
type: 'string',
default: '',
description: 'The street address of the shipping address for this account. Maximum of 255 characters.',
},
{
displayName: 'Website',
name: 'website',
type: 'string',
default: '',
description: 'The website of this account. Maximum of 255 characters.',
},
],
},
/* -------------------------------------------------------------------------- */
/* account:update */
/* -------------------------------------------------------------------------- */
{
displayName: 'Account ID',
name: 'accountId',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'account',
],
operation: [
'update',
]
},
},
description: 'Id of account that needs to be fetched',
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'account',
],
operation: [
'update',
],
},
},
options: [
{
displayName: 'Account Source',
name: 'accountSource',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getAccountSources',
},
default: '',
description: 'The source of the account record',
},
{
displayName: 'Annual Revenue',
name: 'annualRevenue',
type: 'number',
typeOptions: {
numberPrecision: 2,
},
default: '',
description: 'Estimated annual revenue of the account.',
},
{
displayName: 'Billing City',
name: 'billingCity',
type: 'string',
default: '',
description: 'Details for the billing address of this account. Maximum size is 40 characters.',
},
{
displayName: 'Billing Country',
name: 'billingCountry',
type: 'string',
default: '',
description: 'Details for the billing address of this account. Maximum size is 80 characters.',
},
{
displayName: 'Billing Postal Code',
name: 'billingPostalCode',
type: 'string',
default: '',
description: 'Details for the billing address of this account. Maximum size is 20 characters.',
},
{
displayName: 'Billing State',
name: 'billingState',
type: 'string',
default: '',
description: 'Details for the billing address of this account. Maximum size is 80 characters.',
},
{
displayName: 'Billing Street',
name: 'billingStreet',
type: 'string',
default: '',
description: 'Street address for the billing address of this account.',
},
{
displayName: 'Description',
name: 'description',
type: 'string',
typeOptions: {
alwaysOpenEditWindow: true,
},
default: '',
description: 'Text description of the account. Limited to 32,000 KB.',
},
{
displayName: 'Fax',
name: 'fax',
type: 'string',
default: '',
description: 'Fax number for the account.',
},
{
displayName: 'Industry',
name: 'industry',
type: 'string',
default: '',
description: 'The website of this account. Maximum of 255 characters.',
},
{
displayName: 'Jigsaw',
name: 'jigsaw',
type: 'string',
default: '',
description: 'references the ID of a company in Data.com',
},
{
displayName: 'Owner',
name: 'ownerId',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
default: '',
description: 'The owner of the account.',
},
{
displayName: 'Phone',
name: 'phone',
type: 'string',
default: '',
description: 'Phone number for the account.',
},
{
displayName: 'Type',
name: 'type',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getAccountTypes',
},
description: 'Type of account',
},
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
description: 'Name of the account. Maximum size is 255 characters.',
},
{
displayName: 'Number Of Employees',
name: 'numberOfEmployees',
type: 'integer',
default: '',
description: 'Number of employees',
},
{
displayName: 'Parent Id',
name: 'parentId',
type: 'string',
default: '',
description: 'ID of the parent object, if any.',
},
{
displayName: 'SicDesc',
name: 'sicDesc',
type: 'string',
typeOptions: {
alwaysOpenEditWindow: true,
},
description: 'A brief description of an organizations line of business, based on its SIC code.',
},
{
displayName: 'Shipping City',
name: 'shippingCity',
type: 'string',
default: '',
description: 'Details of the shipping address for this account. City maximum size is 40 characters',
},
{
displayName: 'Shipping Country',
name: 'shippingCountry',
type: 'string',
default: '',
description: 'Details of the shipping address for this account. Country maximum size is 80 characters.',
},
{
displayName: 'Shipping Postal Code',
name: 'shippingPostalCode',
type: 'string',
default: '',
description: 'Details of the shipping address for this account. Postal code maximum size is 20 characters.',
},
{
displayName: 'Shipping State',
name: 'shippingState',
type: 'string',
default: '',
description: 'Details of the shipping address for this account. State maximum size is 80 characters.',
},
{
displayName: 'Shipping Street',
name: 'shippingStreet',
type: 'string',
default: '',
description: 'The street address of the shipping address for this account. Maximum of 255 characters.',
},
{
displayName: 'Website',
name: 'website',
type: 'string',
default: '',
description: 'The website of this account. Maximum of 255 characters.',
},
],
},
/* -------------------------------------------------------------------------- */
/* account:get */
/* -------------------------------------------------------------------------- */
{
displayName: 'Account ID',
name: 'accountId',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'account',
],
operation: [
'get',
]
},
},
description: 'Id of account that needs to be fetched',
},
/* -------------------------------------------------------------------------- */
/* account:delete */
/* -------------------------------------------------------------------------- */
{
displayName: 'Account ID',
name: 'accountId',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'account',
],
operation: [
'delete',
]
},
},
description: 'Id of account that needs to be fetched',
},
/* -------------------------------------------------------------------------- */
/* account:getAll */
/* -------------------------------------------------------------------------- */
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
resource: [
'account',
],
operation: [
'getAll',
],
},
},
default: false,
description: 'If all results should be returned or only up to a given limit.',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
displayOptions: {
show: {
resource: [
'account',
],
operation: [
'getAll',
],
returnAll: [
false,
],
},
},
typeOptions: {
minValue: 1,
maxValue: 100,
},
default: 50,
description: 'How many results to return.',
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'account',
],
operation: [
'getAll',
],
},
},
options: [
{
displayName: 'Fields',
name: 'fields',
type: 'string',
default: '',
description: 'Fields to include separated by ,',
},
]
},
/* -------------------------------------------------------------------------- */
/* account:addNote */
/* -------------------------------------------------------------------------- */
{
displayName: 'Account ID',
name: 'accountId',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'account',
],
operation: [
'addNote',
]
},
},
description: 'Id of account that needs to be fetched',
},
{
displayName: 'Title',
name: 'title',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'account',
],
operation: [
'addNote',
]
},
},
description: 'Title of the note.',
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'account',
],
operation: [
'addNote',
],
},
},
options: [
{
displayName: 'Body',
name: 'body',
type: 'string',
default: '',
typeOptions: {
alwaysOpenEditWindow: true,
},
description: 'Body of the note. Limited to 32 KB.',
},
{
displayName: 'Is Private',
name: 'isPrivate',
type: 'boolean',
default: false,
description: 'If true, only the note owner or a user with the “Modify All Data” permission can view the note or query it via the API',
},
{
displayName: 'Owner',
name: 'ownerId',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
default: '',
description: 'ID of the user who owns the note.',
},
]
},
] as INodeProperties[];

View file

@ -0,0 +1,26 @@
export interface IAccount {
Name?: string;
Fax?: string;
Type?: string;
Phone?: string;
Jigsaw?: string;
OwnerId?: string;
SicDesc?: string;
Website?: string;
Industry?: string;
ParentId?: string;
BillingCity?: string;
Description?: string;
BillingState?: string;
ShippingStreet?: string;
ShippingCity?:string;
AccountSource?: string;
AnnualRevenue?: number;
BillingStreet?: string;
ShippingState?: string;
BillingCountry?: string;
ShippingCountry?: string;
BillingPostalCode?: string;
NumberOfEmployees?: string;
ShippingPostalCode?: string;
}

View file

@ -0,0 +1,347 @@
import { INodeProperties } from 'n8n-workflow';
export const attachmentOperations = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
displayOptions: {
show: {
resource: [
'attachment',
],
},
},
options: [
{
name: 'Create',
value: 'create',
description: 'Create a attachment',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a attachment',
},
{
name: 'Get',
value: 'get',
description: 'Get a attachment',
},
{
name: 'Get All',
value: 'getAll',
description: 'Get all attachments',
},
{
name: 'Get Summary',
value: 'getSummary',
description: `Returns an overview of attachment's metadata.`,
},
{
name: 'Update',
value: 'update',
description: 'Update a attachment',
},
],
default: 'create',
description: 'The operation to perform.',
},
] as INodeProperties[];
export const attachmentFields = [
/* -------------------------------------------------------------------------- */
/* attachment:create */
/* -------------------------------------------------------------------------- */
{
displayName: 'Parent ID',
name: 'parentId',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
resource: [
'attachment',
],
operation: [
'create'
],
},
},
description: '',
},
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
resource: [
'attachment',
],
operation: [
'create'
],
},
},
description: 'Required. Name of the attached file. Maximum size is 255 characters. Label is File Name.',
},
{
displayName: 'Binary Property',
name: 'binaryPropertyName',
type: 'string',
default: 'data',
required: true,
displayOptions: {
show: {
resource: [
'attachment',
],
operation: [
'create'
],
},
},
placeholder: '',
description: 'Name of the binary property which contains<br />the data for the file to be uploaded.',
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'attachment',
],
operation: [
'create',
],
},
},
options: [
{
displayName: 'Description',
name: 'description',
type: 'string',
default: '',
description: `Text description of the Document. Limit: 255 characters.`,
},
{
displayName: 'Is Private',
name: 'isPrivate',
type: 'boolean',
default: false,
description: 'Indicates whether this record is viewable only by the owner and administrators (true) or viewable by all otherwise-allowed users (false). ',
},
{
displayName: 'Owner',
name: 'owner',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
default: '',
description: 'ID of the User who owns the attachment.',
},
],
},
/* -------------------------------------------------------------------------- */
/* attachment:update */
/* -------------------------------------------------------------------------- */
{
displayName: 'Attachment ID',
name: 'attachmentId',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'attachment',
],
operation: [
'update',
]
},
},
description: 'Id of attachment that needs to be fetched',
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'attachment',
],
operation: [
'update',
],
},
},
options: [
{
displayName: 'Binary Property',
name: 'binaryPropertyName',
type: 'string',
default: 'data',
placeholder: '',
description: 'Name of the binary property which contains<br />the data for the file to be uploaded.',
},
{
displayName: 'Description',
name: 'description',
type: 'string',
default: '',
description: `Text description of the Document. Limit: 255 characters.`,
},
{
displayName: 'Is Private',
name: 'isPrivate',
type: 'boolean',
default: false,
description: 'Indicates whether this record is viewable only by the owner and administrators (true) or viewable by all otherwise-allowed users (false). ',
},
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
description: 'Required. Name of the attached file. Maximum size is 255 characters. Label is File Name.',
},
{
displayName: 'Owner',
name: 'owner',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
default: '',
description: 'ID of the User who owns the attachment.',
},
],
},
/* -------------------------------------------------------------------------- */
/* attachment:get */
/* -------------------------------------------------------------------------- */
{
displayName: 'Attachment ID',
name: 'attachmentId',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'attachment',
],
operation: [
'get',
]
},
},
description: 'Id of attachment that needs to be fetched',
},
/* -------------------------------------------------------------------------- */
/* attachment:delete */
/* -------------------------------------------------------------------------- */
{
displayName: 'Attachment ID',
name: 'attachmentId',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'attachment',
],
operation: [
'delete',
]
},
},
description: 'Id of attachment that needs to be fetched',
},
/* -------------------------------------------------------------------------- */
/* attachment:getAll */
/* -------------------------------------------------------------------------- */
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
resource: [
'attachment',
],
operation: [
'getAll',
],
},
},
default: false,
description: 'If all results should be returned or only up to a given limit.',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
displayOptions: {
show: {
resource: [
'attachment',
],
operation: [
'getAll',
],
returnAll: [
false,
],
},
},
typeOptions: {
minValue: 1,
maxValue: 100,
},
default: 50,
description: 'How many results to return.',
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'attachment',
],
operation: [
'getAll',
],
},
},
options: [
{
displayName: 'Fields',
name: 'fields',
type: 'string',
default: '',
description: 'Fields to include separated by ,',
},
]
},
] as INodeProperties[];

View file

@ -0,0 +1,10 @@
export interface IAttachment {
ParentId?: string;
Name?: string;
Body?: string;
OwnerId?: string;
IsPrivate?: boolean;
ContentType?: string;
Description?: string;
}

View file

@ -0,0 +1,7 @@
export interface ICampaignMember {
CampaignId?: string;
ContactId?: string;
LeadId?: string;
Status?: string;
}

View file

@ -0,0 +1,563 @@
import { INodeProperties } from 'n8n-workflow';
export const caseOperations = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
displayOptions: {
show: {
resource: [
'case',
],
},
},
options: [
{
name: 'Add Comment',
value: 'addComment',
description: 'Add a comment to a case',
},
{
name: 'Create',
value: 'create',
description: 'Create a case',
},
{
name: 'Get',
value: 'get',
description: 'Get a case',
},
{
name: 'Get All',
value: 'getAll',
description: 'Get all cases',
},
{
name: 'Get Summary',
value: 'getSummary',
description: `Returns an overview of case's metadata.`,
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a case',
},
{
name: 'Update',
value: 'update',
description: 'Update a case',
},
],
default: 'create',
description: 'The operation to perform.',
},
] as INodeProperties[];
export const caseFields = [
/* -------------------------------------------------------------------------- */
/* case:create */
/* -------------------------------------------------------------------------- */
{
displayName: 'Type',
name: 'type',
type: 'options',
required: true,
typeOptions: {
loadOptionsMethod: 'getCaseTypes',
},
displayOptions: {
show: {
resource: [
'case',
],
operation: [
'create',
],
},
},
default: '',
description: 'The type of case',
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'case',
],
operation: [
'create',
],
},
},
options: [
{
displayName: 'Account Id',
name: 'accountId',
type: 'string',
default: '',
description: 'ID of the account associated with this case.',
},
{
displayName: 'Contact Id',
name: 'contactId',
type: 'string',
default: '',
description: 'IID of the associated Contact.',
},
{
displayName: 'Description',
name: 'description',
type: 'string',
default: '',
description: 'A text description of the case. Limit: 32 KB.',
},
{
displayName: 'Is Escalated',
name: 'isEscalated',
type: 'boolean',
default: false,
description: 'Indicates whether the case has been escalated (true) or not.',
},
{
displayName: 'Origin',
name: 'origin',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getCaseOrigins',
},
default: '',
description: 'The source of the case, such as Email, Phone, or Web. Label is Case Origin.',
},
{
displayName: 'Owner',
name: 'owner',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
default: '',
description: 'The owner of the case.',
},
{
displayName: 'Parent Id',
name: 'ParentId',
type: 'string',
default: '',
description: 'The ID of the parent case in the hierarchy. The label is Parent Case.',
},
{
displayName: 'Priority',
name: 'priority',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getCasePriorities',
},
default: '',
description: 'The importance or urgency of the case, such as High, Medium, or Low.',
},
{
displayName: 'Reason',
name: 'reason',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getCaseReasons',
},
default: '',
description: 'The reason why the case was created, such as Instructions not clear, or User didnt attend training.',
},
{
displayName: 'Status',
name: 'status',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getCaseStatuses',
},
default: '',
description: 'The status of the case, such as “New,” “Closed,” or “Escalated.” This field directly controls the IsClosed flag',
},
{
displayName: 'Subject',
name: 'subject',
type: 'string',
default: '',
description: 'The subject of the case. Limit: 255 characters.',
},
{
displayName: 'Supplied Company',
name: 'suppliedCompany',
type: 'string',
default: '',
description: `The company name that was entered when the case was created. This field can't be updated after the case has been created..`,
},
{
displayName: 'Supplied Email',
name: 'suppliedEmail',
type: 'string',
default: '',
description: `The email address that was entered when the case was created. This field can't be updated after the case has been created.`,
},
{
displayName: 'Supplied Name',
name: 'suppliedName',
type: 'string',
default: '',
description: `The name that was entered when the case was created. This field can't be updated after the case has been created`,
},
{
displayName: 'Supplied Phone',
name: 'suppliedPhone',
type: 'string',
default: '',
description: `The phone number that was entered when the case was created. This field can't be updated after the case has been created.`,
},
],
},
/* -------------------------------------------------------------------------- */
/* case:update */
/* -------------------------------------------------------------------------- */
{
displayName: 'Case ID',
name: 'caseId',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'case',
],
operation: [
'update',
]
},
},
description: 'Id of case that needs to be fetched',
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'case',
],
operation: [
'update',
],
},
},
options: [
{
displayName: 'Type',
name: 'type',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getCaseTypes',
},
default: '',
description: 'The type of case',
},
{
displayName: 'Origin',
name: 'origin',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getCaseOrigins',
},
default: '',
description: 'The source of the case, such as Email, Phone, or Web. Label is Case Origin.',
},
{
displayName: 'Reason',
name: 'reason',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getCaseReasons',
},
default: '',
description: 'The reason why the case was created, such as Instructions not clear, or User didnt attend training.',
},
{
displayName: 'Status',
name: 'status',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getCaseStatuses',
},
default: '',
description: 'The status of the case, such as “New,” “Closed,” or “Escalated.” This field directly controls the IsClosed flag',
},
{
displayName: 'Owner',
name: 'owner',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
default: '',
description: 'The owner of the case.',
},
{
displayName: 'Subject',
name: 'subject',
type: 'string',
default: '',
description: 'The subject of the case. Limit: 255 characters.',
},
{
displayName: 'Parent Id',
name: 'ParentId',
type: 'string',
default: '',
description: 'The ID of the parent case in the hierarchy. The label is Parent Case.',
},
{
displayName: 'Priority',
name: 'priority',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getCasePriorities',
},
default: '',
description: 'The importance or urgency of the case, such as High, Medium, or Low.',
},
{
displayName: 'Account Id',
name: 'accountId',
type: 'string',
default: '',
description: 'ID of the account associated with this case.',
},
{
displayName: 'Contact Id',
name: 'contactId',
type: 'string',
default: '',
description: 'IID of the associated Contact.',
},
{
displayName: 'Description',
name: 'description',
type: 'string',
default: '',
description: 'A text description of the case. Limit: 32 KB.',
},
{
displayName: 'Is Escalated',
name: 'isEscalated',
type: 'boolean',
default: false,
description: 'Indicates whether the case has been escalated (true) or not.',
},
{
displayName: 'Supplied Name',
name: 'suppliedName',
type: 'string',
default: '',
description: `The name that was entered when the case was created. This field can't be updated after the case has been created`,
},
{
displayName: 'Supplied Email',
name: 'suppliedEmail',
type: 'string',
default: '',
description: `The email address that was entered when the case was created. This field can't be updated after the case has been created.`,
},
{
displayName: 'Supplied Phone',
name: 'suppliedPhone',
type: 'string',
default: '',
description: `The phone number that was entered when the case was created. This field can't be updated after the case has been created.`,
},
{
displayName: 'Supplied Company',
name: 'suppliedCompany',
type: 'string',
default: '',
description: `The company name that was entered when the case was created. This field can't be updated after the case has been created..`,
},
],
},
/* -------------------------------------------------------------------------- */
/* case:get */
/* -------------------------------------------------------------------------- */
{
displayName: 'Case ID',
name: 'caseId',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'case',
],
operation: [
'get',
]
},
},
description: 'Id of case that needs to be fetched',
},
/* -------------------------------------------------------------------------- */
/* case:delete */
/* -------------------------------------------------------------------------- */
{
displayName: 'Case ID',
name: 'caseId',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'case',
],
operation: [
'delete',
]
},
},
description: 'Id of case that needs to be fetched',
},
/* -------------------------------------------------------------------------- */
/* case:getAll */
/* -------------------------------------------------------------------------- */
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
resource: [
'case',
],
operation: [
'getAll',
],
},
},
default: false,
description: 'If all results should be returned or only up to a given limit.',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
displayOptions: {
show: {
resource: [
'case',
],
operation: [
'getAll',
],
returnAll: [
false,
],
},
},
typeOptions: {
minValue: 1,
maxValue: 100,
},
default: 50,
description: 'How many results to return.',
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'case',
],
operation: [
'getAll',
],
},
},
options: [
{
displayName: 'Fields',
name: 'fields',
type: 'string',
default: '',
description: 'Fields to include separated by ,',
},
]
},
/* -------------------------------------------------------------------------- */
/* case:addComment */
/* -------------------------------------------------------------------------- */
{
displayName: 'Case ID',
name: 'caseId',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'case',
],
operation: [
'addComment',
]
},
},
description: 'Id of case that needs to be fetched',
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'case',
],
operation: [
'addComment',
],
},
},
options: [
{
displayName: 'Comment Body',
name: 'commentBody',
type: 'string',
typeOptions: {
alwaysOpenEditWindow: true,
},
default: '',
description: 'Text of the CaseComment. The maximum size of the comment body is 4,000 bytes. Label is Body.',
},
{
displayName: 'Is Published',
name: 'isPublished',
type: 'boolean',
default: false,
description: 'Indicates whether the CaseComment is visible to customers in the Self-Service portal (true) or not (false). ',
},
]
},
] as INodeProperties[];

View file

@ -0,0 +1,25 @@
export interface ICase {
Type?: string;
Origin?: string;
Reason?: string;
Status?: string;
OwnerId?: string;
Subject?: string;
ParentId?: string;
Priority?: string;
AccountId?: string;
ContactId?: string;
Description?: string;
IsEscalated?: boolean;
SuppliedName?: string;
SuppliedEmail?: string;
SuppliedPhone?: string;
SuppliedCompany?: string;
}
export interface ICaseComment {
CommentBody?: string;
ParentId?: string;
IsPublished?: boolean;
}

View file

@ -0,0 +1,835 @@
import { INodeProperties } from 'n8n-workflow';
export const contactOperations = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
displayOptions: {
show: {
resource: [
'contact',
],
},
},
options: [
{
name: 'Add Lead To Campaign',
value: 'addToCampaign',
description: 'Add lead to a campaign',
},
{
name: 'Add Note',
value: 'addNote',
description: 'Add note to a contact',
},
{
name: 'Create',
value: 'create',
description: 'Create a contact',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a contact',
},
{
name: 'Get',
value: 'get',
description: 'Get a contact',
},
{
name: 'Get Summary',
value: 'getSummary',
description: `Returns an overview of contact's metadata.`,
},
{
name: 'Get All',
value: 'getAll',
description: 'Get all contacts',
},
{
name: 'Update',
value: 'update',
description: 'Update a contact',
},
],
default: 'create',
description: 'The operation to perform.',
},
] as INodeProperties[];
export const contactFields = [
/* -------------------------------------------------------------------------- */
/* contact:create */
/* -------------------------------------------------------------------------- */
{
displayName: 'Last Name',
name: 'lastname',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'contact',
],
operation: [
'create',
]
},
},
description: 'Required. Last name of the contact. Limited to 80 characters.',
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'contact',
],
operation: [
'create',
],
},
},
options: [
{
displayName: 'Account',
name: 'acconuntId',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getAccounts',
},
default: '',
description: 'ID of the account that is the parent of this contact.',
},
{
displayName: 'Assistant Name',
name: 'assistantName',
type: 'string',
default: '',
description: 'The name of the assistant.',
},
{
displayName: 'Assistant Phone',
name: 'Assistant Phone',
type: 'string',
default: '',
description: 'The telephone number of the assistant.',
},
{
displayName: 'Birth Date',
name: 'birthdate',
type: 'dateTime',
default: '',
description: 'The birth date of the contact.',
},
{
displayName: 'Department',
name: 'department',
type: 'string',
default: '',
description: 'The department of the contact.',
},
{
displayName: 'Description',
name: 'description',
type: 'string',
default: '',
description: 'A description of the contact. Label is Contact Description. Limit: 32 KB.',
},
{
displayName: 'Email',
name: 'email',
type: 'string',
default: '',
description: 'Email address for the contact.',
},
{
displayName: 'Email Bounced Date',
name: 'otherPostalCode',
type: 'dateTime',
default: '',
description: 'If bounce management is activated and an email sent to the contact bounces, the date and time the bounce occurred.',
},
{
displayName: 'Email Bounced Reason',
name: 'emailBouncedReason',
type: 'string',
default: '',
description: 'If bounce management is activated and an email sent to the contact bounces, the reason the bounce occurred.',
},
{
displayName: 'Fax',
name: 'fax',
type: 'string',
default: '',
description: 'Fax number for the contact. Label is Business Fax.',
},
{
displayName: 'First Name',
name: 'firstName',
type: 'string',
default: '',
description: 'First name of the contact. Maximum size is 40 characters.',
},
{
displayName: 'Home Phone',
name: 'homePhone',
type: 'string',
default: '',
description: 'Home telephone number for the contact',
},
{
displayName: 'Jigsaw',
name: 'jigsaw',
type: 'string',
default: '',
description: `references the ID of a contact in Data.com.
If a contact has a value in this field, it means that a contact was imported as a contact from Data.com.`,
},
{
displayName: 'Lead Source',
name: 'leadSource',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getLeadSources',
},
default: '',
description: 'Source from which the lead was obtained.',
},
{
displayName: 'Mailing City',
name: 'mailingCity',
type: 'string',
default: '',
},
{
displayName: 'Mailing Country',
name: 'mailingCountry',
type: 'string',
default: '',
},
{
displayName: 'Mobile Phone',
name: 'mobilePhone',
type: 'string',
default: '',
description: `Contacts mobile phone number.`,
},
{
displayName: 'Mailing Postal Code',
name: 'mailingPostalCode',
type: 'string',
default: '',
},
{
displayName: 'Mailing State',
name: 'mailingState',
type: 'string',
default: '',
},
{
displayName: 'Mailing Street',
name: 'mailingStreet',
type: 'string',
default: '',
description: 'Street address for mailing address.',
},
{
displayName: 'Other City',
name: 'otherCity',
type: 'string',
default: '',
},
{
displayName: 'Other Country',
name: 'otherCountry',
type: 'string',
default: '',
},
{
displayName: 'Other Phone',
name: 'otherPhone',
type: 'string',
default: '',
description: 'Telephone for alternate address.',
},
{
displayName: 'Other Postal Code',
name: 'otherPostalCode',
type: 'string',
default: '',
},
{
displayName: 'Other State',
name: 'otherState',
type: 'string',
default: '',
},
{
displayName: 'Other Street',
name: 'otherStreet',
type: 'string',
default: '',
description: 'Street for alternate address.',
},
{
displayName: 'Owner',
name: 'owner',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
default: '',
description: 'The owner of the contact.',
},
{
displayName: 'Phone',
name: 'phone',
type: 'string',
default: '',
description: 'Phone number for the contact.',
},
{
displayName: 'Title',
name: 'title',
type: 'string',
default: '',
description: 'Title of the contact such as CEO or Vice President.',
},
{
displayName: 'Salutation',
name: 'salutation',
type: 'string',
default: '',
description: 'Honorific abbreviation, word, or phrase to be used in front of name in greetings, such as Dr. or Mrs.',
},
],
},
/* -------------------------------------------------------------------------- */
/* contact:update */
/* -------------------------------------------------------------------------- */
{
displayName: 'Contact ID',
name: 'contactId',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'contact',
],
operation: [
'update',
]
},
},
description: 'Id of contact that needs to be fetched',
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'contact',
],
operation: [
'update',
],
},
},
options: [
{
displayName: 'Account',
name: 'acconuntId',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getAccounts',
},
default: '',
description: 'ID of the account that is the parent of this contact.',
},
{
displayName: 'Assistant Name',
name: 'assistantName',
type: 'string',
default: '',
description: 'The name of the assistant.',
},
{
displayName: 'Assistant Phone',
name: 'Assistant Phone',
type: 'string',
default: '',
description: 'The telephone number of the assistant.',
},
{
displayName: 'Birth Date',
name: 'birthdate',
type: 'dateTime',
default: '',
description: 'The birth date of the contact.',
},
{
displayName: 'Department',
name: 'department',
type: 'string',
default: '',
description: 'The department of the contact.',
},
{
displayName: 'Description',
name: 'description',
type: 'string',
default: '',
description: 'A description of the contact. Label is Contact Description. Limit: 32 KB.',
},
{
displayName: 'Email',
name: 'email',
type: 'string',
default: '',
description: 'Email address for the contact.',
},
{
displayName: 'Email Bounced Date',
name: 'emailBouncedDate',
type: 'dateTime',
default: '',
description: 'If bounce management is activated and an email sent to the contact bounces, the date and time the bounce occurred.',
},
{
displayName: 'Email Bounced Reason',
name: 'emailBouncedReason',
type: 'string',
default: '',
description: 'If bounce management is activated and an email sent to the contact bounces, the reason the bounce occurred.',
},
{
displayName: 'Fax',
name: 'fax',
type: 'string',
default: '',
description: 'Fax number for the contact. Label is Business Fax.',
},
{
displayName: 'First Name',
name: 'firstName',
type: 'string',
default: '',
description: 'First name of the contact. Maximum size is 40 characters.',
},
{
displayName: 'Home Phone',
name: 'homePhone',
type: 'string',
default: '',
description: 'Home telephone number for the contact.',
},
{
displayName: 'Jigsaw',
name: 'jigsaw',
type: 'string',
default: '',
description: `references the ID of a contact in Data.com.
If a contact has a value in this field, it means that a contact was imported as a contact from Data.com.`,
},
{
displayName: 'Lead Source',
name: 'leadSource',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getLeadSources',
},
default: '',
description: 'Source from which the lead was obtained.',
},
{
displayName: 'Mailing City',
name: 'mailingCity',
type: 'string',
default: '',
},
{
displayName: 'Mailing Country',
name: 'mailingCountry',
type: 'string',
default: '',
},
{
displayName: 'Mailing State',
name: 'mailingState',
type: 'string',
default: '',
},
{
displayName: 'Mailing Street',
name: 'mailingStreet',
type: 'string',
default: '',
description: 'Street address for mailing address.',
},
{
displayName: 'Mailing Postal Code',
name: 'mailingPostalCode',
type: 'string',
default: '',
},
{
displayName: 'Mobile Phone',
name: 'mobilePhone',
type: 'string',
default: '',
description: `Contacts mobile phone number.`,
},
{
displayName: 'Other City',
name: 'otherCity',
type: 'string',
default: '',
},
{
displayName: 'Other Country',
name: 'otherCountry',
type: 'string',
default: '',
},
{
displayName: 'Other Phone',
name: 'otherPhone',
type: 'string',
default: '',
description: 'Telephone for alternate address.',
},
{
displayName: 'Other Postal Code',
name: 'otherPostalCode',
type: 'string',
default: '',
},
{
displayName: 'Other State',
name: 'otherState',
type: 'string',
default: '',
},
{
displayName: 'Other Street',
name: 'otherStreet',
type: 'string',
default: '',
description: 'Street for alternate address.',
},
{
displayName: 'Owner',
name: 'owner',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
default: '',
description: 'The owner of the contact.',
},
{
displayName: 'Phone',
name: 'phone',
type: 'string',
default: '',
description: 'Phone number for the contact.',
},
{
displayName: 'Salutation',
name: 'salutation',
type: 'string',
default: '',
description: 'Honorific abbreviation, word, or phrase to be used in front of name in greetings, such as Dr. or Mrs.',
},
{
displayName: 'Title',
name: 'title',
type: 'string',
default: '',
description: 'Title of the contact such as CEO or Vice President.',
},
],
},
/* -------------------------------------------------------------------------- */
/* contact:get */
/* -------------------------------------------------------------------------- */
{
displayName: 'Contact ID',
name: 'contactId',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'contact',
],
operation: [
'get',
]
},
},
description: 'Id of contact that needs to be fetched',
},
/* -------------------------------------------------------------------------- */
/* contact:delete */
/* -------------------------------------------------------------------------- */
{
displayName: 'Contact ID',
name: 'contactId',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'contact',
],
operation: [
'delete',
]
},
},
description: 'Id of contact that needs to be fetched',
},
/* -------------------------------------------------------------------------- */
/* contact:getAll */
/* -------------------------------------------------------------------------- */
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
resource: [
'contact',
],
operation: [
'getAll',
],
},
},
default: false,
description: 'If all results should be returned or only up to a given limit.',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
displayOptions: {
show: {
resource: [
'contact',
],
operation: [
'getAll',
],
returnAll: [
false,
],
},
},
typeOptions: {
minValue: 1,
maxValue: 100,
},
default: 50,
description: 'How many results to return.',
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'contact',
],
operation: [
'getAll',
],
},
},
options: [
{
displayName: 'Fields',
name: 'fields',
type: 'string',
default: '',
description: 'Fields to include separated by ,',
},
]
},
/* -------------------------------------------------------------------------- */
/* contact:addToCampaign */
/* -------------------------------------------------------------------------- */
{
displayName: 'Contact ID',
name: 'contactId',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'contact',
],
operation: [
'addToCampaign',
]
},
},
description: 'Id of contact that needs to be fetched',
},
{
displayName: 'Campaign',
name: 'campaignId',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getCampaigns',
},
required: true,
default: '',
displayOptions: {
show: {
resource: [
'contact',
],
operation: [
'addToCampaign',
]
},
},
description: 'Id of the campaign that needs to be fetched',
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'contact',
],
operation: [
'addToCampaign',
],
},
},
options: [
{
displayName: 'Status',
name: 'status',
type: 'string',
default: '',
description: 'Controls the HasResponded flag on this object',
},
]
},
/* -------------------------------------------------------------------------- */
/* contact:addNote */
/* -------------------------------------------------------------------------- */
{
displayName: 'Contact ID',
name: 'contactId',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'contact',
],
operation: [
'addNote',
]
},
},
description: 'Id of contact that needs to be fetched',
},
{
displayName: 'Title',
name: 'title',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'contact',
],
operation: [
'addNote',
]
},
},
description: 'Title of the note.',
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'contact',
],
operation: [
'addNote',
],
},
},
options: [
{
displayName: 'Body',
name: 'body',
type: 'string',
default: '',
typeOptions: {
alwaysOpenEditWindow: true,
},
description: 'Body of the note. Limited to 32 KB.',
},
{
displayName: 'Is Private',
name: 'isPrivate',
type: 'boolean',
default: false,
description: 'If true, only the note owner or a user with the “Modify All Data” permission can view the note or query it via the API',
},
{
displayName: 'Owner',
name: 'owner',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
default: '',
description: 'ID of the user who owns the note.',
},
]
},
] as INodeProperties[];

View file

@ -0,0 +1,34 @@
export interface IContact {
LastName?: string;
Fax?: string;
Email?: string;
Phone?: string;
Title?: string;
Jigsaw?: string;
OwnerId?: string;
AccountId?: string;
Birthdate?:string;
FirstName?: string;
HomePhone?: string;
OtherCity?: string;
Department?: string;
LeadSource?: string;
OtherPhone?: string;
OtherState?: string;
Salutation?: string;
Description?: string;
MailingCity?: string;
MobilePhone?: string;
OtherStreet?: string;
MailingState?: string;
OtherCountry?: string;
AssistantName?: string;
MailingStreet?: string;
AssistantPhone?: string;
MailingCountry?: string;
OtherPostalCode?: string;
MailingPostalCode?: string;
EmailBouncedDate?: string;
EmailBouncedReason?: string;
}

View file

@ -0,0 +1,50 @@
import { OptionsWithUri } from 'request';
import {
IExecuteFunctions,
IExecuteSingleFunctions,
ILoadOptionsFunctions,
} from 'n8n-core';
import {
IDataObject
} from 'n8n-workflow';
export async function salesforceApiRequest(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
const credentials = this.getCredentials('salesforceOAuth2Api');
const subdomain = (credentials!.accessTokenUrl as string).split('.')[0].split('/')[2];
const options: OptionsWithUri = {
method,
body,
qs,
uri: uri || `https://${subdomain}.salesforce.com/services/data/v39.0${resource}`,
json: true
};
try {
//@ts-ignore
return await this.helpers.requestOAuth.call(this, 'salesforceOAuth2Api', options);
} catch (error) {
if (error.response && error.response.body && error.response.body[0] && error.response.body[0].message) {
// Try to return the error prettier
throw new Error(`Salesforce error response [${error.statusCode}]: ${error.response.body[0].message}`);
}
throw error;
}
}
export async function salesforceApiRequestAllItems(this: IExecuteFunctions | ILoadOptionsFunctions, propertyName: string ,method: string, endpoint: string, body: any = {}, query: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
const returnData: IDataObject[] = [];
let responseData;
let uri: string | undefined;
do {
responseData = await salesforceApiRequest.call(this, method, endpoint, body, query, uri);
uri = responseData.nextRecordsUrl;
returnData.push.apply(returnData, responseData[propertyName]);
} while (
responseData.nextRecordsUrl !== undefined &&
responseData.nextRecordsUrl !== null
);
return returnData;
}

View file

@ -0,0 +1,762 @@
import { INodeProperties } from 'n8n-workflow';
export const leadOperations = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
displayOptions: {
show: {
resource: [
'lead',
],
},
},
options: [
{
name: 'Add Lead To Campaign',
value: 'addToCampaign',
description: 'Add lead to a campaign',
},
{
name: 'Add Note',
value: 'addNote',
description: 'Add note to a lead',
},
{
name: 'Create',
value: 'create',
description: 'Create a lead',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a lead',
},
{
name: 'Get',
value: 'get',
description: 'Get a lead',
},
{
name: 'Get All',
value: 'getAll',
description: 'Get all leads',
},
{
name: 'Get Summary',
value: 'getSummary',
description: `Returns an overview of Lead's metadata.`,
},
{
name: 'Update',
value: 'update',
description: 'Update a lead',
},
],
default: 'create',
description: 'The operation to perform.',
},
] as INodeProperties[];
export const leadFields = [
/* -------------------------------------------------------------------------- */
/* lead:create */
/* -------------------------------------------------------------------------- */
{
displayName: 'Company',
name: 'company',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'lead',
],
operation: [
'create',
]
},
},
description: 'Company of the lead. If person account record types have been enabled, and if the value of Company is null, the lead converts to a person account.',
},
{
displayName: 'Last Name',
name: 'lastname',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'lead',
],
operation: [
'create',
]
},
},
description: 'Required. Last name of the lead. Limited to 80 characters.',
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'lead',
],
operation: [
'create',
],
},
},
options: [
{
displayName: 'Annual Revenue',
name: 'annualRevenue',
type: 'number',
typeOptions: {
numberPrecision: 2,
numberStepSize: 1,
},
default: '',
description: 'Annual revenue for the company of the lead.',
},
{
displayName: 'City',
name: 'city',
type: 'string',
default: '',
description: 'City for the address of the lead.',
},
{
displayName: 'Description',
name: 'description',
type: 'string',
typeOptions: {
alwaysOpenEditWindow: true,
},
default: '',
description: 'Description of the lead.',
},
{
displayName: 'Email',
name: 'email',
type: 'string',
default: '',
description: 'Email address for the lead.',
},
{
displayName: 'Fist Name',
name: 'firstname',
type: 'string',
default: '',
description: 'First name of the lead. Limited to 40 characters.',
},
{
displayName: 'Industry',
name: 'industry',
type: 'string',
default: '',
description: 'Website for the lead.',
},
{
displayName: 'Is Unread By Owner',
name: 'IsUnreadByOwner',
type: 'Boolean',
default: false,
description: 'If true, lead has been assigned, but not yet viewed. See Unread Leads for more information. Label is Unread By Owner.',
},
{
displayName: 'Jigsaw',
name: 'jigsaw',
type: 'string',
default: '',
description: `references the ID of a contact in Data.com.
If a lead has a value in this field, it means that a contact was imported as a lead from Data.com.`,
},
{
displayName: 'Lead Source',
name: 'leadSource',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getLeadSources',
},
default: '',
description: 'Source from which the lead was obtained.',
},
{
displayName: 'Number Of Employees',
name: 'numberOfEmployees',
type: 'number',
typeOptions: {
numberStepSize: 1,
},
default: '',
description: 'Number of employees at the leads company. Label is Employees.',
},
{
displayName: 'Owner',
name: 'owner',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
default: '',
description: 'The owner of the lead.',
},
{
displayName: 'Phone',
name: 'phone',
type: 'string',
default: '',
description: 'Phone number for the lead.',
},
{
displayName: 'Postal Code',
name: 'postalCode',
type: 'string',
default: '',
description: 'Postal code for the address of the lead. Label is Zip/Postal Code.',
},
{
displayName: 'Rating',
name: 'rating',
type: 'string',
default: '',
description: 'Rating of the lead.',
},
{
displayName: 'Salutation',
name: 'salutation',
type: 'string',
default: '',
description: 'Salutation for the lead.',
},
{
displayName: 'State',
name: 'state',
type: 'string',
default: '',
description: 'State for the address of the lead.',
},
{
displayName: 'Status',
name: 'status',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getLeadStatuses',
},
default: '',
description: 'Status code for this converted lead.',
},
{
displayName: 'Street',
name: 'street',
type: 'string',
default: '',
description: 'Street number and name for the address of the lead',
},
{
displayName: 'Title',
name: 'title',
type: 'string',
default: '',
description: 'Title for the lead, for example CFO or CEO.',
},
{
displayName: 'Website',
name: 'website',
type: 'string',
default: '',
description: 'Website for the lead.',
},
]
},
/* -------------------------------------------------------------------------- */
/* lead:update */
/* -------------------------------------------------------------------------- */
{
displayName: 'Lead ID',
name: 'leadId',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'lead',
],
operation: [
'update',
]
},
},
description: 'Id of Lead that needs to be fetched',
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'lead',
],
operation: [
'update',
],
},
},
options: [
{
displayName: 'Annual Revenue',
name: 'annualRevenue',
type: 'number',
typeOptions: {
numberPrecision: 2,
numberStepSize: 1,
},
default: '',
description: 'Annual revenue for the company of the lead.',
},
{
displayName: 'City',
name: 'city',
type: 'string',
default: '',
description: 'City for the address of the lead.',
},
{
displayName: 'Company',
name: 'company',
type: 'string',
default: '',
description: 'Company of the lead. If person account record types have been enabled, and if the value of Company is null, the lead converts to a person account.',
},
{
displayName: 'Description',
name: 'description',
type: 'string',
typeOptions: {
alwaysOpenEditWindow: true,
},
default: '',
description: 'Description of the lead.',
},
{
displayName: 'Email',
name: 'email',
type: 'string',
default: '',
description: 'Email address for the lead.',
},
{
displayName: 'Fist Name',
name: 'firstname',
type: 'string',
default: '',
description: 'First name of the lead. Limited to 40 characters.',
},
{
displayName: 'Industry',
name: 'industry',
type: 'string',
default: '',
description: 'Website for the lead.',
},
{
displayName: 'Is Unread By Owner',
name: 'IsUnreadByOwner',
type: 'Boolean',
default: false,
description: 'If true, lead has been assigned, but not yet viewed. See Unread Leads for more information. Label is Unread By Owner.',
},
{
displayName: 'Jigsaw',
name: 'jigsaw',
type: 'string',
default: '',
description: `references the ID of a contact in Data.com.
If a lead has a value in this field, it means that a contact was imported as a lead from Data.com.`,
},
{
displayName: 'Last Name',
name: 'lastname',
type: 'string',
default: '',
description: 'Required. Last name of the lead. Limited to 80 characters.',
},
{
displayName: 'Lead Source',
name: 'leadSource',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getLeadSources',
},
default: '',
description: 'Source from which the lead was obtained.',
},
{
displayName: 'Number Of Employees',
name: 'numberOfEmployees',
type: 'number',
typeOptions: {
numberStepSize: 1,
},
default: '',
description: 'Number of employees at the leads company. Label is Employees.',
},
{
displayName: 'Owner',
name: 'owner',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
default: '',
description: 'The owner of the lead.',
},
{
displayName: 'Postal Code',
name: 'postalCode',
type: 'string',
default: '',
description: 'Postal code for the address of the lead. Label is Zip/Postal Code.',
},
{
displayName: 'Phone',
name: 'phone',
type: 'string',
default: '',
description: 'Phone number for the lead.',
},
{
displayName: 'Rating',
name: 'rating',
type: 'string',
default: '',
description: 'Rating of the lead.',
},
{
displayName: 'Salutation',
name: 'salutation',
type: 'string',
default: '',
description: 'Salutation for the lead.',
},
{
displayName: 'State',
name: 'state',
type: 'string',
default: '',
description: 'State for the address of the lead.',
},
{
displayName: 'Status',
name: 'status',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getLeadStatuses',
},
default: '',
description: 'Status code for this converted lead.',
},
{
displayName: 'Street',
name: 'street',
type: 'string',
default: '',
description: 'Street number and name for the address of the lead',
},
{
displayName: 'Title',
name: 'title',
type: 'string',
default: '',
description: 'Title for the lead, for example CFO or CEO.',
},
{
displayName: 'Website',
name: 'website',
type: 'string',
default: '',
description: 'Website for the lead.',
},
]
},
/* -------------------------------------------------------------------------- */
/* lead:get */
/* -------------------------------------------------------------------------- */
{
displayName: 'Lead ID',
name: 'leadId',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'lead',
],
operation: [
'get',
]
},
},
description: 'Id of Lead that needs to be fetched',
},
/* -------------------------------------------------------------------------- */
/* lead:delete */
/* -------------------------------------------------------------------------- */
{
displayName: 'Lead ID',
name: 'leadId',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'lead',
],
operation: [
'delete',
]
},
},
description: 'Id of Lead that needs to be fetched',
},
/* -------------------------------------------------------------------------- */
/* lead:getAll */
/* -------------------------------------------------------------------------- */
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
resource: [
'lead',
],
operation: [
'getAll',
],
},
},
default: false,
description: 'If all results should be returned or only up to a given limit.',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
displayOptions: {
show: {
resource: [
'lead',
],
operation: [
'getAll',
],
returnAll: [
false,
],
},
},
typeOptions: {
minValue: 1,
maxValue: 100,
},
default: 50,
description: 'How many results to return.',
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'lead',
],
operation: [
'getAll',
],
},
},
options: [
{
displayName: 'Fields',
name: 'fields',
type: 'string',
default: '',
description: 'Fields to include separated by ,',
},
]
},
/* -------------------------------------------------------------------------- */
/* contact:addToCampaign */
/* -------------------------------------------------------------------------- */
{
displayName: 'Lead ID',
name: 'leadId',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'lead',
],
operation: [
'addToCampaign',
]
},
},
description: 'Id of contact that needs to be fetched',
},
{
displayName: 'Campaign',
name: 'campaignId',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getCampaigns',
},
required: true,
default: '',
displayOptions: {
show: {
resource: [
'lead',
],
operation: [
'addToCampaign',
]
},
},
description: 'Id of the campaign that needs to be fetched',
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'lead',
],
operation: [
'addToCampaign',
],
},
},
options: [
{
displayName: 'Status',
name: 'status',
type: 'string',
default: '',
description: 'Controls the HasResponded flag on this object',
},
]
},
/* -------------------------------------------------------------------------- */
/* lead:addNote */
/* -------------------------------------------------------------------------- */
{
displayName: 'Lead ID',
name: 'leadId',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'lead',
],
operation: [
'addNote',
]
},
},
description: 'Id of lead that needs to be fetched',
},
{
displayName: 'Title',
name: 'title',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'lead',
],
operation: [
'addNote',
]
},
},
description: 'Title of the note.',
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'lead',
],
operation: [
'addNote',
],
},
},
options: [
{
displayName: 'Body',
name: 'body',
type: 'string',
default: '',
typeOptions: {
alwaysOpenEditWindow: true,
},
description: 'Body of the note. Limited to 32 KB.',
},
{
displayName: 'Is Private',
name: 'isPrivate',
type: 'boolean',
default: false,
description: 'If true, only the note owner or a user with the “Modify All Data” permission can view the note or query it via the API',
},
{
displayName: 'Owner',
name: 'owner',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
default: '',
description: 'ID of the user who owns the note.',
},
]
},
] as INodeProperties[];

View file

@ -0,0 +1,26 @@
export interface ILead {
Company?: string;
LastName?: string;
Email?: string;
City?: string;
Phone?: string;
State?: string;
Title?: string;
Jigsaw?: string;
Rating?: string;
Status?: string;
Street?: string;
Country?: string;
OwnerId?: string;
Website?: string;
Industry?: string;
FirstName?: string;
LeadSource?: string;
PostalCode?: string;
Salutation?: string;
Description?: string;
AnnualRevenue?: number;
IsUnreadByOwner?: boolean;
NumberOfEmployees?: number;
}

View file

@ -0,0 +1,8 @@
export interface INote {
Title?: string;
ParentId?: string;
Body?: string;
OwnerId?: string;
IsPrivate?: boolean;
}

View file

@ -0,0 +1,625 @@
import { INodeProperties } from 'n8n-workflow';
export const opportunityOperations = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
displayOptions: {
show: {
resource: [
'opportunity',
],
},
},
options: [
{
name: 'Add Note',
value: 'addNote',
description: 'Add note to an opportunity',
},
{
name: 'Create',
value: 'create',
description: 'Create an opportunity',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete an opportunity',
},
{
name: 'Get',
value: 'get',
description: 'Get an opportunity',
},
{
name: 'Get All',
value: 'getAll',
description: 'Get all opportunitys',
},
{
name: 'Get Summary',
value: 'getSummary',
description: `Returns an overview of opportunity's metadata.`,
},
{
name: 'Update',
value: 'update',
description: 'Update an opportunity',
},
],
default: 'create',
description: 'The operation to perform.',
},
] as INodeProperties[];
export const opportunityFields = [
/* -------------------------------------------------------------------------- */
/* opportunity:create */
/* -------------------------------------------------------------------------- */
{
displayName: 'Name',
name: 'name',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'opportunity',
],
operation: [
'create',
]
},
},
description: 'Required. Last name of the opportunity. Limited to 80 characters.',
},
{
displayName: 'Close Date',
name: 'closeDate',
type: 'dateTime',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'opportunity',
],
operation: [
'create',
]
},
},
description: 'Required. Date when the opportunity is expected to close.',
},
{
displayName: 'Stage Name',
name: 'stageName',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getStages'
},
required: true,
default: '',
displayOptions: {
show: {
resource: [
'opportunity',
],
operation: [
'create',
]
},
},
description: 'Required. Date when the opportunity is expected to close.',
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'opportunity',
],
operation: [
'create',
],
},
},
options: [
{
displayName: 'Account',
name: 'accountId',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getAccounts',
},
description: 'ID of the account associated with this opportunity.',
},
{
displayName: 'Amount',
name: 'amount',
type: 'number',
typeOptions: {
numberPrecision: 2,
},
default: '',
description: 'Estimated total sale amount',
},
{
displayName: 'Campaign',
name: 'campaignId',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getCampaigns',
},
default: '',
description: 'Id of the campaign that needs to be fetched',
},
{
displayName: 'Description',
name: 'description',
type: 'string',
default: '',
description: 'A description of the opportunity. Label is Contact Description. Limit: 32 KB.',
},
{
displayName: 'Forecast Category Name',
name: 'forecastCategoryName',
type: 'string',
default: '',
description: 'It is implied, but not directly controlled, by the StageName field',
},
{
displayName: 'Lead Source',
name: 'leadSource',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getLeadSources',
},
default: '',
description: 'Source from which the lead was obtained.',
},
{
displayName: 'Next Step',
name: 'nextStep',
type: 'string',
default: '',
description: 'Description of next task in closing opportunity. Limit: 255 characters.',
},
{
displayName: 'Owner',
name: 'owner',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
default: '',
description: 'The owner of the opportunity.',
},
{
displayName: 'Phone',
name: 'phone',
type: 'string',
default: '',
description: 'Phone number for the opportunity.',
},
{
displayName: 'Pricebook2 Id',
name: 'pricebook2Id',
type: 'string',
default: '',
description: 'ID of a related Pricebook2 object',
},
{
displayName: 'Probability',
name: 'probability',
type: 'number',
typeOptions: {
numberPrecision: 1,
},
default: '',
description: 'Percentage of estimated confidence in closing the opportunity',
},
{
displayName: 'Type',
name: 'type',
type: 'options',
default: '',
options: [
{
name: 'Business',
valie: 'Business',
},
{
name: 'New Business',
valie: 'New Business',
},
],
description: 'Type of opportunity. For example, Existing Business or New Business. Label is Opportunity Type.',
},
],
},
/* -------------------------------------------------------------------------- */
/* opportunity:update */
/* -------------------------------------------------------------------------- */
{
displayName: 'Opportunity ID',
name: 'opportunityId',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'opportunity',
],
operation: [
'update',
]
},
},
description: 'Id of opportunity that needs to be fetched',
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'opportunity',
],
operation: [
'update',
],
},
},
options: [
{
displayName: 'Account',
name: 'accountId',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getAccounts',
},
description: 'ID of the account associated with this opportunity.',
},
{
displayName: 'Amount',
name: 'amount',
type: 'number',
typeOptions: {
numberPrecision: 2,
},
default: '',
description: 'Estimated total sale amount',
},
{
displayName: 'Campaign',
name: 'campaignId',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getCampaigns',
},
default: '',
description: 'Id of the campaign that needs to be fetched',
},
{
displayName: 'Close Date',
name: 'closeDate',
type: 'dateTime',
default: '',
description: 'Required. Date when the opportunity is expected to close.',
},
{
displayName: 'Description',
name: 'description',
type: 'string',
default: '',
description: 'A description of the opportunity. Label is Contact Description. Limit: 32 KB.',
},
{
displayName: 'Forecast Category Name',
name: 'forecastCategoryName',
type: 'string',
default: '',
description: 'It is implied, but not directly controlled, by the StageName field',
},
{
displayName: 'Lead Source',
name: 'leadSource',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getLeadSources',
},
default: '',
description: 'Source from which the lead was obtained.',
},
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
description: 'Required. Last name of the opportunity. Limited to 80 characters.',
},
{
displayName: 'Next Step',
name: 'nextStep',
type: 'string',
default: '',
description: 'Description of next task in closing opportunity. Limit: 255 characters.',
},
{
displayName: 'Owner',
name: 'owner',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
default: '',
description: 'The owner of the opportunity.',
},
{
displayName: 'Phone',
name: 'phone',
type: 'string',
default: '',
description: 'Phone number for the opportunity.',
},
{
displayName: 'Pricebook2 Id',
name: 'pricebook2Id',
type: 'string',
default: '',
description: 'ID of a related Pricebook2 object',
},
{
displayName: 'Probability',
name: 'probability',
type: 'number',
typeOptions: {
numberPrecision: 1,
},
default: '',
description: 'Percentage of estimated confidence in closing the opportunity',
},
{
displayName: 'Stage Name',
name: 'stageName',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getStages'
},
default: '',
description: 'Required. Date when the opportunity is expected to close.',
},
{
displayName: 'Type',
name: 'type',
type: 'options',
default: '',
options: [
{
name: 'Business',
valie: 'Business',
},
{
name: 'New Business',
valie: 'New Business',
},
],
description: 'Type of opportunity. For example, Existing Business or New Business. Label is Opportunity Type.',
},
],
},
/* -------------------------------------------------------------------------- */
/* opportunity:get */
/* -------------------------------------------------------------------------- */
{
displayName: 'Opportunity ID',
name: 'opportunityId',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'opportunity',
],
operation: [
'get',
]
},
},
description: 'Id of opportunity that needs to be fetched',
},
/* -------------------------------------------------------------------------- */
/* opportunity:delete */
/* -------------------------------------------------------------------------- */
{
displayName: 'Opportunity ID',
name: 'opportunityId',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'opportunity',
],
operation: [
'delete',
]
},
},
description: 'Id of opportunity that needs to be fetched',
},
/* -------------------------------------------------------------------------- */
/* opportunity:getAll */
/* -------------------------------------------------------------------------- */
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
resource: [
'opportunity',
],
operation: [
'getAll',
],
},
},
default: false,
description: 'If all results should be returned or only up to a given limit.',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
displayOptions: {
show: {
resource: [
'opportunity',
],
operation: [
'getAll',
],
returnAll: [
false,
],
},
},
typeOptions: {
minValue: 1,
maxValue: 100,
},
default: 50,
description: 'How many results to return.',
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'opportunity',
],
operation: [
'getAll',
],
},
},
options: [
{
displayName: 'Fields',
name: 'fields',
type: 'string',
default: '',
description: 'Fields to include separated by ,',
},
]
},
/* -------------------------------------------------------------------------- */
/* opportunity:addNote */
/* -------------------------------------------------------------------------- */
{
displayName: 'Opportunity ID',
name: 'opportunityId',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'opportunity',
],
operation: [
'addNote',
]
},
},
description: 'Id of opportunity that needs to be fetched',
},
{
displayName: 'Title',
name: 'title',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'opportunity',
],
operation: [
'addNote',
]
},
},
description: 'Title of the note.',
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'opportunity',
],
operation: [
'addNote',
],
},
},
options: [
{
displayName: 'Body',
name: 'body',
type: 'string',
default: '',
typeOptions: {
alwaysOpenEditWindow: true,
},
description: 'Body of the note. Limited to 32 KB.',
},
{
displayName: 'Is Private',
name: 'isPrivate',
type: 'boolean',
default: false,
description: 'If true, only the note owner or a user with the “Modify All Data” permission can view the note or query it via the API',
},
{
displayName: 'Owner',
name: 'owner',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
default: '',
description: 'ID of the user who owns the note.',
},
]
},
] as INodeProperties[];

View file

@ -0,0 +1,17 @@
export interface IOpportunity {
Name?: string;
StageName?: string;
CloseDate?: string;
Type?: string;
Amount?: number;
OwnerId?: string;
NextStep?: string;
AccountId?: string;
CampaignId?: string;
LeadSource?: string;
Description?: string;
Probability?: number;
Pricebook2Id?:string;
ForecastCategoryName?: string;
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,810 @@
import { INodeProperties } from 'n8n-workflow';
export const taskOperations = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
displayOptions: {
show: {
resource: [
'task',
],
},
},
options: [
{
name: 'Create',
value: 'create',
description: 'Create a task',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a task',
},
{
name: 'Get',
value: 'get',
description: 'Get a task',
},
{
name: 'Get All',
value: 'getAll',
description: 'Get all tasks',
},
{
name: 'Get Summary',
value: 'getSummary',
description: `Returns an overview of task's metadata.`,
},
{
name: 'Update',
value: 'update',
description: 'Update a task',
},
],
default: 'create',
description: 'The operation to perform.',
},
] as INodeProperties[];
export const taskFields = [
/* -------------------------------------------------------------------------- */
/* task:create */
/* -------------------------------------------------------------------------- */
{
displayName: 'Status',
name: 'status',
type: 'options',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'task',
],
operation: [
'create',
],
},
},
typeOptions: {
loadOptionsMethod: 'getTaskStatuses',
},
description: 'The current status of the task, such as In Progress or Completed.',
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'task',
],
operation: [
'create',
],
},
},
options: [
{
displayName: 'Activity Date',
name: 'activityDate',
type: 'dateTime',
default: '',
description: `Represents the due date of the task.<br/>
This field has a timestamp that is always set to midnight <br/>
in the Coordinated Universal Time (UTC) time zone.`,
},
{
displayName: 'Call Disposition',
name: 'callDisposition',
type: 'string',
typeOptions: {
alwaysOpenEditWindow: true,
},
default: '',
description: `Represents the result of a given call, for example, “we'll call back,” or “call<br/>
unsuccessful. Limit is 255 characters. Not subject to field-level security, available for any user<br/>
in an organization with Salesforce CRM Call Center.`,
},
{
displayName: 'Call Duration In Seconds',
name: 'callDurationInSeconds',
type: 'number',
default: '',
description: `Duration of the call in seconds. Not subject to field-level security,<br/>
available for any user in an organization with Salesforce CRM Call Cente`,
},
{
displayName: 'Call Object',
name: 'callObject',
type: 'string',
typeOptions: {
alwaysOpenEditWindow: true,
},
default: '',
description: `Name of a call center. Limit is 255 characters. <br/>
Not subject to field-level security, available for any user in an <br/>
organization with Salesforce CRM Call Center.`,
},
{
displayName: 'Call Type',
name: 'callType',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getTaskCallTypes',
},
description: 'The type of call being answered: Inbound, Internal, or Outbound.',
},
{
displayName: 'Description',
name: 'description',
type: 'string',
default: '',
typeOptions: {
alwaysOpenEditWindow: true,
},
description: 'Contains a text description of the task.',
},
{
displayName: 'Is ReminderSet',
name: 'isReminderSet',
type: 'boolean',
default: false,
description: 'Indicates whether a popup reminder has been set for the task (true) or not (false).',
},
{
displayName: 'Owner',
name: 'owner',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
default: '',
description: 'ID of the User who owns the record.',
},
{
displayName: 'Priority',
name: 'priority',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getTaskPriorities',
},
description: `Indicates the importance or urgency of a task, such as high or low.`,
},
{
displayName: 'Recurrence Type',
name: 'recurrenceType',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getTaskRecurrenceTypes'
},
description: 'Recurrence Type of the task.',
},
{
displayName: 'Recurrence Instance',
name: 'recurrenceInstance',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getTaskRecurrenceInstances',
},
default: '',
description: `The frequency of the recurring task. For example, “2nd” or “3rd.”`,
},
{
displayName: 'Recurrence Interval',
name: 'recurrenceInterval',
type: 'number',
default: '',
description: 'The interval between recurring tasks.',
},
{
displayName: 'Recurrence Day Of Month',
name: 'recurrenceDayOfMonth',
type: 'number',
default: '',
description: 'The day of the month in which the task repeats.',
},
{
displayName: 'Recurrence Day Of Week Mask',
name: 'recurrenceDayOfWeekMask',
type: 'number',
default: '',
description: `The day or days of the week on which the task repeats.<br/>
This field contains a bitmask. The values are as follows: Sunday = 1 Monday = 2<br/>
Tuesday = 4 Wednesday = 8 Thursday = 16 Friday = 32 Saturday = 64<br/>
Multiple days are represented as the sum of their numerical values.<br/>
For example, Tuesday and Thursday = 4 + 16 = 20.`,
},
{
displayName: 'Recurrence End Date Only',
name: 'recurrenceEndDateOnly',
type: 'dateTime',
default: '',
description: `The last date on which the task repeats. This field has a timestamp that<br/>
is always set to midnight in the Coordinated Universal Time (UTC) time zone.`,
},
{
displayName: 'Recurrence Month Of Year',
name: 'recurrenceMonthOfYear',
type: 'options',
options: [
{
name: 'January',
value: 'January'
},
{
name: 'February',
value: 'February'
},
{
name: 'March',
value: 'March'
},
{
name: 'April',
value: 'April'
},
{
name: 'May',
value: 'May'
},
{
name: 'June',
value: 'June'
},
{
name: 'July',
value: 'July'
},
{
name: 'August',
value: 'August'
},
{
name: 'September',
value: 'September'
},
{
name: 'October',
value: 'October'
},
{
name: 'November',
value: 'November'
},
{
name: 'December',
value: 'December'
}
],
default: '',
description: 'The month of the year in which the task repeats.',
},
{
displayName: 'Recurrence Regenerated Type',
name: 'recurrenceRegeneratedType',
type: 'options',
default: '',
options: [
{
name: 'After due date',
value: 'RecurrenceRegenerateAfterDueDate'
},
{
name: 'After date completed',
value: 'RecurrenceRegenerateAfterToday'
},
{
name: '(Task Closed)',
value: 'RecurrenceRegenerated'
}
],
description: `Represents what triggers a repeating task to repeat.<br/>
Add this field to a page layout together with the RecurrenceInterval field,<br/>
which determines the number of days between the triggering date (due date or close date)<br/>
and the due date of the next repeating task in the series.Label is Repeat This Task.`,
},
{
displayName: 'Recurrence Start Date Only',
name: 'recurrenceEndDateOnly',
type: 'dateTime',
default: '',
description: `The date when the recurring task begins.<br/>
Must be a date and time before RecurrenceEndDateOnly.`,
},
{
displayName: 'Recurrence TimeZone SidKey',
name: 'recurrenceTimeZoneSidKey',
type: 'string',
default: '',
description: `The time zone associated with the recurring task.<br/>
For example, UTC-8:00 for Pacific Standard Time.`,
},
{
displayName: 'Reminder Date Time',
name: 'reminderDateTime',
type: 'dateTime',
default: '',
description: `Represents the time when the reminder is scheduled to fire,<br/>
if IsReminderSet is set to true. If IsReminderSet is set to false, then the<br/>
user may have deselected the reminder checkbox in the Salesforce user interface,<br/>
or the reminder has already fired at the time indicated by the value.`,
},
{
displayName: 'Subject',
name: 'subject',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getTaskSubjects',
},
description: 'The subject line of the task, such as “Call” or “Send Quote.” Limit: 255 characters.',
},
{
displayName: 'What Id',
name: 'whatId',
type: 'string',
default: '',
description: `The WhatId represents nonhuman objects such as accounts, opportunities,<br/>
campaigns, cases, or custom objects. WhatIds are polymorphic. Polymorphic means a<br/>
WhatId is equivalent to the ID of a related object.`,
},
{
displayName: 'Who Id',
name: 'whoId',
type: 'string',
default: '',
description: `The WhoId represents a human such as a lead or a contact.<br/>
WhoIds are polymorphic. Polymorphic means a WhoId is equivalent to a contacts ID or a leads ID.`,
},
]
},
/* -------------------------------------------------------------------------- */
/* task:update */
/* -------------------------------------------------------------------------- */
{
displayName: 'Task ID',
name: 'taskId',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'task',
],
operation: [
'update',
]
},
},
description: 'Id of task that needs to be fetched',
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'task',
],
operation: [
'update',
],
},
},
options: [
{
displayName: 'Activity Date',
name: 'activityDate',
type: 'dateTime',
default: '',
description: `Represents the due date of the task.<br/>
This field has a timestamp that is always set to midnight <br/>
in the Coordinated Universal Time (UTC) time zone.`,
},
{
displayName: 'Call Disposition',
name: 'callDisposition',
type: 'string',
typeOptions: {
alwaysOpenEditWindow: true,
},
default: '',
description: `Represents the result of a given call, for example, “we'll call back,” or “call<br/>
unsuccessful. Limit is 255 characters. Not subject to field-level security, available for any user<br/>
in an organization with Salesforce CRM Call Center.`,
},
{
displayName: 'Call Duration In Seconds',
name: 'callDurationInSeconds',
type: 'number',
default: '',
description: `Duration of the call in seconds. Not subject to field-level security,<br/>
available for any user in an organization with Salesforce CRM Call Cente`,
},
{
displayName: 'Call Object',
name: 'callObject',
type: 'string',
typeOptions: {
alwaysOpenEditWindow: true,
},
default: '',
description: `Name of a call center. Limit is 255 characters. <br/>
Not subject to field-level security, available for any user in an <br/>
organization with Salesforce CRM Call Center.`,
},
{
displayName: 'Call Type',
name: 'callType',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getTaskCallTypes',
},
description: 'The type of call being answered: Inbound, Internal, or Outbound.',
},
{
displayName: 'Description',
name: 'description',
type: 'string',
default: '',
typeOptions: {
alwaysOpenEditWindow: true,
},
description: 'Contains a text description of the task.',
},
{
displayName: 'Is ReminderSet',
name: 'isReminderSet',
type: 'boolean',
default: false,
description: 'Indicates whether a popup reminder has been set for the task (true) or not (false).',
},
{
displayName: 'Owner',
name: 'owner',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
default: '',
description: 'ID of the User who owns the record.',
},
{
displayName: 'Priority',
name: 'priority',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getTaskPriorities',
},
description: `Indicates the importance or urgency of a task, such as high or low.`,
},
{
displayName: 'Status',
name: 'status',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getTaskStatuses',
},
description: 'The current status of the task, such as In Progress or Completed.',
},
{
displayName: 'Subject',
name: 'subject',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getTaskSubjects',
},
description: 'The subject line of the task, such as “Call” or “Send Quote.” Limit: 255 characters.',
},
{
displayName: 'Recurrence Day Of Month',
name: 'recurrenceDayOfMonth',
type: 'number',
default: '',
description: 'The day of the month in which the task repeats.',
},
{
displayName: 'Recurrence Day Of Week Mask',
name: 'recurrenceDayOfWeekMask',
type: 'number',
default: '',
description: `The day or days of the week on which the task repeats.<br/>
This field contains a bitmask. The values are as follows: Sunday = 1 Monday = 2<br/>
Tuesday = 4 Wednesday = 8 Thursday = 16 Friday = 32 Saturday = 64<br/>
Multiple days are represented as the sum of their numerical values.<br/>
For example, Tuesday and Thursday = 4 + 16 = 20.`,
},
{
displayName: 'Recurrence End Date Only',
name: 'recurrenceEndDateOnly',
type: 'dateTime',
default: '',
description: `The last date on which the task repeats. This field has a timestamp that<br/>
is always set to midnight in the Coordinated Universal Time (UTC) time zone.`,
},
{
displayName: 'Recurrence Instance',
name: 'recurrenceInstance',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getTaskRecurrenceInstances',
},
default: '',
description: `The frequency of the recurring task. For example, “2nd” or “3rd.”`,
},
{
displayName: 'Recurrence Interval',
name: 'recurrenceInterval',
type: 'number',
default: '',
description: 'The interval between recurring tasks.',
},
{
displayName: 'Recurrence Month Of Year',
name: 'recurrenceMonthOfYear',
type: 'options',
options: [
{
name: 'January',
value: 'January'
},
{
name: 'February',
value: 'February'
},
{
name: 'March',
value: 'March'
},
{
name: 'April',
value: 'April'
},
{
name: 'May',
value: 'May'
},
{
name: 'June',
value: 'June'
},
{
name: 'July',
value: 'July'
},
{
name: 'August',
value: 'August'
},
{
name: 'September',
value: 'September'
},
{
name: 'October',
value: 'October'
},
{
name: 'November',
value: 'November'
},
{
name: 'December',
value: 'December'
}
],
default: '',
description: 'The month of the year in which the task repeats.',
},
{
displayName: 'Recurrence Start Date Only',
name: 'recurrenceEndDateOnly',
type: 'dateTime',
default: '',
description: `The date when the recurring task begins.<br/>
Must be a date and time before RecurrenceEndDateOnly.`,
},
{
displayName: 'Recurrence Regenerated Type',
name: 'recurrenceRegeneratedType',
type: 'options',
default: '',
options: [
{
name: 'After due date',
value: 'RecurrenceRegenerateAfterDueDate'
},
{
name: 'After date completed',
value: 'RecurrenceRegenerateAfterToday'
},
{
name: '(Task Closed)',
value: 'RecurrenceRegenerated'
}
],
description: `Represents what triggers a repeating task to repeat.<br/>
Add this field to a page layout together with the RecurrenceInterval field,<br/>
which determines the number of days between the triggering date (due date or close date)<br/>
and the due date of the next repeating task in the series.Label is Repeat This Task.`,
},
{
displayName: 'Recurrence Type',
name: 'recurrenceType',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getTaskRecurrenceTypes'
},
description: 'Website for the task.',
},
{
displayName: 'Recurrence TimeZone SidKey',
name: 'recurrenceTimeZoneSidKey',
type: 'string',
default: '',
description: `The time zone associated with the recurring task.<br/>
For example, UTC-8:00 for Pacific Standard Time.`,
},
{
displayName: 'Reminder Date Time',
name: 'reminderDateTime',
type: 'dateTime',
default: '',
description: `Represents the time when the reminder is scheduled to fire,<br/>
if IsReminderSet is set to true. If IsReminderSet is set to false, then the<br/>
user may have deselected the reminder checkbox in the Salesforce user interface,<br/>
or the reminder has already fired at the time indicated by the value.`,
},
{
displayName: 'What Id',
name: 'whatId',
type: 'string',
default: '',
description: `The WhatId represents nonhuman objects such as accounts, opportunities,<br/>
campaigns, cases, or custom objects. WhatIds are polymorphic. Polymorphic means a<br/>
WhatId is equivalent to the ID of a related object.`,
},
{
displayName: 'Who Id',
name: 'whoId',
type: 'string',
default: '',
description: `The WhoId represents a human such as a lead or a contact.<br/>
WhoIds are polymorphic. Polymorphic means a WhoId is equivalent to a contacts ID or a leads ID.`,
},
]
},
/* -------------------------------------------------------------------------- */
/* task:get */
/* -------------------------------------------------------------------------- */
{
displayName: 'Task ID',
name: 'taskId',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'task',
],
operation: [
'get',
]
},
},
description: 'Id of task that needs to be fetched',
},
/* -------------------------------------------------------------------------- */
/* task:delete */
/* -------------------------------------------------------------------------- */
{
displayName: 'Task ID',
name: 'taskId',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'task',
],
operation: [
'delete',
]
},
},
description: 'Id of task that needs to be fetched',
},
/* -------------------------------------------------------------------------- */
/* task:getAll */
/* -------------------------------------------------------------------------- */
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
resource: [
'task',
],
operation: [
'getAll',
],
},
},
default: false,
description: 'If all results should be returned or only up to a given limit.',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
displayOptions: {
show: {
resource: [
'task',
],
operation: [
'getAll',
],
returnAll: [
false,
],
},
},
typeOptions: {
minValue: 1,
maxValue: 100,
},
default: 50,
description: 'How many results to return.',
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'task',
],
operation: [
'getAll',
],
},
},
options: [
{
displayName: 'Fields',
name: 'fields',
type: 'string',
default: '',
description: 'Fields to include separated by ,',
},
]
},
] as INodeProperties[];

View file

@ -0,0 +1,27 @@
export interface ITask {
WhoId?: string;
Status?: string;
WhatId?: string;
OwnerId?: string;
Subject?: string;
CallType?: string;
Priority?: string;
CallObject?: string;
Description?: string;
ActivityDate?: string;
IsReminderSet?: boolean;
RecurrenceType?: string;
CallDisposition?:string;
ReminderDateTime?: string;
RecurrenceInstance?: string;
RecurrenceInterval?: number;
RecurrenceDayOfMonth?: number;
CallDurationInSeconds?: number;
RecurrenceEndDateOnly?: string;
RecurrenceMonthOfYear?: string;
RecurrenceDayOfWeekMask?: string;
RecurrenceStartDateOnly?: string;
RecurrenceTimeZoneSidKey?: string;
RecurrenceRegeneratedType?: string;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View file

@ -66,6 +66,7 @@
"dist/credentials/Redis.credentials.js",
"dist/credentials/RocketchatApi.credentials.js",
"dist/credentials/ShopifyApi.credentials.js",
"dist/credentials/SalesforceOAuth2Api.credentials.js",
"dist/credentials/SlackApi.credentials.js",
"dist/credentials/Smtp.credentials.js",
"dist/credentials/StripeApi.credentials.js",
@ -151,6 +152,7 @@
"dist/nodes/ReadPdf.node.js",
"dist/nodes/RenameKeys.node.js",
"dist/nodes/RssFeedRead.node.js",
"dist/nodes/Salesforce/Salesforce.node.js",
"dist/nodes/Set.node.js",
"dist/nodes/SseTrigger.node.js",
"dist/nodes/SplitInBatches.node.js",