mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 04:04: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
|
@ -58,9 +58,9 @@ export const accountOperations = [
|
|||
|
||||
export const accountFields = [
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* account:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* account:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Name',
|
||||
name: 'name',
|
||||
|
@ -104,7 +104,7 @@ export const accountFields = [
|
|||
loadOptionsMethod: 'getAccountSources',
|
||||
},
|
||||
default: '',
|
||||
description: 'The source of the account record',
|
||||
description: 'The source of the account record.',
|
||||
},
|
||||
{
|
||||
displayName: 'Annual Revenue',
|
||||
|
@ -209,7 +209,7 @@ export const accountFields = [
|
|||
name: 'jigsaw',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'references the ID of a company in Data.com',
|
||||
description: 'References the ID of a company in Data.com',
|
||||
},
|
||||
{
|
||||
displayName: 'Industry',
|
||||
|
@ -262,7 +262,7 @@ export const accountFields = [
|
|||
description: 'Type of account',
|
||||
},
|
||||
{
|
||||
displayName: 'Parent Id',
|
||||
displayName: 'Parent ID',
|
||||
name: 'parentId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
|
@ -312,9 +312,10 @@ export const accountFields = [
|
|||
},
|
||||
],
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* account:update */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* account:update */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Account ID',
|
||||
name: 'accountId',
|
||||
|
@ -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',
|
||||
|
@ -358,7 +359,7 @@ export const accountFields = [
|
|||
loadOptionsMethod: 'getAccountSources',
|
||||
},
|
||||
default: '',
|
||||
description: 'The source of the account record',
|
||||
description: 'The source of the account record.',
|
||||
},
|
||||
{
|
||||
displayName: 'Annual Revenue',
|
||||
|
@ -470,7 +471,7 @@ export const accountFields = [
|
|||
name: 'jigsaw',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'references the ID of a company in Data.com',
|
||||
description: 'References the ID of a company in Data.com',
|
||||
},
|
||||
{
|
||||
displayName: 'Owner',
|
||||
|
@ -514,7 +515,7 @@ export const accountFields = [
|
|||
description: 'Number of employees',
|
||||
},
|
||||
{
|
||||
displayName: 'Parent Id',
|
||||
displayName: 'Parent ID',
|
||||
name: 'parentId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
|
@ -574,9 +575,9 @@ export const accountFields = [
|
|||
],
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* account:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* account:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Account ID',
|
||||
name: 'accountId',
|
||||
|
@ -593,11 +594,12 @@ 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 */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Account ID',
|
||||
name: 'accountId',
|
||||
|
@ -614,11 +616,12 @@ 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 */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
|
@ -684,11 +687,75 @@ export const accountFields = [
|
|||
default: '',
|
||||
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 */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Account ID',
|
||||
name: 'accountId',
|
||||
|
@ -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',
|
||||
|
|
|
@ -13,7 +13,7 @@ export interface IAccount {
|
|||
Description?: string;
|
||||
BillingState?: string;
|
||||
ShippingStreet?: string;
|
||||
ShippingCity?:string;
|
||||
ShippingCity?: string;
|
||||
AccountSource?: string;
|
||||
AnnualRevenue?: number;
|
||||
BillingStreet?: string;
|
||||
|
|
|
@ -51,9 +51,9 @@ export const attachmentOperations = [
|
|||
|
||||
export const attachmentFields = [
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* attachment:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* attachment:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Parent ID',
|
||||
name: 'parentId',
|
||||
|
@ -152,9 +152,10 @@ export const attachmentFields = [
|
|||
},
|
||||
],
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* attachment:update */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* attachment:update */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Attachment ID',
|
||||
name: 'attachmentId',
|
||||
|
@ -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',
|
||||
|
@ -224,7 +225,7 @@ export const attachmentFields = [
|
|||
name: 'owner',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getUsers',
|
||||
loadOptionsMethod: 'getUsers',
|
||||
},
|
||||
default: '',
|
||||
description: 'ID of the User who owns the attachment.',
|
||||
|
@ -232,9 +233,9 @@ export const attachmentFields = [
|
|||
],
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* attachment:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* attachment:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Attachment ID',
|
||||
name: 'attachmentId',
|
||||
|
@ -251,11 +252,12 @@ 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 */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Attachment ID',
|
||||
name: 'attachmentId',
|
||||
|
@ -272,11 +274,12 @@ 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 */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
|
@ -335,6 +338,69 @@ export const attachmentFields = [
|
|||
},
|
||||
},
|
||||
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',
|
||||
name: 'fields',
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
export interface IAttachment {
|
||||
ParentId?: string;
|
||||
Name?: string;
|
||||
|
|
|
@ -36,7 +36,7 @@ export const caseOperations = [
|
|||
{
|
||||
name: 'Get Summary',
|
||||
value: 'getSummary',
|
||||
description: `Returns an overview of case's metadata.`,
|
||||
description: `Returns an overview of case's metadata`,
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
|
@ -56,16 +56,16 @@ export const caseOperations = [
|
|||
|
||||
export const caseFields = [
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* case:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* case:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Type',
|
||||
name: 'type',
|
||||
type: 'options',
|
||||
required: true,
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getCaseTypes',
|
||||
loadOptionsMethod: 'getCaseTypes',
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
|
@ -98,18 +98,18 @@ export const caseFields = [
|
|||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Account Id',
|
||||
displayName: 'Account ID',
|
||||
name: 'accountId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'ID of the account associated with this case.',
|
||||
},
|
||||
{
|
||||
displayName: 'Contact Id',
|
||||
displayName: 'Contact ID',
|
||||
name: 'contactId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'IID of the associated Contact.',
|
||||
description: 'ID of the associated Contact.',
|
||||
},
|
||||
{
|
||||
displayName: 'Description',
|
||||
|
@ -130,7 +130,7 @@ export const caseFields = [
|
|||
name: 'origin',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getCaseOrigins',
|
||||
loadOptionsMethod: 'getCaseOrigins',
|
||||
},
|
||||
default: '',
|
||||
description: 'The source of the case, such as Email, Phone, or Web. Label is Case Origin.',
|
||||
|
@ -146,7 +146,7 @@ export const caseFields = [
|
|||
description: 'The owner of the case.',
|
||||
},
|
||||
{
|
||||
displayName: 'Parent Id',
|
||||
displayName: 'Parent ID',
|
||||
name: 'ParentId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
|
@ -167,7 +167,7 @@ export const caseFields = [
|
|||
name: 'reason',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getCaseReasons',
|
||||
loadOptionsMethod: 'getCaseReasons',
|
||||
},
|
||||
default: '',
|
||||
description: 'The reason why the case was created, such as Instructions not clear, or User didn’t attend training.',
|
||||
|
@ -177,7 +177,7 @@ export const caseFields = [
|
|||
name: 'status',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getCaseStatuses',
|
||||
loadOptionsMethod: 'getCaseStatuses',
|
||||
},
|
||||
default: '',
|
||||
description: 'The status of the case, such as “New,” “Closed,” or “Escalated.” This field directly controls the IsClosed flag',
|
||||
|
@ -219,9 +219,10 @@ export const caseFields = [
|
|||
},
|
||||
],
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* case:update */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* case:update */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Case ID',
|
||||
name: 'caseId',
|
||||
|
@ -262,7 +263,7 @@ export const caseFields = [
|
|||
name: 'type',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getCaseTypes',
|
||||
loadOptionsMethod: 'getCaseTypes',
|
||||
},
|
||||
default: '',
|
||||
description: 'The type of case',
|
||||
|
@ -272,7 +273,7 @@ export const caseFields = [
|
|||
name: 'origin',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getCaseOrigins',
|
||||
loadOptionsMethod: 'getCaseOrigins',
|
||||
},
|
||||
default: '',
|
||||
description: 'The source of the case, such as Email, Phone, or Web. Label is Case Origin.',
|
||||
|
@ -282,7 +283,7 @@ export const caseFields = [
|
|||
name: 'reason',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getCaseReasons',
|
||||
loadOptionsMethod: 'getCaseReasons',
|
||||
},
|
||||
default: '',
|
||||
description: 'The reason why the case was created, such as Instructions not clear, or User didn’t attend training.',
|
||||
|
@ -292,7 +293,7 @@ export const caseFields = [
|
|||
name: 'status',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getCaseStatuses',
|
||||
loadOptionsMethod: 'getCaseStatuses',
|
||||
},
|
||||
default: '',
|
||||
description: 'The status of the case, such as “New,” “Closed,” or “Escalated.” This field directly controls the IsClosed flag',
|
||||
|
@ -315,7 +316,7 @@ export const caseFields = [
|
|||
description: 'The subject of the case. Limit: 255 characters.',
|
||||
},
|
||||
{
|
||||
displayName: 'Parent Id',
|
||||
displayName: 'Parent ID',
|
||||
name: 'ParentId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
|
@ -332,18 +333,18 @@ export const caseFields = [
|
|||
description: 'The importance or urgency of the case, such as High, Medium, or Low.',
|
||||
},
|
||||
{
|
||||
displayName: 'Account Id',
|
||||
displayName: 'Account ID',
|
||||
name: 'accountId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'ID of the account associated with this case.',
|
||||
},
|
||||
{
|
||||
displayName: 'Contact Id',
|
||||
displayName: 'Contact ID',
|
||||
name: 'contactId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'IID of the associated Contact.',
|
||||
description: 'ID of the associated Contact.',
|
||||
},
|
||||
{
|
||||
displayName: 'Description',
|
||||
|
@ -390,9 +391,9 @@ export const caseFields = [
|
|||
],
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* case:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* case:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Case ID',
|
||||
name: 'caseId',
|
||||
|
@ -409,11 +410,12 @@ 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 */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Case ID',
|
||||
name: 'caseId',
|
||||
|
@ -430,11 +432,12 @@ 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 */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
|
@ -493,6 +496,69 @@ export const caseFields = [
|
|||
},
|
||||
},
|
||||
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',
|
||||
name: 'fields',
|
||||
|
@ -503,9 +569,9 @@ export const caseFields = [
|
|||
],
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* case:addComment */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* case:addComment */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Case ID',
|
||||
name: 'caseId',
|
||||
|
@ -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',
|
||||
|
|
|
@ -43,7 +43,7 @@ export const contactOperations = [
|
|||
{
|
||||
name: 'Get Summary',
|
||||
value: 'getSummary',
|
||||
description: `Returns an overview of contact's metadata.`,
|
||||
description: `Returns an overview of contact's metadata`,
|
||||
},
|
||||
{
|
||||
name: 'Get All',
|
||||
|
@ -63,9 +63,9 @@ export const contactOperations = [
|
|||
|
||||
export const contactFields = [
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* contact:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* contact:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Last Name',
|
||||
name: 'lastname',
|
||||
|
@ -335,13 +335,6 @@ export const contactFields = [
|
|||
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',
|
||||
|
@ -349,11 +342,19 @@ export const contactFields = [
|
|||
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:update */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* contact:update */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Contact ID',
|
||||
name: 'contactId',
|
||||
|
@ -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',
|
||||
|
@ -640,9 +641,9 @@ export const contactFields = [
|
|||
],
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* contact:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* contact:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Contact ID',
|
||||
name: 'contactId',
|
||||
|
@ -659,11 +660,12 @@ 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 */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Contact ID',
|
||||
name: 'contactId',
|
||||
|
@ -680,11 +682,12 @@ 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 */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
|
@ -743,6 +746,69 @@ export const contactFields = [
|
|||
},
|
||||
},
|
||||
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',
|
||||
name: 'fields',
|
||||
|
@ -753,9 +819,9 @@ export const contactFields = [
|
|||
],
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* contact:addToCampaign */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* contact:addToCampaign */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Contact ID',
|
||||
name: 'contactId',
|
||||
|
@ -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',
|
||||
|
@ -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',
|
||||
|
@ -817,13 +883,14 @@ export const contactFields = [
|
|||
name: 'status',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Controls the HasResponded flag on this object',
|
||||
description: 'Controls the HasResponded flag on this object.',
|
||||
},
|
||||
],
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* contact:addNote */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* contact:addNote */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Contact ID',
|
||||
name: 'contactId',
|
||||
|
@ -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',
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
export interface IContact {
|
||||
LastName?: string;
|
||||
Fax?: string;
|
||||
|
@ -8,7 +7,7 @@ export interface IContact {
|
|||
Jigsaw?: string;
|
||||
OwnerId?: string;
|
||||
AccountId?: string;
|
||||
Birthdate?:string;
|
||||
Birthdate?: string;
|
||||
FirstName?: string;
|
||||
HomePhone?: string;
|
||||
OtherCity?: string;
|
||||
|
|
|
@ -48,9 +48,9 @@ export const customObjectOperations = [
|
|||
|
||||
export const customObjectFields = [
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* customObject:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* customObject:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Custom Object',
|
||||
name: 'customObject',
|
||||
|
@ -70,7 +70,7 @@ export const customObjectFields = [
|
|||
],
|
||||
},
|
||||
},
|
||||
description: 'Name of the custom object',
|
||||
description: 'Name of the custom object.',
|
||||
},
|
||||
{
|
||||
displayName: 'Fields',
|
||||
|
@ -90,7 +90,7 @@ export const customObjectFields = [
|
|||
],
|
||||
},
|
||||
},
|
||||
description: 'Filter by custom fields ',
|
||||
description: 'Filter by custom fields.',
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
|
@ -121,9 +121,10 @@ export const customObjectFields = [
|
|||
},
|
||||
],
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* customObject:update */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* customObject:update */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Custom Object',
|
||||
name: 'customObject',
|
||||
|
@ -161,7 +162,7 @@ export const customObjectFields = [
|
|||
],
|
||||
},
|
||||
},
|
||||
description: 'Record id to be updated',
|
||||
description: 'Record ID to be updated.',
|
||||
},
|
||||
{
|
||||
displayName: 'Fields',
|
||||
|
@ -212,9 +213,10 @@ export const customObjectFields = [
|
|||
},
|
||||
],
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* customObject:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* customObject:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Custom Object',
|
||||
name: 'customObject',
|
||||
|
@ -252,11 +254,12 @@ export const customObjectFields = [
|
|||
],
|
||||
},
|
||||
},
|
||||
description: 'Record id to be retrieved',
|
||||
description: 'Record ID to be retrieved.',
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* customObject:delete */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* customObject:delete */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Custom Object',
|
||||
name: 'customObject',
|
||||
|
@ -276,7 +279,7 @@ export const customObjectFields = [
|
|||
],
|
||||
},
|
||||
},
|
||||
description: 'Name of the custom object',
|
||||
description: 'Name of the custom object.',
|
||||
},
|
||||
{
|
||||
displayName: 'Record ID',
|
||||
|
@ -294,11 +297,12 @@ export const customObjectFields = [
|
|||
],
|
||||
},
|
||||
},
|
||||
description: 'Record id to be deleted',
|
||||
description: 'Record ID to be deleted.',
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* customObject:getAll */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* customObject:getAll */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Custom Object',
|
||||
name: 'customObject',
|
||||
|
@ -378,6 +382,72 @@ export const customObjectFields = [
|
|||
},
|
||||
},
|
||||
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',
|
||||
name: 'fields',
|
||||
|
|
|
@ -33,9 +33,9 @@ export const flowOperations = [
|
|||
|
||||
export const flowFields = [
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* flow:getAll */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* flow:getAll */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
|
@ -77,9 +77,10 @@ export const flowFields = [
|
|||
default: 100,
|
||||
description: 'How many results to return.',
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* flow:invoke */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* flow:invoke */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'API Name',
|
||||
name: 'apiName',
|
||||
|
@ -133,7 +134,7 @@ export const flowFields = [
|
|||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'Input variables as JSON object',
|
||||
description: 'Input variables as JSON object.',
|
||||
},
|
||||
{
|
||||
displayName: 'Variables',
|
||||
|
|
|
@ -134,3 +134,55 @@ function getAccessToken(this: IExecuteFunctions | IExecuteSingleFunctions | ILoa
|
|||
//@ts-ignore
|
||||
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',
|
||||
value: 'getSummary',
|
||||
description: `Returns an overview of Lead's metadata.`,
|
||||
description: `Returns an overview of Lead's metadata`,
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
|
@ -63,9 +63,9 @@ export const leadOperations = [
|
|||
|
||||
export const leadFields = [
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* lead:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* lead:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Company',
|
||||
name: 'company',
|
||||
|
@ -299,7 +299,7 @@ export const leadFields = [
|
|||
name: 'street',
|
||||
type: 'string',
|
||||
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',
|
||||
|
@ -317,9 +317,10 @@ export const leadFields = [
|
|||
},
|
||||
],
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* lead:update */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* lead:update */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Lead ID',
|
||||
name: 'leadId',
|
||||
|
@ -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',
|
||||
|
@ -549,7 +550,7 @@ export const leadFields = [
|
|||
name: 'street',
|
||||
type: 'string',
|
||||
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',
|
||||
|
@ -568,9 +569,9 @@ export const leadFields = [
|
|||
],
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* lead:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* lead:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Lead ID',
|
||||
name: 'leadId',
|
||||
|
@ -587,11 +588,12 @@ 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 */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Lead ID',
|
||||
name: 'leadId',
|
||||
|
@ -608,11 +610,12 @@ 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 */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
|
@ -671,6 +674,69 @@ export const leadFields = [
|
|||
},
|
||||
},
|
||||
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',
|
||||
name: 'fields',
|
||||
|
@ -680,9 +746,10 @@ export const leadFields = [
|
|||
},
|
||||
],
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* contact:addToCampaign */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* contact:addToCampaign */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Lead ID',
|
||||
name: 'leadId',
|
||||
|
@ -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',
|
||||
|
@ -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',
|
||||
|
@ -744,13 +811,14 @@ export const leadFields = [
|
|||
name: 'status',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Controls the HasResponded flag on this object',
|
||||
description: 'Controls the HasResponded flag on this object.',
|
||||
},
|
||||
],
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* lead:addNote */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* lead:addNote */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Lead ID',
|
||||
name: 'leadId',
|
||||
|
@ -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',
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
export interface ILead {
|
||||
Company?: string;
|
||||
LastName?: string;
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
export interface INote {
|
||||
Title?: string;
|
||||
ParentId?: string;
|
||||
|
|
|
@ -43,7 +43,7 @@ export const opportunityOperations = [
|
|||
{
|
||||
name: 'Get Summary',
|
||||
value: 'getSummary',
|
||||
description: `Returns an overview of opportunity's metadata.`,
|
||||
description: `Returns an overview of opportunity's metadata`,
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
|
@ -58,9 +58,9 @@ export const opportunityOperations = [
|
|||
|
||||
export const opportunityFields = [
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* opportunity:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* opportunity:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Name',
|
||||
name: 'name',
|
||||
|
@ -163,7 +163,7 @@ export const opportunityFields = [
|
|||
loadOptionsMethod: 'getCampaigns',
|
||||
},
|
||||
default: '',
|
||||
description: 'Id of the campaign that needs to be fetched',
|
||||
description: 'ID of the campaign that needs to be fetched.',
|
||||
},
|
||||
{
|
||||
displayName: 'Custom Fields',
|
||||
|
@ -250,7 +250,7 @@ export const opportunityFields = [
|
|||
description: 'Phone number for the opportunity.',
|
||||
},
|
||||
{
|
||||
displayName: 'Pricebook2 Id',
|
||||
displayName: 'Pricebook2 ID',
|
||||
name: 'pricebook2Id',
|
||||
type: 'string',
|
||||
default: '',
|
||||
|
@ -285,9 +285,10 @@ export const opportunityFields = [
|
|||
},
|
||||
],
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* opportunity:update */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* opportunity:update */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Opportunity ID',
|
||||
name: 'opportunityId',
|
||||
|
@ -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',
|
||||
|
@ -341,7 +342,7 @@ export const opportunityFields = [
|
|||
numberPrecision: 2,
|
||||
},
|
||||
default: '',
|
||||
description: 'Estimated total sale amount',
|
||||
description: 'Estimated total sale amount.',
|
||||
},
|
||||
{
|
||||
displayName: 'Campaign',
|
||||
|
@ -351,7 +352,7 @@ export const opportunityFields = [
|
|||
loadOptionsMethod: 'getCampaigns',
|
||||
},
|
||||
default: '',
|
||||
description: 'Id of the campaign that needs to be fetched',
|
||||
description: 'ID of the campaign that needs to be fetched.',
|
||||
},
|
||||
{
|
||||
displayName: 'Close Date',
|
||||
|
@ -408,7 +409,7 @@ export const opportunityFields = [
|
|||
name: 'forecastCategoryName',
|
||||
type: 'string',
|
||||
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',
|
||||
|
@ -452,7 +453,7 @@ export const opportunityFields = [
|
|||
description: 'Phone number for the opportunity.',
|
||||
},
|
||||
{
|
||||
displayName: 'Pricebook2 Id',
|
||||
displayName: 'Pricebook2 ID',
|
||||
name: 'pricebook2Id',
|
||||
type: 'string',
|
||||
default: '',
|
||||
|
@ -466,7 +467,7 @@ export const opportunityFields = [
|
|||
numberPrecision: 1,
|
||||
},
|
||||
default: '',
|
||||
description: 'Percentage of estimated confidence in closing the opportunity',
|
||||
description: 'Percentage of estimated confidence in closing the opportunity.',
|
||||
},
|
||||
{
|
||||
displayName: 'Stage Name',
|
||||
|
@ -498,9 +499,9 @@ export const opportunityFields = [
|
|||
],
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* opportunity:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* opportunity:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Opportunity ID',
|
||||
name: 'opportunityId',
|
||||
|
@ -517,11 +518,12 @@ 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 */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Opportunity ID',
|
||||
name: 'opportunityId',
|
||||
|
@ -538,11 +540,12 @@ 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 */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
|
@ -601,6 +604,69 @@ export const opportunityFields = [
|
|||
},
|
||||
},
|
||||
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',
|
||||
name: 'fields',
|
||||
|
@ -611,9 +677,9 @@ export const opportunityFields = [
|
|||
],
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* opportunity:addNote */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* opportunity:addNote */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Opportunity ID',
|
||||
name: 'opportunityId',
|
||||
|
@ -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',
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
export interface IOpportunity {
|
||||
Name?: string;
|
||||
StageName?: string;
|
||||
|
@ -12,6 +11,6 @@ export interface IOpportunity {
|
|||
LeadSource?: string;
|
||||
Description?: string;
|
||||
Probability?: number;
|
||||
Pricebook2Id?:string;
|
||||
Pricebook2Id?: string;
|
||||
ForecastCategoryName?: string;
|
||||
}
|
||||
|
|
|
@ -63,6 +63,7 @@ import {
|
|||
} from './FlowDescription';
|
||||
|
||||
import {
|
||||
getQuery,
|
||||
salesforceApiRequest,
|
||||
salesforceApiRequestAllItems,
|
||||
sortOptions,
|
||||
|
@ -90,6 +91,11 @@ import {
|
|||
IOpportunity,
|
||||
} from './OpportunityInterface';
|
||||
|
||||
import {
|
||||
searchFields,
|
||||
searchOperations,
|
||||
} from './SearchDescription';
|
||||
|
||||
import {
|
||||
taskFields,
|
||||
taskOperations,
|
||||
|
@ -104,10 +110,6 @@ import {
|
|||
userOperations,
|
||||
} from './UserDescription';
|
||||
|
||||
import {
|
||||
IUser,
|
||||
} from './UserInterface';
|
||||
|
||||
export class Salesforce implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'Salesforce',
|
||||
|
@ -210,6 +212,11 @@ export class Salesforce implements INodeType {
|
|||
value: 'opportunity',
|
||||
description: 'Represents an opportunity, which is a sale or pending deal.',
|
||||
},
|
||||
{
|
||||
name: 'Search',
|
||||
value: 'search',
|
||||
description: 'Search records',
|
||||
},
|
||||
{
|
||||
name: 'Task',
|
||||
value: 'task',
|
||||
|
@ -234,6 +241,8 @@ export class Salesforce implements INodeType {
|
|||
...opportunityFields,
|
||||
...accountOperations,
|
||||
...accountFields,
|
||||
...searchOperations,
|
||||
...searchFields,
|
||||
...caseOperations,
|
||||
...caseFields,
|
||||
...taskOperations,
|
||||
|
@ -700,6 +709,142 @@ export class Salesforce implements INodeType {
|
|||
sortOptions(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,21 +1039,16 @@ export class Salesforce implements INodeType {
|
|||
if (operation === 'getAll') {
|
||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
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 {
|
||||
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);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
throw new Error(`Salesforce Error: ${err}`);
|
||||
}
|
||||
}
|
||||
|
@ -917,7 +1057,7 @@ export class Salesforce implements INodeType {
|
|||
const leadId = this.getNodeParameter('leadId', i) as string;
|
||||
try {
|
||||
responseData = await salesforceApiRequest.call(this, 'DELETE', `/sobjects/lead/${leadId}`);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
throw new Error(`Salesforce Error: ${err}`);
|
||||
}
|
||||
}
|
||||
|
@ -1187,21 +1327,16 @@ export class Salesforce implements INodeType {
|
|||
if (operation === 'getAll') {
|
||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
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 {
|
||||
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);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
throw new Error(`Salesforce Error: ${err}`);
|
||||
}
|
||||
}
|
||||
|
@ -1210,7 +1345,7 @@ export class Salesforce implements INodeType {
|
|||
const contactId = this.getNodeParameter('contactId', i) as string;
|
||||
try {
|
||||
responseData = await salesforceApiRequest.call(this, 'DELETE', `/sobjects/contact/${contactId}`);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
throw new Error(`Salesforce Error: ${err}`);
|
||||
}
|
||||
}
|
||||
|
@ -1294,20 +1429,16 @@ export class Salesforce implements INodeType {
|
|||
const customObject = this.getNodeParameter('customObject', i) as string;
|
||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
const options = this.getNodeParameter('options', i) as IDataObject;
|
||||
let fields = ['id'];
|
||||
if (options.fields) {
|
||||
fields = options.fields as string[];
|
||||
}
|
||||
try {
|
||||
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);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
throw new Error(`Salesforce Error: ${err}`);
|
||||
}
|
||||
}
|
||||
|
@ -1316,7 +1447,7 @@ export class Salesforce implements INodeType {
|
|||
const recordId = this.getNodeParameter('recordId', i) as string;
|
||||
try {
|
||||
responseData = await salesforceApiRequest.call(this, 'DELETE', `/sobjects/${customObject}/${recordId}`);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
throw new Error(`Salesforce Error: ${err}`);
|
||||
}
|
||||
}
|
||||
|
@ -1444,21 +1575,16 @@ export class Salesforce implements INodeType {
|
|||
if (operation === 'getAll') {
|
||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
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 {
|
||||
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);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
throw new Error(`Salesforce Error: ${err}`);
|
||||
}
|
||||
}
|
||||
|
@ -1467,7 +1593,7 @@ export class Salesforce implements INodeType {
|
|||
const opportunityId = this.getNodeParameter('opportunityId', i) as string;
|
||||
try {
|
||||
responseData = await salesforceApiRequest.call(this, 'DELETE', `/sobjects/opportunity/${opportunityId}`);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
throw new Error(`Salesforce Error: ${err}`);
|
||||
}
|
||||
}
|
||||
|
@ -1687,21 +1813,16 @@ export class Salesforce implements INodeType {
|
|||
if (operation === 'getAll') {
|
||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
const options = this.getNodeParameter('options', i) as IDataObject;
|
||||
const fields = ['id,name,type'];
|
||||
if (options.fields) {
|
||||
// @ts-ignore
|
||||
fields.push(...options.fields.split(','));
|
||||
}
|
||||
try {
|
||||
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);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
throw new Error(`Salesforce Error: ${err}`);
|
||||
}
|
||||
}
|
||||
|
@ -1710,7 +1831,7 @@ export class Salesforce implements INodeType {
|
|||
const accountId = this.getNodeParameter('accountId', i) as string;
|
||||
try {
|
||||
responseData = await salesforceApiRequest.call(this, 'DELETE', `/sobjects/account/${accountId}`);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
throw new Error(`Salesforce Error: ${err}`);
|
||||
}
|
||||
}
|
||||
|
@ -1852,21 +1973,16 @@ export class Salesforce implements INodeType {
|
|||
if (operation === 'getAll') {
|
||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
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 {
|
||||
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);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
throw new Error(`Salesforce Error: ${err}`);
|
||||
}
|
||||
}
|
||||
|
@ -1875,7 +1991,7 @@ export class Salesforce implements INodeType {
|
|||
const caseId = this.getNodeParameter('caseId', i) as string;
|
||||
try {
|
||||
responseData = await salesforceApiRequest.call(this, 'DELETE', `/sobjects/case/${caseId}`);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
throw new Error(`Salesforce Error: ${err}`);
|
||||
}
|
||||
}
|
||||
|
@ -2084,21 +2200,16 @@ export class Salesforce implements INodeType {
|
|||
if (operation === 'getAll') {
|
||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
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 {
|
||||
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);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
throw new Error(`Salesforce Error: ${err}`);
|
||||
}
|
||||
}
|
||||
|
@ -2107,7 +2218,7 @@ export class Salesforce implements INodeType {
|
|||
const taskId = this.getNodeParameter('taskId', i) as string;
|
||||
try {
|
||||
responseData = await salesforceApiRequest.call(this, 'DELETE', `/sobjects/task/${taskId}`);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
throw new Error(`Salesforce Error: ${err}`);
|
||||
}
|
||||
}
|
||||
|
@ -2181,21 +2292,16 @@ export class Salesforce implements INodeType {
|
|||
if (operation === 'getAll') {
|
||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
const options = this.getNodeParameter('options', i) as IDataObject;
|
||||
const fields = ['id,name'];
|
||||
if (options.fields) {
|
||||
// @ts-ignore
|
||||
fields.push(...options.fields.split(','));
|
||||
}
|
||||
try {
|
||||
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);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
throw new Error(`Salesforce Error: ${err}`);
|
||||
}
|
||||
}
|
||||
|
@ -2204,7 +2310,7 @@ export class Salesforce implements INodeType {
|
|||
const attachmentId = this.getNodeParameter('attachmentId', i) as string;
|
||||
try {
|
||||
responseData = await salesforceApiRequest.call(this, 'DELETE', `/sobjects/attachment/${attachmentId}`);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
throw new Error(`Salesforce Error: ${err}`);
|
||||
}
|
||||
}
|
||||
|
@ -2223,21 +2329,16 @@ export class Salesforce implements INodeType {
|
|||
if (operation === 'getAll') {
|
||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
const options = this.getNodeParameter('options', i) as IDataObject;
|
||||
const fields = ['id,name,email'];
|
||||
if (options.fields) {
|
||||
// @ts-ignore
|
||||
fields.push(...options.fields.split(','));
|
||||
}
|
||||
try {
|
||||
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);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
throw new Error(`Salesforce Error: ${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)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} 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',
|
||||
value: 'getSummary',
|
||||
description: `Returns an overview of task's metadata.`,
|
||||
description: `Returns an overview of task's metadata`,
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
|
@ -53,9 +53,9 @@ export const taskOperations = [
|
|||
|
||||
export const taskFields = [
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* task:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* task:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Status',
|
||||
name: 'status',
|
||||
|
@ -407,9 +407,10 @@ export const taskFields = [
|
|||
},
|
||||
],
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* task:update */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* task:update */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Task ID',
|
||||
name: 'taskId',
|
||||
|
@ -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',
|
||||
|
@ -769,9 +770,9 @@ export const taskFields = [
|
|||
],
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* task:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* task:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Task ID',
|
||||
name: 'taskId',
|
||||
|
@ -788,11 +789,12 @@ 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 */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Task ID',
|
||||
name: 'taskId',
|
||||
|
@ -809,11 +811,12 @@ 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 */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
|
@ -872,6 +875,69 @@ export const taskFields = [
|
|||
},
|
||||
},
|
||||
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',
|
||||
name: 'fields',
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
export interface ITask {
|
||||
WhoId?: string;
|
||||
Status?: string;
|
||||
|
@ -12,7 +11,7 @@ export interface ITask {
|
|||
ActivityDate?: string;
|
||||
IsReminderSet?: boolean;
|
||||
RecurrenceType?: string;
|
||||
CallDisposition?:string;
|
||||
CallDisposition?: string;
|
||||
ReminderDateTime?: string;
|
||||
RecurrenceInstance?: string;
|
||||
RecurrenceInterval?: number;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {
|
||||
INodeProperties,
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export const userOperations = [
|
||||
|
@ -32,6 +32,7 @@ export const userOperations = [
|
|||
] as INodeProperties[];
|
||||
|
||||
export const userFields = [
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* 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 */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
@ -114,6 +116,69 @@ export const userFields = [
|
|||
},
|
||||
},
|
||||
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',
|
||||
name: 'fields',
|
||||
|
|
Loading…
Reference in a new issue