mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -08:00
⚡ Add filters to all getAll operations to Salesforce Node (#1292)
* ⚡ Add filters to all get:All operations * ⚡ Small fix * ⚡Add description to condition fields * ⚡ Minor improvements to Salesforce-Node Co-authored-by: Harshil <ghagrawal17@gmail.com> Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
parent
6759e2e72a
commit
63a459ac92
|
@ -104,7 +104,7 @@ export const accountFields = [
|
||||||
loadOptionsMethod: 'getAccountSources',
|
loadOptionsMethod: 'getAccountSources',
|
||||||
},
|
},
|
||||||
default: '',
|
default: '',
|
||||||
description: 'The source of the account record',
|
description: 'The source of the account record.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Annual Revenue',
|
displayName: 'Annual Revenue',
|
||||||
|
@ -209,7 +209,7 @@ export const accountFields = [
|
||||||
name: 'jigsaw',
|
name: 'jigsaw',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
description: 'references the ID of a company in Data.com',
|
description: 'References the ID of a company in Data.com',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Industry',
|
displayName: 'Industry',
|
||||||
|
@ -262,7 +262,7 @@ export const accountFields = [
|
||||||
description: 'Type of account',
|
description: 'Type of account',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Parent Id',
|
displayName: 'Parent ID',
|
||||||
name: 'parentId',
|
name: 'parentId',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
|
@ -312,6 +312,7 @@ export const accountFields = [
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* account:update */
|
/* account:update */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
@ -331,7 +332,7 @@ export const accountFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Id of account that needs to be fetched',
|
description: 'ID of account that needs to be fetched.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Update Fields',
|
displayName: 'Update Fields',
|
||||||
|
@ -358,7 +359,7 @@ export const accountFields = [
|
||||||
loadOptionsMethod: 'getAccountSources',
|
loadOptionsMethod: 'getAccountSources',
|
||||||
},
|
},
|
||||||
default: '',
|
default: '',
|
||||||
description: 'The source of the account record',
|
description: 'The source of the account record.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Annual Revenue',
|
displayName: 'Annual Revenue',
|
||||||
|
@ -470,7 +471,7 @@ export const accountFields = [
|
||||||
name: 'jigsaw',
|
name: 'jigsaw',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
description: 'references the ID of a company in Data.com',
|
description: 'References the ID of a company in Data.com',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Owner',
|
displayName: 'Owner',
|
||||||
|
@ -514,7 +515,7 @@ export const accountFields = [
|
||||||
description: 'Number of employees',
|
description: 'Number of employees',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Parent Id',
|
displayName: 'Parent ID',
|
||||||
name: 'parentId',
|
name: 'parentId',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
|
@ -593,8 +594,9 @@ export const accountFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Id of account that needs to be fetched',
|
description: 'ID of account that needs to be fetched.',
|
||||||
},
|
},
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* account:delete */
|
/* account:delete */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
@ -614,8 +616,9 @@ export const accountFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Id of account that needs to be fetched',
|
description: 'ID of account that needs to be fetched.',
|
||||||
},
|
},
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* account:getAll */
|
/* account:getAll */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
@ -684,8 +687,72 @@ export const accountFields = [
|
||||||
default: '',
|
default: '',
|
||||||
description: 'Fields to include separated by ,',
|
description: 'Fields to include separated by ,',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Conditions',
|
||||||
|
name: 'conditionsUi',
|
||||||
|
placeholder: 'Add Condition',
|
||||||
|
type: 'fixedCollection',
|
||||||
|
typeOptions: {
|
||||||
|
multipleValues: true,
|
||||||
|
},
|
||||||
|
description: 'The condition to set.',
|
||||||
|
default: {},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'conditionValues',
|
||||||
|
displayName: 'Condition',
|
||||||
|
values: [
|
||||||
|
{
|
||||||
|
displayName: 'Field',
|
||||||
|
name: 'field',
|
||||||
|
type: 'options',
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getAccountFields',
|
||||||
|
},
|
||||||
|
default: '',
|
||||||
|
description: 'For date, number, or boolean, please use expressions',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Operation',
|
||||||
|
name: 'operation',
|
||||||
|
type: 'options',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: '=',
|
||||||
|
value: 'equal',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '>',
|
||||||
|
value: '>',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '<',
|
||||||
|
value: '<',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '>=',
|
||||||
|
value: '>=',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '<=',
|
||||||
|
value: '<=',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
default: 'equal',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Value',
|
||||||
|
name: 'value',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* account:addNote */
|
/* account:addNote */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
@ -705,7 +772,7 @@ export const accountFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Id of account that needs to be fetched',
|
description: 'ID of account that needs to be fetched.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Title',
|
displayName: 'Title',
|
||||||
|
|
|
@ -152,6 +152,7 @@ export const attachmentFields = [
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* attachment:update */
|
/* attachment:update */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
@ -171,7 +172,7 @@ export const attachmentFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Id of attachment that needs to be fetched',
|
description: 'ID of attachment that needs to be fetched.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Update Fields',
|
displayName: 'Update Fields',
|
||||||
|
@ -251,8 +252,9 @@ export const attachmentFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Id of attachment that needs to be fetched',
|
description: 'ID of attachment that needs to be fetched.',
|
||||||
},
|
},
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* attachment:delete */
|
/* attachment:delete */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
@ -272,8 +274,9 @@ export const attachmentFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Id of attachment that needs to be fetched',
|
description: 'ID of attachment that needs to be fetched.',
|
||||||
},
|
},
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* attachment:getAll */
|
/* attachment:getAll */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
@ -335,6 +338,69 @@ export const attachmentFields = [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
options: [
|
options: [
|
||||||
|
{
|
||||||
|
displayName: 'Conditions',
|
||||||
|
name: 'conditionsUi',
|
||||||
|
placeholder: 'Add Condition',
|
||||||
|
type: 'fixedCollection',
|
||||||
|
typeOptions: {
|
||||||
|
multipleValues: true,
|
||||||
|
},
|
||||||
|
description: 'The condition to set.',
|
||||||
|
default: {},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'conditionValues',
|
||||||
|
displayName: 'Condition',
|
||||||
|
values: [
|
||||||
|
{
|
||||||
|
displayName: 'Field',
|
||||||
|
name: 'field',
|
||||||
|
type: 'options',
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getAtachmentFields',
|
||||||
|
},
|
||||||
|
default: '',
|
||||||
|
description: 'For date, number, or boolean, please use expressions.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Operation',
|
||||||
|
name: 'operation',
|
||||||
|
type: 'options',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: '=',
|
||||||
|
value: 'equal',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '>',
|
||||||
|
value: '>',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '<',
|
||||||
|
value: '<',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '>=',
|
||||||
|
value: '>=',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '<=',
|
||||||
|
value: '<=',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
default: 'equal',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Value',
|
||||||
|
name: 'value',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Fields',
|
displayName: 'Fields',
|
||||||
name: 'fields',
|
name: 'fields',
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
export interface IAttachment {
|
export interface IAttachment {
|
||||||
ParentId?: string;
|
ParentId?: string;
|
||||||
Name?: string;
|
Name?: string;
|
||||||
|
|
|
@ -36,7 +36,7 @@ export const caseOperations = [
|
||||||
{
|
{
|
||||||
name: 'Get Summary',
|
name: 'Get Summary',
|
||||||
value: 'getSummary',
|
value: 'getSummary',
|
||||||
description: `Returns an overview of case's metadata.`,
|
description: `Returns an overview of case's metadata`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Delete',
|
name: 'Delete',
|
||||||
|
@ -98,18 +98,18 @@ export const caseFields = [
|
||||||
},
|
},
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
displayName: 'Account Id',
|
displayName: 'Account ID',
|
||||||
name: 'accountId',
|
name: 'accountId',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
description: 'ID of the account associated with this case.',
|
description: 'ID of the account associated with this case.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Contact Id',
|
displayName: 'Contact ID',
|
||||||
name: 'contactId',
|
name: 'contactId',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
description: 'IID of the associated Contact.',
|
description: 'ID of the associated Contact.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Description',
|
displayName: 'Description',
|
||||||
|
@ -146,7 +146,7 @@ export const caseFields = [
|
||||||
description: 'The owner of the case.',
|
description: 'The owner of the case.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Parent Id',
|
displayName: 'Parent ID',
|
||||||
name: 'ParentId',
|
name: 'ParentId',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
|
@ -219,6 +219,7 @@ export const caseFields = [
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* case:update */
|
/* case:update */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
@ -315,7 +316,7 @@ export const caseFields = [
|
||||||
description: 'The subject of the case. Limit: 255 characters.',
|
description: 'The subject of the case. Limit: 255 characters.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Parent Id',
|
displayName: 'Parent ID',
|
||||||
name: 'ParentId',
|
name: 'ParentId',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
|
@ -332,18 +333,18 @@ export const caseFields = [
|
||||||
description: 'The importance or urgency of the case, such as High, Medium, or Low.',
|
description: 'The importance or urgency of the case, such as High, Medium, or Low.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Account Id',
|
displayName: 'Account ID',
|
||||||
name: 'accountId',
|
name: 'accountId',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
description: 'ID of the account associated with this case.',
|
description: 'ID of the account associated with this case.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Contact Id',
|
displayName: 'Contact ID',
|
||||||
name: 'contactId',
|
name: 'contactId',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
description: 'IID of the associated Contact.',
|
description: 'ID of the associated Contact.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Description',
|
displayName: 'Description',
|
||||||
|
@ -409,8 +410,9 @@ export const caseFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Id of case that needs to be fetched',
|
description: 'ID of case that needs to be fetched.',
|
||||||
},
|
},
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* case:delete */
|
/* case:delete */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
@ -430,8 +432,9 @@ export const caseFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Id of case that needs to be fetched',
|
description: 'ID of case that needs to be fetched.',
|
||||||
},
|
},
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* case:getAll */
|
/* case:getAll */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
@ -493,6 +496,69 @@ export const caseFields = [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
options: [
|
options: [
|
||||||
|
{
|
||||||
|
displayName: 'Conditions',
|
||||||
|
name: 'conditionsUi',
|
||||||
|
placeholder: 'Add Condition',
|
||||||
|
type: 'fixedCollection',
|
||||||
|
typeOptions: {
|
||||||
|
multipleValues: true,
|
||||||
|
},
|
||||||
|
description: 'The condition to set.',
|
||||||
|
default: {},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'conditionValues',
|
||||||
|
displayName: 'Condition',
|
||||||
|
values: [
|
||||||
|
{
|
||||||
|
displayName: 'Field',
|
||||||
|
name: 'field',
|
||||||
|
type: 'options',
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getCaseFields',
|
||||||
|
},
|
||||||
|
default: '',
|
||||||
|
description: 'For date, number, or boolean, please use expressions.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Operation',
|
||||||
|
name: 'operation',
|
||||||
|
type: 'options',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: '=',
|
||||||
|
value: 'equal',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '>',
|
||||||
|
value: '>',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '<',
|
||||||
|
value: '<',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '>=',
|
||||||
|
value: '>=',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '<=',
|
||||||
|
value: '<=',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
default: 'equal',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Value',
|
||||||
|
name: 'value',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Fields',
|
displayName: 'Fields',
|
||||||
name: 'fields',
|
name: 'fields',
|
||||||
|
@ -522,7 +588,7 @@ export const caseFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Id of case that needs to be fetched',
|
description: 'ID of case that needs to be fetched.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Options',
|
displayName: 'Options',
|
||||||
|
|
|
@ -43,7 +43,7 @@ export const contactOperations = [
|
||||||
{
|
{
|
||||||
name: 'Get Summary',
|
name: 'Get Summary',
|
||||||
value: 'getSummary',
|
value: 'getSummary',
|
||||||
description: `Returns an overview of contact's metadata.`,
|
description: `Returns an overview of contact's metadata`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Get All',
|
name: 'Get All',
|
||||||
|
@ -335,13 +335,6 @@ export const contactFields = [
|
||||||
default: '',
|
default: '',
|
||||||
description: 'Phone number for the contact.',
|
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',
|
displayName: 'Salutation',
|
||||||
name: 'salutation',
|
name: 'salutation',
|
||||||
|
@ -349,8 +342,16 @@ export const contactFields = [
|
||||||
default: '',
|
default: '',
|
||||||
description: 'Honorific abbreviation, word, or phrase to be used in front of name in greetings, such as Dr. or Mrs.',
|
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:update */
|
/* contact:update */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
@ -370,7 +371,7 @@ export const contactFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Id of contact that needs to be fetched',
|
description: 'ID of contact that needs to be fetched.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Update Fields',
|
displayName: 'Update Fields',
|
||||||
|
@ -659,8 +660,9 @@ export const contactFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Id of contact that needs to be fetched',
|
description: 'ID of contact that needs to be fetched.',
|
||||||
},
|
},
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* contact:delete */
|
/* contact:delete */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
@ -680,8 +682,9 @@ export const contactFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Id of contact that needs to be fetched',
|
description: 'ID of contact that needs to be fetched',
|
||||||
},
|
},
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* contact:getAll */
|
/* contact:getAll */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
@ -743,6 +746,69 @@ export const contactFields = [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
options: [
|
options: [
|
||||||
|
{
|
||||||
|
displayName: 'Conditions',
|
||||||
|
name: 'conditionsUi',
|
||||||
|
placeholder: 'Add Condition',
|
||||||
|
type: 'fixedCollection',
|
||||||
|
typeOptions: {
|
||||||
|
multipleValues: true,
|
||||||
|
},
|
||||||
|
description: 'The condition to set.',
|
||||||
|
default: {},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'conditionValues',
|
||||||
|
displayName: 'Condition',
|
||||||
|
values: [
|
||||||
|
{
|
||||||
|
displayName: 'Field',
|
||||||
|
name: 'field',
|
||||||
|
type: 'options',
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getContactFields',
|
||||||
|
},
|
||||||
|
default: '',
|
||||||
|
description: 'For date, number, or boolean, please use expressions.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Operation',
|
||||||
|
name: 'operation',
|
||||||
|
type: 'options',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: '=',
|
||||||
|
value: 'equal',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '>',
|
||||||
|
value: '>',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '<',
|
||||||
|
value: '<',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '>=',
|
||||||
|
value: '>=',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '<=',
|
||||||
|
value: '<=',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
default: 'equal',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Value',
|
||||||
|
name: 'value',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Fields',
|
displayName: 'Fields',
|
||||||
name: 'fields',
|
name: 'fields',
|
||||||
|
@ -772,7 +838,7 @@ export const contactFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Id of contact that needs to be fetched',
|
description: 'ID of contact that needs to be fetched.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Campaign',
|
displayName: 'Campaign',
|
||||||
|
@ -793,7 +859,7 @@ export const contactFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Id of the campaign that needs to be fetched',
|
description: 'ID of the campaign that needs to be fetched.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Options',
|
displayName: 'Options',
|
||||||
|
@ -817,10 +883,11 @@ export const contactFields = [
|
||||||
name: 'status',
|
name: 'status',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
description: 'Controls the HasResponded flag on this object',
|
description: 'Controls the HasResponded flag on this object.',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* contact:addNote */
|
/* contact:addNote */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
@ -840,7 +907,7 @@ export const contactFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Id of contact that needs to be fetched',
|
description: 'ID of contact that needs to be fetched.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Title',
|
displayName: 'Title',
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
export interface IContact {
|
export interface IContact {
|
||||||
LastName?: string;
|
LastName?: string;
|
||||||
Fax?: string;
|
Fax?: string;
|
||||||
|
|
|
@ -70,7 +70,7 @@ export const customObjectFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Name of the custom object',
|
description: 'Name of the custom object.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Fields',
|
displayName: 'Fields',
|
||||||
|
@ -90,7 +90,7 @@ export const customObjectFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Filter by custom fields ',
|
description: 'Filter by custom fields.',
|
||||||
default: {},
|
default: {},
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
|
@ -121,6 +121,7 @@ export const customObjectFields = [
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* customObject:update */
|
/* customObject:update */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
@ -161,7 +162,7 @@ export const customObjectFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Record id to be updated',
|
description: 'Record ID to be updated.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Fields',
|
displayName: 'Fields',
|
||||||
|
@ -212,6 +213,7 @@ export const customObjectFields = [
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* customObject:get */
|
/* customObject:get */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
@ -252,8 +254,9 @@ export const customObjectFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Record id to be retrieved',
|
description: 'Record ID to be retrieved.',
|
||||||
},
|
},
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* customObject:delete */
|
/* customObject:delete */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
@ -276,7 +279,7 @@ export const customObjectFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Name of the custom object',
|
description: 'Name of the custom object.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Record ID',
|
displayName: 'Record ID',
|
||||||
|
@ -294,8 +297,9 @@ export const customObjectFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Record id to be deleted',
|
description: 'Record ID to be deleted.',
|
||||||
},
|
},
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* customObject:getAll */
|
/* customObject:getAll */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
@ -378,6 +382,72 @@ export const customObjectFields = [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
options: [
|
options: [
|
||||||
|
{
|
||||||
|
displayName: 'Conditions',
|
||||||
|
name: 'conditionsUi',
|
||||||
|
placeholder: 'Add Condition',
|
||||||
|
type: 'fixedCollection',
|
||||||
|
typeOptions: {
|
||||||
|
multipleValues: true,
|
||||||
|
},
|
||||||
|
description: 'The condition to set.',
|
||||||
|
default: {},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'conditionValues',
|
||||||
|
displayName: 'Condition',
|
||||||
|
values: [
|
||||||
|
{
|
||||||
|
displayName: 'Field',
|
||||||
|
name: 'field',
|
||||||
|
type: 'options',
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getCustomObjectFields',
|
||||||
|
loadOptionsDependsOn: [
|
||||||
|
'customObject',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
default: '',
|
||||||
|
description: 'For date, number, or boolean, please use expressions.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Operation',
|
||||||
|
name: 'operation',
|
||||||
|
type: 'options',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: '=',
|
||||||
|
value: 'equal',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '>',
|
||||||
|
value: '>',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '<',
|
||||||
|
value: '<',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '>=',
|
||||||
|
value: '>=',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '<=',
|
||||||
|
value: '<=',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
default: 'equal',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Value',
|
||||||
|
name: 'value',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Fields',
|
displayName: 'Fields',
|
||||||
name: 'fields',
|
name: 'fields',
|
||||||
|
|
|
@ -77,6 +77,7 @@ export const flowFields = [
|
||||||
default: 100,
|
default: 100,
|
||||||
description: 'How many results to return.',
|
description: 'How many results to return.',
|
||||||
},
|
},
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* flow:invoke */
|
/* flow:invoke */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
@ -133,7 +134,7 @@ export const flowFields = [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
default: '',
|
default: '',
|
||||||
description: 'Input variables as JSON object',
|
description: 'Input variables as JSON object.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Variables',
|
displayName: 'Variables',
|
||||||
|
|
|
@ -134,3 +134,55 @@ function getAccessToken(this: IExecuteFunctions | IExecuteSingleFunctions | ILoa
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
return this.helpers.request(options);
|
return this.helpers.request(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getConditions(options: IDataObject) {
|
||||||
|
const conditions = (options.conditionsUi as IDataObject || {}).conditionValues as IDataObject[];
|
||||||
|
let data = undefined;
|
||||||
|
if (Array.isArray(conditions) && conditions.length !== 0) {
|
||||||
|
data = conditions.map((condition: IDataObject) => `${condition.field}${(condition.operation) === 'equal' ? '=' : condition.operation}${getValue(condition.value)}`);
|
||||||
|
console.log(data);
|
||||||
|
data = `WHERE ${data.join(' AND ')}`;
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getDefaultFields(sobject: string) {
|
||||||
|
return (
|
||||||
|
{
|
||||||
|
'Account': 'id,name,type',
|
||||||
|
'Lead': 'id,company,firstname,lastname,street,postalCode,city,email,status',
|
||||||
|
'Contact': 'id,firstname,lastname,email',
|
||||||
|
'Opportunity': 'id,accountId,amount,probability,type',
|
||||||
|
'Case': 'id,accountId,contactId,priority,status,subject,type',
|
||||||
|
'Task': 'id,subject,status,priority',
|
||||||
|
'Attachment': 'id,name',
|
||||||
|
'User': 'id,name,email',
|
||||||
|
} as IDataObject
|
||||||
|
)[sobject];
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getQuery(options: IDataObject, sobject: string, returnAll: boolean, limit = 0) {
|
||||||
|
const fields: string[] = [];
|
||||||
|
if (options.fields) {
|
||||||
|
fields.push.apply(fields, (options.fields as string).split(','));
|
||||||
|
} else {
|
||||||
|
fields.push.apply(fields, (getDefaultFields(sobject) as string || 'id').split(','));
|
||||||
|
}
|
||||||
|
const conditions = getConditions(options);
|
||||||
|
|
||||||
|
let query = `SELECT ${fields.join(',')} FROM ${sobject} ${(conditions ? conditions : '')}`;
|
||||||
|
|
||||||
|
if (returnAll === false) {
|
||||||
|
query = `SELECT ${fields.join(',')} FROM ${sobject} ${(conditions ? conditions : '')} LIMIT ${limit}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getValue(value: any) {
|
||||||
|
if (typeof value === 'string') {
|
||||||
|
return `'${value}'`;
|
||||||
|
} else {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ export const leadOperations = [
|
||||||
{
|
{
|
||||||
name: 'Get Summary',
|
name: 'Get Summary',
|
||||||
value: 'getSummary',
|
value: 'getSummary',
|
||||||
description: `Returns an overview of Lead's metadata.`,
|
description: `Returns an overview of Lead's metadata`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Update',
|
name: 'Update',
|
||||||
|
@ -299,7 +299,7 @@ export const leadFields = [
|
||||||
name: 'street',
|
name: 'street',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
description: 'Street number and name for the address of the lead',
|
description: 'Street number and name for the address of the lead.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Title',
|
displayName: 'Title',
|
||||||
|
@ -317,6 +317,7 @@ export const leadFields = [
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* lead:update */
|
/* lead:update */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
@ -336,7 +337,7 @@ export const leadFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Id of Lead that needs to be fetched',
|
description: 'ID of Lead that needs to be fetched.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Update Fields',
|
displayName: 'Update Fields',
|
||||||
|
@ -549,7 +550,7 @@ export const leadFields = [
|
||||||
name: 'street',
|
name: 'street',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
description: 'Street number and name for the address of the lead',
|
description: 'Street number and name for the address of the lead.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Title',
|
displayName: 'Title',
|
||||||
|
@ -587,8 +588,9 @@ export const leadFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Id of Lead that needs to be fetched',
|
description: 'ID of Lead that needs to be fetched.',
|
||||||
},
|
},
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* lead:delete */
|
/* lead:delete */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
@ -608,8 +610,9 @@ export const leadFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Id of Lead that needs to be fetched',
|
description: 'ID of Lead that needs to be fetched.',
|
||||||
},
|
},
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* lead:getAll */
|
/* lead:getAll */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
@ -671,6 +674,69 @@ export const leadFields = [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
options: [
|
options: [
|
||||||
|
{
|
||||||
|
displayName: 'Conditions',
|
||||||
|
name: 'conditionsUi',
|
||||||
|
placeholder: 'Add Condition',
|
||||||
|
type: 'fixedCollection',
|
||||||
|
typeOptions: {
|
||||||
|
multipleValues: true,
|
||||||
|
},
|
||||||
|
description: 'The condition to set.',
|
||||||
|
default: {},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'conditionValues',
|
||||||
|
displayName: 'Condition',
|
||||||
|
values: [
|
||||||
|
{
|
||||||
|
displayName: 'Field',
|
||||||
|
name: 'field',
|
||||||
|
type: 'options',
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getLeadFields',
|
||||||
|
},
|
||||||
|
default: '',
|
||||||
|
description: 'For date, number, or boolean, please use expressions.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Operation',
|
||||||
|
name: 'operation',
|
||||||
|
type: 'options',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: '=',
|
||||||
|
value: 'equal',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '>',
|
||||||
|
value: '>',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '<',
|
||||||
|
value: '<',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '>=',
|
||||||
|
value: '>=',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '<=',
|
||||||
|
value: '<=',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
default: 'equal',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Value',
|
||||||
|
name: 'value',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Fields',
|
displayName: 'Fields',
|
||||||
name: 'fields',
|
name: 'fields',
|
||||||
|
@ -680,6 +746,7 @@ export const leadFields = [
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* contact:addToCampaign */
|
/* contact:addToCampaign */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
@ -699,7 +766,7 @@ export const leadFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Id of contact that needs to be fetched',
|
description: 'ID of contact that needs to be fetched.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Campaign',
|
displayName: 'Campaign',
|
||||||
|
@ -720,7 +787,7 @@ export const leadFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Id of the campaign that needs to be fetched',
|
description: 'ID of the campaign that needs to be fetched.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Options',
|
displayName: 'Options',
|
||||||
|
@ -744,10 +811,11 @@ export const leadFields = [
|
||||||
name: 'status',
|
name: 'status',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
description: 'Controls the HasResponded flag on this object',
|
description: 'Controls the HasResponded flag on this object.',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* lead:addNote */
|
/* lead:addNote */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
@ -767,7 +835,7 @@ export const leadFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Id of lead that needs to be fetched',
|
description: 'ID of lead that needs to be fetched.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Title',
|
displayName: 'Title',
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
export interface ILead {
|
export interface ILead {
|
||||||
Company?: string;
|
Company?: string;
|
||||||
LastName?: string;
|
LastName?: string;
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
export interface INote {
|
export interface INote {
|
||||||
Title?: string;
|
Title?: string;
|
||||||
ParentId?: string;
|
ParentId?: string;
|
||||||
|
|
|
@ -43,7 +43,7 @@ export const opportunityOperations = [
|
||||||
{
|
{
|
||||||
name: 'Get Summary',
|
name: 'Get Summary',
|
||||||
value: 'getSummary',
|
value: 'getSummary',
|
||||||
description: `Returns an overview of opportunity's metadata.`,
|
description: `Returns an overview of opportunity's metadata`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Update',
|
name: 'Update',
|
||||||
|
@ -163,7 +163,7 @@ export const opportunityFields = [
|
||||||
loadOptionsMethod: 'getCampaigns',
|
loadOptionsMethod: 'getCampaigns',
|
||||||
},
|
},
|
||||||
default: '',
|
default: '',
|
||||||
description: 'Id of the campaign that needs to be fetched',
|
description: 'ID of the campaign that needs to be fetched.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Custom Fields',
|
displayName: 'Custom Fields',
|
||||||
|
@ -250,7 +250,7 @@ export const opportunityFields = [
|
||||||
description: 'Phone number for the opportunity.',
|
description: 'Phone number for the opportunity.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Pricebook2 Id',
|
displayName: 'Pricebook2 ID',
|
||||||
name: 'pricebook2Id',
|
name: 'pricebook2Id',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
|
@ -285,6 +285,7 @@ export const opportunityFields = [
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* opportunity:update */
|
/* opportunity:update */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
@ -304,7 +305,7 @@ export const opportunityFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Id of opportunity that needs to be fetched',
|
description: 'ID of opportunity that needs to be fetched.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Update Fields',
|
displayName: 'Update Fields',
|
||||||
|
@ -341,7 +342,7 @@ export const opportunityFields = [
|
||||||
numberPrecision: 2,
|
numberPrecision: 2,
|
||||||
},
|
},
|
||||||
default: '',
|
default: '',
|
||||||
description: 'Estimated total sale amount',
|
description: 'Estimated total sale amount.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Campaign',
|
displayName: 'Campaign',
|
||||||
|
@ -351,7 +352,7 @@ export const opportunityFields = [
|
||||||
loadOptionsMethod: 'getCampaigns',
|
loadOptionsMethod: 'getCampaigns',
|
||||||
},
|
},
|
||||||
default: '',
|
default: '',
|
||||||
description: 'Id of the campaign that needs to be fetched',
|
description: 'ID of the campaign that needs to be fetched.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Close Date',
|
displayName: 'Close Date',
|
||||||
|
@ -408,7 +409,7 @@ export const opportunityFields = [
|
||||||
name: 'forecastCategoryName',
|
name: 'forecastCategoryName',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
description: 'It is implied, but not directly controlled, by the StageName field',
|
description: 'It is implied, but not directly controlled, by the StageName field.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Lead Source',
|
displayName: 'Lead Source',
|
||||||
|
@ -452,7 +453,7 @@ export const opportunityFields = [
|
||||||
description: 'Phone number for the opportunity.',
|
description: 'Phone number for the opportunity.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Pricebook2 Id',
|
displayName: 'Pricebook2 ID',
|
||||||
name: 'pricebook2Id',
|
name: 'pricebook2Id',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
|
@ -466,7 +467,7 @@ export const opportunityFields = [
|
||||||
numberPrecision: 1,
|
numberPrecision: 1,
|
||||||
},
|
},
|
||||||
default: '',
|
default: '',
|
||||||
description: 'Percentage of estimated confidence in closing the opportunity',
|
description: 'Percentage of estimated confidence in closing the opportunity.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Stage Name',
|
displayName: 'Stage Name',
|
||||||
|
@ -517,8 +518,9 @@ export const opportunityFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Id of opportunity that needs to be fetched',
|
description: 'ID of opportunity that needs to be fetched.',
|
||||||
},
|
},
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* opportunity:delete */
|
/* opportunity:delete */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
@ -538,8 +540,9 @@ export const opportunityFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Id of opportunity that needs to be fetched',
|
description: 'ID of opportunity that needs to be fetched.',
|
||||||
},
|
},
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* opportunity:getAll */
|
/* opportunity:getAll */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
@ -601,6 +604,69 @@ export const opportunityFields = [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
options: [
|
options: [
|
||||||
|
{
|
||||||
|
displayName: 'Conditions',
|
||||||
|
name: 'conditionsUi',
|
||||||
|
placeholder: 'Add Condition',
|
||||||
|
type: 'fixedCollection',
|
||||||
|
typeOptions: {
|
||||||
|
multipleValues: true,
|
||||||
|
},
|
||||||
|
description: 'The condition to set.',
|
||||||
|
default: {},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'conditionValues',
|
||||||
|
displayName: 'Condition',
|
||||||
|
values: [
|
||||||
|
{
|
||||||
|
displayName: 'Field',
|
||||||
|
name: 'field',
|
||||||
|
type: 'options',
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getOpportunityFields',
|
||||||
|
},
|
||||||
|
default: '',
|
||||||
|
description: 'For date, number, or boolean, please use expressions',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Operation',
|
||||||
|
name: 'operation',
|
||||||
|
type: 'options',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: '=',
|
||||||
|
value: 'equal',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '>',
|
||||||
|
value: '>',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '<',
|
||||||
|
value: '<',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '>=',
|
||||||
|
value: '>=',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '<=',
|
||||||
|
value: '<=',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
default: 'equal',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Value',
|
||||||
|
name: 'value',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Fields',
|
displayName: 'Fields',
|
||||||
name: 'fields',
|
name: 'fields',
|
||||||
|
@ -630,7 +696,7 @@ export const opportunityFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Id of opportunity that needs to be fetched',
|
description: 'ID of opportunity that needs to be fetched.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Title',
|
displayName: 'Title',
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
export interface IOpportunity {
|
export interface IOpportunity {
|
||||||
Name?: string;
|
Name?: string;
|
||||||
StageName?: string;
|
StageName?: string;
|
||||||
|
|
|
@ -63,6 +63,7 @@ import {
|
||||||
} from './FlowDescription';
|
} from './FlowDescription';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
getQuery,
|
||||||
salesforceApiRequest,
|
salesforceApiRequest,
|
||||||
salesforceApiRequestAllItems,
|
salesforceApiRequestAllItems,
|
||||||
sortOptions,
|
sortOptions,
|
||||||
|
@ -90,6 +91,11 @@ import {
|
||||||
IOpportunity,
|
IOpportunity,
|
||||||
} from './OpportunityInterface';
|
} from './OpportunityInterface';
|
||||||
|
|
||||||
|
import {
|
||||||
|
searchFields,
|
||||||
|
searchOperations,
|
||||||
|
} from './SearchDescription';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
taskFields,
|
taskFields,
|
||||||
taskOperations,
|
taskOperations,
|
||||||
|
@ -104,10 +110,6 @@ import {
|
||||||
userOperations,
|
userOperations,
|
||||||
} from './UserDescription';
|
} from './UserDescription';
|
||||||
|
|
||||||
import {
|
|
||||||
IUser,
|
|
||||||
} from './UserInterface';
|
|
||||||
|
|
||||||
export class Salesforce implements INodeType {
|
export class Salesforce implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
displayName: 'Salesforce',
|
displayName: 'Salesforce',
|
||||||
|
@ -210,6 +212,11 @@ export class Salesforce implements INodeType {
|
||||||
value: 'opportunity',
|
value: 'opportunity',
|
||||||
description: 'Represents an opportunity, which is a sale or pending deal.',
|
description: 'Represents an opportunity, which is a sale or pending deal.',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'Search',
|
||||||
|
value: 'search',
|
||||||
|
description: 'Search records',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'Task',
|
name: 'Task',
|
||||||
value: 'task',
|
value: 'task',
|
||||||
|
@ -234,6 +241,8 @@ export class Salesforce implements INodeType {
|
||||||
...opportunityFields,
|
...opportunityFields,
|
||||||
...accountOperations,
|
...accountOperations,
|
||||||
...accountFields,
|
...accountFields,
|
||||||
|
...searchOperations,
|
||||||
|
...searchFields,
|
||||||
...caseOperations,
|
...caseOperations,
|
||||||
...caseFields,
|
...caseFields,
|
||||||
...taskOperations,
|
...taskOperations,
|
||||||
|
@ -700,6 +709,142 @@ export class Salesforce implements INodeType {
|
||||||
sortOptions(returnData);
|
sortOptions(returnData);
|
||||||
return returnData;
|
return returnData;
|
||||||
},
|
},
|
||||||
|
// Get all the account fields recurrence instances to display them to user so that he can
|
||||||
|
// select them easily
|
||||||
|
async getAccountFields(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||||
|
const returnData: INodePropertyOptions[] = [];
|
||||||
|
// TODO: find a way to filter this object to get just the lead sources instead of the whole object
|
||||||
|
const { fields } = await salesforceApiRequest.call(this, 'GET', `/sobjects/account/describe`);
|
||||||
|
for (const field of fields) {
|
||||||
|
const fieldName = field.label;
|
||||||
|
const fieldId = field.name;
|
||||||
|
returnData.push({
|
||||||
|
name: fieldName,
|
||||||
|
value: fieldId,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
sortOptions(returnData);
|
||||||
|
return returnData;
|
||||||
|
},
|
||||||
|
// Get all the attachment fields recurrence instances to display them to user so that he can
|
||||||
|
// select them easily
|
||||||
|
async getAtachmentFields(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||||
|
const returnData: INodePropertyOptions[] = [];
|
||||||
|
// TODO: find a way to filter this object to get just the lead sources instead of the whole object
|
||||||
|
const { fields } = await salesforceApiRequest.call(this, 'GET', `/sobjects/attachment/describe`);
|
||||||
|
for (const field of fields) {
|
||||||
|
const fieldName = field.label;
|
||||||
|
const fieldId = field.name;
|
||||||
|
returnData.push({
|
||||||
|
name: fieldName,
|
||||||
|
value: fieldId,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
sortOptions(returnData);
|
||||||
|
return returnData;
|
||||||
|
},
|
||||||
|
// Get all the case fields recurrence instances to display them to user so that he can
|
||||||
|
// select them easily
|
||||||
|
async getCaseFields(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||||
|
const returnData: INodePropertyOptions[] = [];
|
||||||
|
// TODO: find a way to filter this object to get just the lead sources instead of the whole object
|
||||||
|
const { fields } = await salesforceApiRequest.call(this, 'GET', `/sobjects/case/describe`);
|
||||||
|
for (const field of fields) {
|
||||||
|
const fieldName = field.label;
|
||||||
|
const fieldId = field.name;
|
||||||
|
returnData.push({
|
||||||
|
name: fieldName,
|
||||||
|
value: fieldId,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
sortOptions(returnData);
|
||||||
|
return returnData;
|
||||||
|
},
|
||||||
|
// Get all the lead fields recurrence instances to display them to user so that he can
|
||||||
|
// select them easily
|
||||||
|
async getLeadFields(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||||
|
const returnData: INodePropertyOptions[] = [];
|
||||||
|
// TODO: find a way to filter this object to get just the lead sources instead of the whole object
|
||||||
|
const { fields } = await salesforceApiRequest.call(this, 'GET', `/sobjects/lead/describe`);
|
||||||
|
for (const field of fields) {
|
||||||
|
const fieldName = field.label;
|
||||||
|
const fieldId = field.name;
|
||||||
|
returnData.push({
|
||||||
|
name: fieldName,
|
||||||
|
value: fieldId,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
sortOptions(returnData);
|
||||||
|
return returnData;
|
||||||
|
},
|
||||||
|
// Get all the opportunity fields recurrence instances to display them to user so that he can
|
||||||
|
// select them easily
|
||||||
|
async getOpportunityFields(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||||
|
const returnData: INodePropertyOptions[] = [];
|
||||||
|
// TODO: find a way to filter this object to get just the lead sources instead of the whole object
|
||||||
|
const { fields } = await salesforceApiRequest.call(this, 'GET', `/sobjects/opportunity/describe`);
|
||||||
|
for (const field of fields) {
|
||||||
|
const fieldName = field.label;
|
||||||
|
const fieldId = field.name;
|
||||||
|
returnData.push({
|
||||||
|
name: fieldName,
|
||||||
|
value: fieldId,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
sortOptions(returnData);
|
||||||
|
return returnData;
|
||||||
|
},
|
||||||
|
// Get all the opportunity fields recurrence instances to display them to user so that he can
|
||||||
|
// select them easily
|
||||||
|
async getTaskFields(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||||
|
const returnData: INodePropertyOptions[] = [];
|
||||||
|
// TODO: find a way to filter this object to get just the lead sources instead of the whole object
|
||||||
|
const { fields } = await salesforceApiRequest.call(this, 'GET', `/sobjects/task/describe`);
|
||||||
|
for (const field of fields) {
|
||||||
|
const fieldName = field.label;
|
||||||
|
const fieldId = field.name;
|
||||||
|
returnData.push({
|
||||||
|
name: fieldName,
|
||||||
|
value: fieldId,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
sortOptions(returnData);
|
||||||
|
return returnData;
|
||||||
|
},
|
||||||
|
// Get all the users fields recurrence instances to display them to user so that he can
|
||||||
|
// select them easily
|
||||||
|
async getUserFields(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||||
|
const returnData: INodePropertyOptions[] = [];
|
||||||
|
// TODO: find a way to filter this object to get just the lead sources instead of the whole object
|
||||||
|
const { fields } = await salesforceApiRequest.call(this, 'GET', `/sobjects/user/describe`);
|
||||||
|
for (const field of fields) {
|
||||||
|
const fieldName = field.label;
|
||||||
|
const fieldId = field.name;
|
||||||
|
returnData.push({
|
||||||
|
name: fieldName,
|
||||||
|
value: fieldId,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
sortOptions(returnData);
|
||||||
|
return returnData;
|
||||||
|
},
|
||||||
|
// Get all the contact fields recurrence instances to display them to user so that he can
|
||||||
|
// select them easily
|
||||||
|
async getContactFields(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||||
|
const returnData: INodePropertyOptions[] = [];
|
||||||
|
// TODO: find a way to filter this object to get just the lead sources instead of the whole object
|
||||||
|
const { fields } = await salesforceApiRequest.call(this, 'GET', `/sobjects/contact/describe`);
|
||||||
|
for (const field of fields) {
|
||||||
|
const fieldName = field.label;
|
||||||
|
const fieldId = field.name;
|
||||||
|
returnData.push({
|
||||||
|
name: fieldName,
|
||||||
|
value: fieldId,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
sortOptions(returnData);
|
||||||
|
return returnData;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -894,18 +1039,13 @@ export class Salesforce implements INodeType {
|
||||||
if (operation === 'getAll') {
|
if (operation === 'getAll') {
|
||||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||||
const options = this.getNodeParameter('options', i) as IDataObject;
|
const options = this.getNodeParameter('options', i) as IDataObject;
|
||||||
const fields = ['id,company,firstname,lastname,street,postalCode,city,email,status'];
|
|
||||||
if (options.fields) {
|
|
||||||
// @ts-ignore
|
|
||||||
fields.push(...options.fields.split(','));
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
if (returnAll) {
|
if (returnAll) {
|
||||||
qs.q = `SELECT ${fields.join(',')} FROM Lead`;
|
qs.q = getQuery(options, 'Lead', returnAll) as string;
|
||||||
responseData = await salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
|
responseData = await salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
|
||||||
} else {
|
} else {
|
||||||
const limit = this.getNodeParameter('limit', i) as number;
|
const limit = this.getNodeParameter('limit', i) as number;
|
||||||
qs.q = `SELECT ${fields.join(',')} FROM Lead Limit ${limit}`;
|
qs.q = getQuery(options, 'Lead', returnAll, limit) as string;
|
||||||
responseData = await salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
|
responseData = await salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -1187,18 +1327,13 @@ export class Salesforce implements INodeType {
|
||||||
if (operation === 'getAll') {
|
if (operation === 'getAll') {
|
||||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||||
const options = this.getNodeParameter('options', i) as IDataObject;
|
const options = this.getNodeParameter('options', i) as IDataObject;
|
||||||
const fields = ['id,firstname,lastname,email'];
|
|
||||||
if (options.fields) {
|
|
||||||
// @ts-ignore
|
|
||||||
fields.push(...options.fields.split(','));
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
if (returnAll) {
|
if (returnAll) {
|
||||||
qs.q = `SELECT ${fields.join(',')} FROM Contact`;
|
qs.q = getQuery(options, 'Contact', returnAll) as string;
|
||||||
responseData = await salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
|
responseData = await salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
|
||||||
} else {
|
} else {
|
||||||
const limit = this.getNodeParameter('limit', i) as number;
|
const limit = this.getNodeParameter('limit', i) as number;
|
||||||
qs.q = `SELECT ${fields.join(',')} FROM Contact Limit ${limit}`;
|
qs.q = getQuery(options, 'Contact', returnAll, limit) as string;
|
||||||
responseData = await salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
|
responseData = await salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -1294,17 +1429,13 @@ export class Salesforce implements INodeType {
|
||||||
const customObject = this.getNodeParameter('customObject', i) as string;
|
const customObject = this.getNodeParameter('customObject', i) as string;
|
||||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||||
const options = this.getNodeParameter('options', i) as IDataObject;
|
const options = this.getNodeParameter('options', i) as IDataObject;
|
||||||
let fields = ['id'];
|
|
||||||
if (options.fields) {
|
|
||||||
fields = options.fields as string[];
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
if (returnAll) {
|
if (returnAll) {
|
||||||
qs.q = `SELECT ${fields.join(',')} FROM ${customObject}`;
|
qs.q = getQuery(options, customObject, returnAll) as string;
|
||||||
responseData = await salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
|
responseData = await salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
|
||||||
} else {
|
} else {
|
||||||
const limit = this.getNodeParameter('limit', i) as number;
|
const limit = this.getNodeParameter('limit', i) as number;
|
||||||
qs.q = `SELECT ${fields.join(',')} FROM ${customObject} Limit ${limit}`;
|
qs.q = getQuery(options, customObject, returnAll, limit) as string;
|
||||||
responseData = await salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
|
responseData = await salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -1444,18 +1575,13 @@ export class Salesforce implements INodeType {
|
||||||
if (operation === 'getAll') {
|
if (operation === 'getAll') {
|
||||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||||
const options = this.getNodeParameter('options', i) as IDataObject;
|
const options = this.getNodeParameter('options', i) as IDataObject;
|
||||||
const fields = ['id,accountId,amount,probability,type'];
|
|
||||||
if (options.fields) {
|
|
||||||
// @ts-ignore
|
|
||||||
fields.push(...options.fields.split(','));
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
if (returnAll) {
|
if (returnAll) {
|
||||||
qs.q = `SELECT ${fields.join(',')} FROM Opportunity`;
|
qs.q = getQuery(options, 'Opportunity', returnAll) as string;
|
||||||
responseData = await salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
|
responseData = await salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
|
||||||
} else {
|
} else {
|
||||||
const limit = this.getNodeParameter('limit', i) as number;
|
const limit = this.getNodeParameter('limit', i) as number;
|
||||||
qs.q = `SELECT ${fields.join(',')} FROM Opportunity Limit ${limit}`;
|
qs.q = getQuery(options, 'Opportunity', returnAll, limit) as string;
|
||||||
responseData = await salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
|
responseData = await salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -1687,18 +1813,13 @@ export class Salesforce implements INodeType {
|
||||||
if (operation === 'getAll') {
|
if (operation === 'getAll') {
|
||||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||||
const options = this.getNodeParameter('options', i) as IDataObject;
|
const options = this.getNodeParameter('options', i) as IDataObject;
|
||||||
const fields = ['id,name,type'];
|
|
||||||
if (options.fields) {
|
|
||||||
// @ts-ignore
|
|
||||||
fields.push(...options.fields.split(','));
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
if (returnAll) {
|
if (returnAll) {
|
||||||
qs.q = `SELECT ${fields.join(',')} FROM Account`;
|
qs.q = getQuery(options, 'Account', returnAll) as string;
|
||||||
responseData = await salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
|
responseData = await salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
|
||||||
} else {
|
} else {
|
||||||
const limit = this.getNodeParameter('limit', i) as number;
|
const limit = this.getNodeParameter('limit', i) as number;
|
||||||
qs.q = `SELECT ${fields.join(',')} FROM Account Limit ${limit}`;
|
qs.q = getQuery(options, 'Account', returnAll, limit) as string;
|
||||||
responseData = await salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
|
responseData = await salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -1852,18 +1973,13 @@ export class Salesforce implements INodeType {
|
||||||
if (operation === 'getAll') {
|
if (operation === 'getAll') {
|
||||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||||
const options = this.getNodeParameter('options', i) as IDataObject;
|
const options = this.getNodeParameter('options', i) as IDataObject;
|
||||||
const fields = ['id,accountId,contactId,priority,status,subject,type'];
|
|
||||||
if (options.fields) {
|
|
||||||
// @ts-ignore
|
|
||||||
fields.push(...options.fields.split(','));
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
if (returnAll) {
|
if (returnAll) {
|
||||||
qs.q = `SELECT ${fields.join(',')} FROM Case`;
|
qs.q = getQuery(options, 'Case', returnAll) as string;
|
||||||
responseData = await salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
|
responseData = await salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
|
||||||
} else {
|
} else {
|
||||||
const limit = this.getNodeParameter('limit', i) as number;
|
const limit = this.getNodeParameter('limit', i) as number;
|
||||||
qs.q = `SELECT ${fields.join(',')} FROM Case Limit ${limit}`;
|
qs.q = getQuery(options, 'Case', returnAll, limit) as string;
|
||||||
responseData = await salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
|
responseData = await salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -2084,18 +2200,13 @@ export class Salesforce implements INodeType {
|
||||||
if (operation === 'getAll') {
|
if (operation === 'getAll') {
|
||||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||||
const options = this.getNodeParameter('options', i) as IDataObject;
|
const options = this.getNodeParameter('options', i) as IDataObject;
|
||||||
const fields = ['id,subject,status,priority'];
|
|
||||||
if (options.fields) {
|
|
||||||
// @ts-ignore
|
|
||||||
fields.push(...options.fields.split(','));
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
if (returnAll) {
|
if (returnAll) {
|
||||||
qs.q = `SELECT ${fields.join(',')} FROM Task`;
|
qs.q = getQuery(options, 'Task', returnAll) as string;
|
||||||
responseData = await salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
|
responseData = await salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
|
||||||
} else {
|
} else {
|
||||||
const limit = this.getNodeParameter('limit', i) as number;
|
const limit = this.getNodeParameter('limit', i) as number;
|
||||||
qs.q = `SELECT ${fields.join(',')} FROM Task Limit ${limit}`;
|
qs.q = getQuery(options, 'Task', returnAll, limit) as string;
|
||||||
responseData = await salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
|
responseData = await salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -2181,18 +2292,13 @@ export class Salesforce implements INodeType {
|
||||||
if (operation === 'getAll') {
|
if (operation === 'getAll') {
|
||||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||||
const options = this.getNodeParameter('options', i) as IDataObject;
|
const options = this.getNodeParameter('options', i) as IDataObject;
|
||||||
const fields = ['id,name'];
|
|
||||||
if (options.fields) {
|
|
||||||
// @ts-ignore
|
|
||||||
fields.push(...options.fields.split(','));
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
if (returnAll) {
|
if (returnAll) {
|
||||||
qs.q = `SELECT ${fields.join(',')} FROM Attachment`;
|
qs.q = getQuery(options, 'Attachment', returnAll) as string;
|
||||||
responseData = await salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
|
responseData = await salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
|
||||||
} else {
|
} else {
|
||||||
const limit = this.getNodeParameter('limit', i) as number;
|
const limit = this.getNodeParameter('limit', i) as number;
|
||||||
qs.q = `SELECT ${fields.join(',')} FROM Attachment Limit ${limit}`;
|
qs.q = getQuery(options, 'Attachment', returnAll, limit) as string;
|
||||||
responseData = await salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
|
responseData = await salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -2223,18 +2329,13 @@ export class Salesforce implements INodeType {
|
||||||
if (operation === 'getAll') {
|
if (operation === 'getAll') {
|
||||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||||
const options = this.getNodeParameter('options', i) as IDataObject;
|
const options = this.getNodeParameter('options', i) as IDataObject;
|
||||||
const fields = ['id,name,email'];
|
|
||||||
if (options.fields) {
|
|
||||||
// @ts-ignore
|
|
||||||
fields.push(...options.fields.split(','));
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
if (returnAll) {
|
if (returnAll) {
|
||||||
qs.q = `SELECT ${fields.join(',')} FROM User`;
|
qs.q = getQuery(options, 'User', returnAll) as string;
|
||||||
responseData = await salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
|
responseData = await salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
|
||||||
} else {
|
} else {
|
||||||
const limit = this.getNodeParameter('limit', i) as number;
|
const limit = this.getNodeParameter('limit', i) as number;
|
||||||
qs.q = `SELECT ${fields.join(',')} FROM User Limit ${limit}`;
|
qs.q = getQuery(options, 'User', returnAll, limit) as string;
|
||||||
responseData = await salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
|
responseData = await salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -2278,6 +2379,13 @@ export class Salesforce implements INodeType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (resource === 'search') {
|
||||||
|
//https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_query.htm
|
||||||
|
if (operation === 'query') {
|
||||||
|
qs.q = this.getNodeParameter('query', i) as string;
|
||||||
|
responseData = await salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (Array.isArray(responseData)) {
|
if (Array.isArray(responseData)) {
|
||||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||||
} else {
|
} else {
|
||||||
|
|
52
packages/nodes-base/nodes/Salesforce/SearchDescription.ts
Normal file
52
packages/nodes-base/nodes/Salesforce/SearchDescription.ts
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
import {
|
||||||
|
INodeProperties,
|
||||||
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
|
export const searchOperations = [
|
||||||
|
{
|
||||||
|
displayName: 'Operation',
|
||||||
|
name: 'operation',
|
||||||
|
type: 'options',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'search',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'Query',
|
||||||
|
value: 'query',
|
||||||
|
description: 'Execute a SOQL query that returns all the results in a single response',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
default: 'query',
|
||||||
|
description: 'The operation to perform.',
|
||||||
|
},
|
||||||
|
] as INodeProperties[];
|
||||||
|
|
||||||
|
export const searchFields = [
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
/* search:query */
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
{
|
||||||
|
displayName: 'Query',
|
||||||
|
name: 'query',
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'search',
|
||||||
|
],
|
||||||
|
operation: [
|
||||||
|
'query',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
description: 'A SOQL query. An example query parameter string might look like: “SELECT+Name+FROM+MyObject”. If the SOQL query string is invalid, a MALFORMED_QUERY response is returned.',
|
||||||
|
},
|
||||||
|
] as INodeProperties[];
|
|
@ -38,7 +38,7 @@ export const taskOperations = [
|
||||||
{
|
{
|
||||||
name: 'Get Summary',
|
name: 'Get Summary',
|
||||||
value: 'getSummary',
|
value: 'getSummary',
|
||||||
description: `Returns an overview of task's metadata.`,
|
description: `Returns an overview of task's metadata`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Update',
|
name: 'Update',
|
||||||
|
@ -407,6 +407,7 @@ export const taskFields = [
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* task:update */
|
/* task:update */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
@ -426,7 +427,7 @@ export const taskFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Id of task that needs to be fetched',
|
description: 'ID of task that needs to be fetched.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Update Fields',
|
displayName: 'Update Fields',
|
||||||
|
@ -788,8 +789,9 @@ export const taskFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Id of task that needs to be fetched',
|
description: 'ID of task that needs to be fetched.',
|
||||||
},
|
},
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* task:delete */
|
/* task:delete */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
@ -809,8 +811,9 @@ export const taskFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Id of task that needs to be fetched',
|
description: 'ID of task that needs to be fetched.',
|
||||||
},
|
},
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* task:getAll */
|
/* task:getAll */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
@ -872,6 +875,69 @@ export const taskFields = [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
options: [
|
options: [
|
||||||
|
{
|
||||||
|
displayName: 'Conditions',
|
||||||
|
name: 'conditionsUi',
|
||||||
|
placeholder: 'Add Condition',
|
||||||
|
type: 'fixedCollection',
|
||||||
|
typeOptions: {
|
||||||
|
multipleValues: true,
|
||||||
|
},
|
||||||
|
description: 'The condition to set.',
|
||||||
|
default: {},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'conditionValues',
|
||||||
|
displayName: 'Condition',
|
||||||
|
values: [
|
||||||
|
{
|
||||||
|
displayName: 'Field',
|
||||||
|
name: 'field',
|
||||||
|
type: 'options',
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getTaskFields',
|
||||||
|
},
|
||||||
|
default: '',
|
||||||
|
description: 'For date, number, or boolean, please use expressions.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Operation',
|
||||||
|
name: 'operation',
|
||||||
|
type: 'options',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: '=',
|
||||||
|
value: 'equal',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '>',
|
||||||
|
value: '>',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '<',
|
||||||
|
value: '<',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '>=',
|
||||||
|
value: '>=',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '<=',
|
||||||
|
value: '<=',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
default: 'equal',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Value',
|
||||||
|
name: 'value',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Fields',
|
displayName: 'Fields',
|
||||||
name: 'fields',
|
name: 'fields',
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
export interface ITask {
|
export interface ITask {
|
||||||
WhoId?: string;
|
WhoId?: string;
|
||||||
Status?: string;
|
Status?: string;
|
||||||
|
|
|
@ -32,6 +32,7 @@ export const userOperations = [
|
||||||
] as INodeProperties[];
|
] as INodeProperties[];
|
||||||
|
|
||||||
export const userFields = [
|
export const userFields = [
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* user:get */
|
/* user:get */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
@ -51,8 +52,9 @@ export const userFields = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'Id of user that needs to be fetched',
|
description: 'ID of user that needs to be fetched.',
|
||||||
},
|
},
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* user:getAll */
|
/* user:getAll */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
@ -114,6 +116,69 @@ export const userFields = [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
options: [
|
options: [
|
||||||
|
{
|
||||||
|
displayName: 'Conditions',
|
||||||
|
name: 'conditionsUi',
|
||||||
|
placeholder: 'Add Condition',
|
||||||
|
type: 'fixedCollection',
|
||||||
|
typeOptions: {
|
||||||
|
multipleValues: true,
|
||||||
|
},
|
||||||
|
description: 'The condition to set.',
|
||||||
|
default: {},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'conditionValues',
|
||||||
|
displayName: 'Condition',
|
||||||
|
values: [
|
||||||
|
{
|
||||||
|
displayName: 'Field',
|
||||||
|
name: 'field',
|
||||||
|
type: 'options',
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getUserFields',
|
||||||
|
},
|
||||||
|
default: '',
|
||||||
|
description: 'For date, number, or boolean, please use expressions.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Operation',
|
||||||
|
name: 'operation',
|
||||||
|
type: 'options',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: '=',
|
||||||
|
value: 'equal',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '>',
|
||||||
|
value: '>',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '<',
|
||||||
|
value: '<',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '>=',
|
||||||
|
value: '>=',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '<=',
|
||||||
|
value: '<=',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
default: 'equal',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Value',
|
||||||
|
name: 'value',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Fields',
|
displayName: 'Fields',
|
||||||
name: 'fields',
|
name: 'fields',
|
||||||
|
|
Loading…
Reference in a new issue