Add upsert operation to various resources (Salesforce) (#1743)

*  Add upsert operation to various resources (Salesforce)

The operation was added to the resources: Contact, Account, Lead, Opportunity and Custom Object.

*  Rename operation create/update to Create or Update

*  Improvements

Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
This commit is contained in:
Ricardo Espinoza
2021-06-09 23:25:20 -04:00
committed by GitHub
parent e298d2a1a8
commit 6ade0a00f5
11 changed files with 349 additions and 15 deletions

View File

@@ -25,6 +25,11 @@ export const opportunityOperations = [
value: 'create',
description: 'Create an opportunity',
},
{
name: 'Create or Update',
value: 'upsert',
description: 'Create a new opportunity, or update the current one if it already exists (upsert)',
},
{
name: 'Delete',
value: 'delete',
@@ -61,6 +66,48 @@ export const opportunityFields = [
/* -------------------------------------------------------------------------- */
/* opportunity:create */
/* -------------------------------------------------------------------------- */
{
displayName: 'Match Against',
name: 'externalId',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getExternalIdFields',
loadOptionsDependsOn: [
'resource',
],
},
required: true,
default: '',
displayOptions: {
show: {
resource: [
'opportunity',
],
operation: [
'upsert',
],
},
},
description: `The field to check to see if the opportunity already exists`,
},
{
displayName: 'Value to Match',
name: 'externalIdValue',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: [
'opportunity',
],
operation: [
'upsert',
],
},
},
description: `If this value exists in the 'match against' field, update the opportunity. Otherwise create a new one`,
},
{
displayName: 'Name',
name: 'name',
@@ -74,6 +121,7 @@ export const opportunityFields = [
],
operation: [
'create',
'upsert',
],
},
},
@@ -92,6 +140,7 @@ export const opportunityFields = [
],
operation: [
'create',
'upsert',
],
},
},
@@ -113,6 +162,7 @@ export const opportunityFields = [
],
operation: [
'create',
'upsert',
],
},
},
@@ -131,6 +181,7 @@ export const opportunityFields = [
],
operation: [
'create',
'upsert',
],
},
},