From 46f69c164fe8bb9ee05c0da52750880cb254173a Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sun, 9 Jun 2024 20:07:59 -0300 Subject: [PATCH 001/106] Converting common file to dual-mode source --- .../sources/common-instant.mjs | 146 ------------------ .../sources/common-webhook-methods.mjs | 71 +++++++++ .../salesforce_rest_api/sources/common.mjs | 110 +++++++++++-- .../new-record-instant/new-record-instant.mjs | 2 +- 4 files changed, 166 insertions(+), 163 deletions(-) delete mode 100644 components/salesforce_rest_api/sources/common-instant.mjs create mode 100644 components/salesforce_rest_api/sources/common-webhook-methods.mjs diff --git a/components/salesforce_rest_api/sources/common-instant.mjs b/components/salesforce_rest_api/sources/common-instant.mjs deleted file mode 100644 index 68334cdf739ad..0000000000000 --- a/components/salesforce_rest_api/sources/common-instant.mjs +++ /dev/null @@ -1,146 +0,0 @@ -import { v4 as uuidv4 } from "uuid"; -import salesforce from "../salesforce_rest_api.app.mjs"; -import salesforceWebhooks from "salesforce-webhooks"; - -const { SalesforceClient } = salesforceWebhooks; - -export default { - dedupe: "unique", - props: { - salesforce, - db: "$.service.db", - // eslint-disable-next-line pipedream/props-label,pipedream/props-description - http: { - type: "$.interface.http", - customResponse: true, - }, - objectType: { - label: "Object Type", - description: "The type of object for which to monitor events", - propDefinition: [ - salesforce, - "objectType", - ], - }, - }, - hooks: { - async activate() { - // Retrieve metadata about the SObject specified by the user - const nameField = await this.salesforce.getNameFieldForObjectType(this.objectType); - this.setNameField(nameField); - - // Create the webhook in the Salesforce platform - const secretToken = uuidv4(); - let webhookData; - try { - webhookData = await this.createWebhook({ - endpointUrl: this.http.endpoint, - sObjectType: this.objectType, - event: this.getEventType(), - secretToken, - fieldsToCheck: this.getFieldsToCheck(), - fieldsToCheckMode: this.getFieldsToCheckMode(), - skipValidation: true, // neccessary for custom objects - }); - } catch (err) { - console.log("Create webhook error:", err); - throw err; - } - this._setSecretToken(secretToken); - this._setWebhookData(webhookData); - }, - async deactivate() { - // Create the webhook from the Salesforce platform - const webhookData = this._getWebhookData(); - await this.deleteWebhook(webhookData); - }, - }, - methods: { - getClient() { - const { salesforce } = this; - return new SalesforceClient({ - apiVersion: salesforce._apiVersion(), - authToken: salesforce._authToken(), - instance: salesforce._subdomain(), - }); - }, - createWebhook(args = {}) { - const client = this.getClient(); - return client.createWebhook(args); - }, - deleteWebhook(args = {}) { - const client = this.getClient(); - return client.deleteWebhook(args); - }, - _getSecretToken() { - return this.db.get("secretToken"); - }, - _setSecretToken(secretToken) { - this.db.set("secretToken", secretToken); - }, - _getWebhookData() { - return this.db.get("webhookData"); - }, - _setWebhookData(webhookData) { - this.db.set("webhookData", webhookData); - }, - getNameField() { - return this.db.get("nameField"); - }, - setNameField(nameField) { - this.db.set("nameField", nameField); - }, - _isValidSource(event) { - const webhookToken = event.headers["x-webhook-token"]; - const secretToken = this._getSecretToken(); - return webhookToken === secretToken; - }, - processEvent(event) { - const { body } = event; - const meta = this.generateMeta(event); - this.$emit(body, meta); - }, - generateMeta() { - throw new Error("generateMeta is not implemented"); - }, - getEventType() { - throw new Error("getEventType is not implemented"); - }, - /** - * This method returns the fields in the SObject type (e.g. Account, Lead, etc.) that the event - * source should listen for updates to. This base implementation returns `undefined`, to not - * necessitate any specific fields to be updated. - * - * @returns the fields in the SObject type for which to receive updates - */ - getFieldsToCheck() { - return undefined; - }, - /** - * This method returns whether the event source should listen for updates where `all` the fields - * in the SObject are updated, or when `any` of them are. This base implementation returns - * `undefined` to use to client's default `fieldToCheckMode` (`any`). - * - * @returns whether the webhook should receive events when `all` the fields to check are - * updated, or when `any` of them are - */ - getFieldsToCheckMode() { - return undefined; - }, - }, - async run(event) { - if (!this._isValidSource(event)) { - this.http.respond({ - statusCode: 404, - }); - console.log("Skipping event from unrecognized source"); - return; - } - - this.http.respond({ - statusCode: 200, - }); - - await this.processEvent(event); - }, -}; diff --git a/components/salesforce_rest_api/sources/common-webhook-methods.mjs b/components/salesforce_rest_api/sources/common-webhook-methods.mjs new file mode 100644 index 0000000000000..bfc8022fcede9 --- /dev/null +++ b/components/salesforce_rest_api/sources/common-webhook-methods.mjs @@ -0,0 +1,71 @@ +import salesforceWebhooks from "salesforce-webhooks"; + +const { SalesforceClient } = salesforceWebhooks; + +export default { + getClient() { + const { salesforce } = this; + return new SalesforceClient({ + apiVersion: salesforce._apiVersion(), + authToken: salesforce._authToken(), + instance: salesforce._subdomain(), + }); + }, + createWebhook(args = {}) { + const client = this.getClient(); + return client.createWebhook(args); + }, + deleteWebhook(args = {}) { + const client = this.getClient(); + return client.deleteWebhook(args); + }, + _getSecretToken() { + return this.db.get("secretToken"); + }, + _setSecretToken(secretToken) { + this.db.set("secretToken", secretToken); + }, + _getWebhookData() { + return this.db.get("webhookData"); + }, + _setWebhookData(webhookData) { + this.db.set("webhookData", webhookData); + }, + _isValidSource(event) { + const webhookToken = event.headers["x-webhook-token"]; + const secretToken = this._getSecretToken(); + return webhookToken === secretToken; + }, + processEvent(event) { + const { body } = event; + const meta = this.generateMeta(event); + this.$emit(body, meta); + }, + generateMeta() { + throw new Error("generateMeta is not implemented"); + }, + getEventType() { + throw new Error("getEventType is not implemented"); + }, + /** + * This method returns the fields in the SObject type (e.g. Account, Lead, etc.) that the event + * source should listen for updates to. This base implementation returns `undefined`, to not + * necessitate any specific fields to be updated. + * + * @returns the fields in the SObject type for which to receive updates + */ + getFieldsToCheck() { + return undefined; + }, + /** + * This method returns whether the event source should listen for updates where `all` the fields + * in the SObject are updated, or when `any` of them are. This base implementation returns + * `undefined` to use to client's default `fieldToCheckMode` (`any`). + * + * @returns whether the webhook should receive events when `all` the fields to check are + * updated, or when `any` of them are + */ + getFieldsToCheckMode() { + return undefined; + }, +}; diff --git a/components/salesforce_rest_api/sources/common.mjs b/components/salesforce_rest_api/sources/common.mjs index 2dc2c4f45d42c..627ba7a02b95f 100644 --- a/components/salesforce_rest_api/sources/common.mjs +++ b/components/salesforce_rest_api/sources/common.mjs @@ -1,21 +1,41 @@ import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform"; import salesforce from "../salesforce_rest_api.app.mjs"; import constants from "../common/constants.mjs"; +import { v4 as uuidv4 } from "uuid"; +import commonWebhookMethods from "./common-webhook-methods.mjs"; export default { dedupe: "unique", props: { salesforce, + alertTest1: { + type: "alert", + alertType: "info", + content: "Test Alert 1", + }, db: "$.service.db", - // eslint-disable-next-line pipedream/props-label,pipedream/props-description + http: { + type: "$.interface.http", + customResponse: true, + }, + alertTest2: { + type: "alert", + alertType: "info", + content: "Test Alert 2", + }, timer: { type: "$.interface.timer", + description: "test description", default: { intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL, }, }, + alertTest3: { + type: "alert", + alertType: "info", + content: "Test Alert 3", + }, objectType: { - type: "string", label: "Object Type", description: "The type of object for which to monitor events", propDefinition: [ @@ -23,6 +43,11 @@ export default { "objectType", ], }, + alertTest4: { + type: "alert", + alertType: "info", + content: "Test Alert 4", + }, }, hooks: { async activate() { @@ -34,9 +59,38 @@ export default { const nameField = await this.salesforce.getNameFieldForObjectType(this.objectType); this.setNameField(nameField); + + // Attempt to create the webhook + const secretToken = uuidv4(); + let webhookData; + try { + webhookData = await this.createWebhook({ + endpointUrl: this.http.endpoint, + sObjectType: this.objectType, + event: this.getEventType(), + secretToken, + fieldsToCheck: this.getFieldsToCheck(), + fieldsToCheckMode: this.getFieldsToCheckMode(), + skipValidation: true, // neccessary for custom objects + }); + } catch (err) { + console.log("Error creating webhook:", err); + console.log("The source will operate on the polling schedule instead."); + throw err; + } + this._setSecretToken(secretToken); + this._setWebhookData(webhookData); + }, + async deactivate() { + // Delete the webhook, if it exists + const webhookData = this._getWebhookData(); + if (webhookData) { + await this.deleteWebhook(webhookData); + } }, }, methods: { + ...commonWebhookMethods, getObjectTypeColumns() { return this.db.get("columns") ?? []; }, @@ -120,21 +174,45 @@ export default { }, }, async run(event) { - const startTimestamp = this.getLatestDateCovered(); - const endTimestamp = new Date(event.timestamp * 1000).toISOString(); - const timeDiffSec = Math.floor( - (Date.parse(endTimestamp) - Date.parse(startTimestamp)) / 1000, - ); - if (timeDiffSec < 60) { - console.log(` - Skipping execution since the last one happened approximately ${timeDiffSec} seconds ago - `); - return; + // Timer event + if (event.timestamp) { + if (this._getWebhookData()) { + console.log("Ignoring timer event (webhook active)"); + return; + } + const startTimestamp = this.getLatestDateCovered(); + const endTimestamp = new Date(event.timestamp * 1000).toISOString(); + const timeDiffSec = Math.floor( + (Date.parse(endTimestamp) - Date.parse(startTimestamp)) / 1000, + ); + if (timeDiffSec < 60) { + console.log(` + Skipping execution since the last one happened approximately ${timeDiffSec} seconds ago + `); + return; + } + + await this.processEvent({ + startTimestamp, + endTimestamp, + }); } - await this.processEvent({ - startTimestamp, - endTimestamp, - }); + // Webhook event + else { + if (!this._isValidSource(event)) { + this.http.respond({ + statusCode: 404, + }); + console.log("Skipping event from unrecognized source"); + return; + } + + this.http.respond({ + statusCode: 200, + }); + + await this.processEvent(event); + } }, }; diff --git a/components/salesforce_rest_api/sources/new-record-instant/new-record-instant.mjs b/components/salesforce_rest_api/sources/new-record-instant/new-record-instant.mjs index a2f13fbdaafdd..33325fd8f26bb 100644 --- a/components/salesforce_rest_api/sources/new-record-instant/new-record-instant.mjs +++ b/components/salesforce_rest_api/sources/new-record-instant/new-record-instant.mjs @@ -15,7 +15,7 @@ export default { const nameField = await this.salesforce.getNameFieldForObjectType(objectType); this.setNameField(nameField); - // emit hisorical events + // emit historical events const { recentItems } = await this.salesforce.listSObjectTypeIds(objectType); const ids = recentItems.map((item) => item.Id); for (const id of ids.slice(-25)) { From c76eed7571ebde06c98e1f01f522294361b1dc56 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sun, 9 Jun 2024 20:35:14 -0300 Subject: [PATCH 002/106] New Record dual-mode source --- .../sources/common-webhook-methods.mjs | 8 +- .../salesforce_rest_api/sources/common.mjs | 15 ++- .../new-record-instant/new-record-instant.mjs | 84 ++++++++++++++++- .../sources/new-record/new-record.mjs | 91 ------------------- 4 files changed, 94 insertions(+), 104 deletions(-) delete mode 100644 components/salesforce_rest_api/sources/new-record/new-record.mjs diff --git a/components/salesforce_rest_api/sources/common-webhook-methods.mjs b/components/salesforce_rest_api/sources/common-webhook-methods.mjs index bfc8022fcede9..7e65d8842e129 100644 --- a/components/salesforce_rest_api/sources/common-webhook-methods.mjs +++ b/components/salesforce_rest_api/sources/common-webhook-methods.mjs @@ -36,13 +36,13 @@ export default { const secretToken = this._getSecretToken(); return webhookToken === secretToken; }, - processEvent(event) { + processWebhookEvent(event) { const { body } = event; - const meta = this.generateMeta(event); + const meta = this.generateWebhookMeta(event); this.$emit(body, meta); }, - generateMeta() { - throw new Error("generateMeta is not implemented"); + generateWebhookMeta() { + throw new Error("generateWebhookMeta is not implemented"); }, getEventType() { throw new Error("getEventType is not implemented"); diff --git a/components/salesforce_rest_api/sources/common.mjs b/components/salesforce_rest_api/sources/common.mjs index 627ba7a02b95f..2951504ce2ea3 100644 --- a/components/salesforce_rest_api/sources/common.mjs +++ b/components/salesforce_rest_api/sources/common.mjs @@ -76,6 +76,7 @@ export default { } catch (err) { console.log("Error creating webhook:", err); console.log("The source will operate on the polling schedule instead."); + this.timerActivateHook(); throw err; } this._setSecretToken(secretToken); @@ -91,6 +92,9 @@ export default { }, methods: { ...commonWebhookMethods, + timerActivateHook() { + return null; + }, getObjectTypeColumns() { return this.db.get("columns") ?? []; }, @@ -109,8 +113,11 @@ export default { setNameField(nameField) { this.db.set("nameField", nameField); }, - processEvent() { - throw new Error("processEvent is not implemented"); + processTimerEvent() { + throw new Error("processTimerEvent is not implemented"); + }, + processWebhookEvent() { + throw new Error("processWebhookEvent is not implemented"); }, getObjectTypeDescription(objectType) { const { salesforce } = this; @@ -192,7 +199,7 @@ export default { return; } - await this.processEvent({ + await this.processTimerEvent({ startTimestamp, endTimestamp, }); @@ -212,7 +219,7 @@ export default { statusCode: 200, }); - await this.processEvent(event); + await this.processWebhookEvent(event); } }, }; diff --git a/components/salesforce_rest_api/sources/new-record-instant/new-record-instant.mjs b/components/salesforce_rest_api/sources/new-record-instant/new-record-instant.mjs index 33325fd8f26bb..2b350afbdb202 100644 --- a/components/salesforce_rest_api/sources/new-record-instant/new-record-instant.mjs +++ b/components/salesforce_rest_api/sources/new-record-instant/new-record-instant.mjs @@ -1,13 +1,14 @@ import startCase from "lodash/startCase.js"; -import common from "../common-instant.mjs"; +import common from "../common.mjs"; export default { ...common, type: "source", name: "New Record (Instant, of Selectable Type)", key: "salesforce_rest_api-new-record-instant", - description: "Emit new event immediately after a record of arbitrary object type (selected as an input parameter by the user) is created", - version: "0.0.4", + description: "Emit new event when a record of the selected object type is created", + // https://sforce.co/3yPSJZy + version: "0.0.{{ts}}", hooks: { ...common.hooks, async deploy() { @@ -26,13 +27,29 @@ export default { "UserId": id, }, }; - this.processEvent(event); + this.processWebhookEvent(event); } }, }, methods: { ...common.methods, - generateMeta(data) { + generateTimerMeta(item, fieldName) { + const { objectType } = this; + const { + CreatedDate: createdDate, + [fieldName]: name, + Id: id, + } = item; + const entityType = startCase(objectType); + const summary = `New ${entityType} created: ${name}`; + const ts = Date.parse(createdDate); + return { + id, + summary, + ts, + }; + }, + generateWebhookMeta(data) { const nameField = this.getNameField(); const { New: newObject } = data.body; const { @@ -52,5 +69,62 @@ export default { getEventType() { return "new"; }, + async processTimerEvent(eventData) { + const { + paginate, + objectType, + setLatestDateCovered, + getObjectTypeColumns, + getNameField, + generateMeta, + $emit: emit, + } = this; + + const { + startTimestamp, + endTimestamp, + } = eventData; + + const fieldName = getNameField(); + const columns = getObjectTypeColumns(); + + const events = await paginate({ + objectType, + startTimestamp, + endTimestamp, + columns, + }); + + const [ + latestEvent, + ] = events; + + if (latestEvent?.CreatedDate) { + const latestDateCovered = new Date(latestEvent.CreatedDate); + latestDateCovered.setSeconds(0); + setLatestDateCovered(latestDateCovered.toISOString()); + } + + Array.from(events) + .reverse() + .forEach((item) => { + const meta = generateMeta(item, fieldName); + emit(item, meta); + }); + }, + async timerActivateHook() { + const { + objectType, + getObjectTypeDescription, + setObjectTypeColumns, + } = this; + + await common.hooks.activate.call(this); + + const { fields } = await getObjectTypeDescription(objectType); + const columns = fields.map(({ name }) => name); + + setObjectTypeColumns(columns); + }, }, }; diff --git a/components/salesforce_rest_api/sources/new-record/new-record.mjs b/components/salesforce_rest_api/sources/new-record/new-record.mjs deleted file mode 100644 index c53ae8f19e824..0000000000000 --- a/components/salesforce_rest_api/sources/new-record/new-record.mjs +++ /dev/null @@ -1,91 +0,0 @@ -import startCase from "lodash/startCase.js"; - -import common from "../common.mjs"; - -export default { - ...common, - type: "source", - name: "New Record (of Selectable Type)", - key: "salesforce_rest_api-new-record", - description: "Emit new event (at regular intervals) when a record of arbitrary object type (selected as an input parameter by the user) is created. See [the docs](https://sforce.co/3yPSJZy) for more information.", - version: "0.0.6", - hooks: { - ...common.hooks, - async activate() { - const { - objectType, - getObjectTypeDescription, - setObjectTypeColumns, - } = this; - - await common.hooks.activate.call(this); - - const { fields } = await getObjectTypeDescription(objectType); - const columns = fields.map(({ name }) => name); - - setObjectTypeColumns(columns); - }, - }, - methods: { - ...common.methods, - generateMeta(item, fieldName) { - const { objectType } = this; - const { - CreatedDate: createdDate, - [fieldName]: name, - Id: id, - } = item; - const entityType = startCase(objectType); - const summary = `New ${entityType} created: ${name}`; - const ts = Date.parse(createdDate); - return { - id, - summary, - ts, - }; - }, - async processEvent(eventData) { - const { - paginate, - objectType, - setLatestDateCovered, - getObjectTypeColumns, - getNameField, - generateMeta, - $emit: emit, - } = this; - - const { - startTimestamp, - endTimestamp, - } = eventData; - - const fieldName = getNameField(); - const columns = getObjectTypeColumns(); - - const events = await paginate({ - objectType, - startTimestamp, - endTimestamp, - columns, - }); - - const [ - latestEvent, - ] = events; - - if (latestEvent?.CreatedDate) { - const latestDateCovered = new Date(latestEvent.CreatedDate); - latestDateCovered.setSeconds(0); - setLatestDateCovered(latestDateCovered.toISOString()); - } - - Array.from(events) - .reverse() - .forEach((item) => { - const meta = generateMeta(item, fieldName); - emit(item, meta); - }); - }, - }, -}; From be27a2a3b18a4a9d1ed397c75e381b033440a737 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sun, 9 Jun 2024 20:57:29 -0300 Subject: [PATCH 003/106] Adjustments --- .../salesforce_rest_api/sources/common.mjs | 28 +++++++++---------- .../new-record-instant/new-record-instant.mjs | 6 ++-- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/components/salesforce_rest_api/sources/common.mjs b/components/salesforce_rest_api/sources/common.mjs index 2951504ce2ea3..55d7124485efa 100644 --- a/components/salesforce_rest_api/sources/common.mjs +++ b/components/salesforce_rest_api/sources/common.mjs @@ -51,15 +51,6 @@ export default { }, hooks: { async activate() { - const latestDateCovered = this.getLatestDateCovered(); - if (!latestDateCovered) { - const now = new Date().toISOString(); - this.setLatestDateCovered(now); - } - - const nameField = await this.salesforce.getNameFieldForObjectType(this.objectType); - this.setNameField(nameField); - // Attempt to create the webhook const secretToken = uuidv4(); let webhookData; @@ -73,11 +64,21 @@ export default { fieldsToCheckMode: this.getFieldsToCheckMode(), skipValidation: true, // neccessary for custom objects }); + console.log("Webhook created successfully"); } catch (err) { console.log("Error creating webhook:", err); console.log("The source will operate on the polling schedule instead."); - this.timerActivateHook(); - throw err; + + const latestDateCovered = this.getLatestDateCovered(); + if (!latestDateCovered) { + const now = new Date().toISOString(); + this.setLatestDateCovered(now); + } + + const nameField = await this.salesforce.getNameFieldForObjectType(this.objectType); + this.setNameField(nameField); + + await this.timerActivateHook(); } this._setSecretToken(secretToken); this._setWebhookData(webhookData); @@ -116,9 +117,6 @@ export default { processTimerEvent() { throw new Error("processTimerEvent is not implemented"); }, - processWebhookEvent() { - throw new Error("processWebhookEvent is not implemented"); - }, getObjectTypeDescription(objectType) { const { salesforce } = this; return salesforce._makeRequest({ @@ -194,7 +192,7 @@ export default { ); if (timeDiffSec < 60) { console.log(` - Skipping execution since the last one happened approximately ${timeDiffSec} seconds ago + Skipping execution (already executed less than 60 seconds ago) `); return; } diff --git a/components/salesforce_rest_api/sources/new-record-instant/new-record-instant.mjs b/components/salesforce_rest_api/sources/new-record-instant/new-record-instant.mjs index 2b350afbdb202..44745b03faa3e 100644 --- a/components/salesforce_rest_api/sources/new-record-instant/new-record-instant.mjs +++ b/components/salesforce_rest_api/sources/new-record-instant/new-record-instant.mjs @@ -76,7 +76,7 @@ export default { setLatestDateCovered, getObjectTypeColumns, getNameField, - generateMeta, + generateTimerMeta, $emit: emit, } = this; @@ -108,7 +108,7 @@ export default { Array.from(events) .reverse() .forEach((item) => { - const meta = generateMeta(item, fieldName); + const meta = generateTimerMeta(item, fieldName); emit(item, meta); }); }, @@ -119,8 +119,6 @@ export default { setObjectTypeColumns, } = this; - await common.hooks.activate.call(this); - const { fields } = await getObjectTypeDescription(objectType); const columns = fields.map(({ name }) => name); From 3dad78e10a87cf18ca80386cd3af13ae8dbb6bde Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sun, 9 Jun 2024 22:57:02 -0300 Subject: [PATCH 004/106] Description adjustment --- .../salesforce_rest_api/sources/common.mjs | 22 +------------------ 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/components/salesforce_rest_api/sources/common.mjs b/components/salesforce_rest_api/sources/common.mjs index 55d7124485efa..9ee8b58b2379b 100644 --- a/components/salesforce_rest_api/sources/common.mjs +++ b/components/salesforce_rest_api/sources/common.mjs @@ -8,33 +8,18 @@ export default { dedupe: "unique", props: { salesforce, - alertTest1: { - type: "alert", - alertType: "info", - content: "Test Alert 1", - }, db: "$.service.db", http: { type: "$.interface.http", customResponse: true, }, - alertTest2: { - type: "alert", - alertType: "info", - content: "Test Alert 2", - }, timer: { type: "$.interface.timer", - description: "test description", + description: "The timer is only used as a fallback if instant event delivery (webhook) is not available.", default: { intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL, }, }, - alertTest3: { - type: "alert", - alertType: "info", - content: "Test Alert 3", - }, objectType: { label: "Object Type", description: "The type of object for which to monitor events", @@ -43,11 +28,6 @@ export default { "objectType", ], }, - alertTest4: { - type: "alert", - alertType: "info", - content: "Test Alert 4", - }, }, hooks: { async activate() { From 4b67aa832892b9c774f1b48b06e42a4767aaca86 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 12 Jun 2024 20:23:08 -0300 Subject: [PATCH 005/106] source testing --- .../new-test-source/new-test-source.mjs | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 components/salesforce_rest_api/sources/new-test-source/new-test-source.mjs diff --git a/components/salesforce_rest_api/sources/new-test-source/new-test-source.mjs b/components/salesforce_rest_api/sources/new-test-source/new-test-source.mjs new file mode 100644 index 0000000000000..b173e0f70baa0 --- /dev/null +++ b/components/salesforce_rest_api/sources/new-test-source/new-test-source.mjs @@ -0,0 +1,91 @@ +import salesforce from "../../salesforce_rest_api.app.mjs"; + +export default { + type: "source", + name: "Test Source", + key: "salesforce_rest_api-test-source", + description: + "Emit new event when a record of the selected object type is created", + version: "0.0.{{ts}}", + props: { + salesforce, + db: "$.service.db", + http: "$.interface.http", + timer: { + type: "$.interface.timer", + description: "Timer description", + default: { + intervalSeconds: 30, + }, + hidden: true, + }, + }, + hooks: { + async deploy() { + console.log("deploy"); + }, + async activate() { + console.log("activate"); + }, + async deactivate() { + console.log("deactivate"); + }, + }, + methods: { + emitEvent(timestamp) { + console.log("emit ", timestamp); + // const ts = Date.now(); + // this.$emit( + // { testEvent: true, timestamp, ts }, + // { + // id: ts, + // summary: `New event ${ts} / ${Date.now()}`, + // ts, + // } + // ); + }, + setRunStart() { + this.db.set("lastRunStart", Date.now()); + }, + setRunEnd() { + this.db.set("lastRunEnd", Date.now()); + }, + checkFirstRun() { + const didFirstRun = this.db.get("didFirstRun"); + if (!didFirstRun) { + this.db.set("didFirstRun", true); + } + return !didFirstRun; + }, + isRunning() { + const lastRunStart = this.db.get("lastRunStart"); + const lastRunEnd = this.db.get("lastRunEnd"); + return !lastRunEnd || (lastRunStart > lastRunEnd); + }, + }, + async run({ timestamp }) { + if (this.checkFirstRun()) { + console.log("starting first run"); + } else { + console.log("starting subsequent run"); + if (this.isRunning()) { + console.log("aborting"); + return; + } + } + + this.setRunStart(); + console.log("started run: ", timestamp); + await new Promise((resolve) => { + setTimeout(resolve, 20000); + }); + // this.emitEvent(timestamp); + await new Promise((resolve) => { + setTimeout(resolve, 20000); + }); + // this.emitEvent(timestamp); + + this.setRunEnd(); + console.log("finished run: ", timestamp); + }, +}; From 04b69137f4c976d4bcc5e3cc7a6e59dc827df0cd Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Thu, 13 Jun 2024 22:46:02 -0300 Subject: [PATCH 006/106] removing test source --- .../new-test-source/new-test-source.mjs | 91 ------------------- 1 file changed, 91 deletions(-) delete mode 100644 components/salesforce_rest_api/sources/new-test-source/new-test-source.mjs diff --git a/components/salesforce_rest_api/sources/new-test-source/new-test-source.mjs b/components/salesforce_rest_api/sources/new-test-source/new-test-source.mjs deleted file mode 100644 index b173e0f70baa0..0000000000000 --- a/components/salesforce_rest_api/sources/new-test-source/new-test-source.mjs +++ /dev/null @@ -1,91 +0,0 @@ -import salesforce from "../../salesforce_rest_api.app.mjs"; - -export default { - type: "source", - name: "Test Source", - key: "salesforce_rest_api-test-source", - description: - "Emit new event when a record of the selected object type is created", - version: "0.0.{{ts}}", - props: { - salesforce, - db: "$.service.db", - http: "$.interface.http", - timer: { - type: "$.interface.timer", - description: "Timer description", - default: { - intervalSeconds: 30, - }, - hidden: true, - }, - }, - hooks: { - async deploy() { - console.log("deploy"); - }, - async activate() { - console.log("activate"); - }, - async deactivate() { - console.log("deactivate"); - }, - }, - methods: { - emitEvent(timestamp) { - console.log("emit ", timestamp); - // const ts = Date.now(); - // this.$emit( - // { testEvent: true, timestamp, ts }, - // { - // id: ts, - // summary: `New event ${ts} / ${Date.now()}`, - // ts, - // } - // ); - }, - setRunStart() { - this.db.set("lastRunStart", Date.now()); - }, - setRunEnd() { - this.db.set("lastRunEnd", Date.now()); - }, - checkFirstRun() { - const didFirstRun = this.db.get("didFirstRun"); - if (!didFirstRun) { - this.db.set("didFirstRun", true); - } - return !didFirstRun; - }, - isRunning() { - const lastRunStart = this.db.get("lastRunStart"); - const lastRunEnd = this.db.get("lastRunEnd"); - return !lastRunEnd || (lastRunStart > lastRunEnd); - }, - }, - async run({ timestamp }) { - if (this.checkFirstRun()) { - console.log("starting first run"); - } else { - console.log("starting subsequent run"); - if (this.isRunning()) { - console.log("aborting"); - return; - } - } - - this.setRunStart(); - console.log("started run: ", timestamp); - await new Promise((resolve) => { - setTimeout(resolve, 20000); - }); - // this.emitEvent(timestamp); - await new Promise((resolve) => { - setTimeout(resolve, 20000); - }); - // this.emitEvent(timestamp); - - this.setRunEnd(); - console.log("finished run: ", timestamp); - }, -}; From cc196b6f56ba48e5869efe74df5ceca78bf14441 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sat, 15 Jun 2024 15:41:00 -0300 Subject: [PATCH 007/106] Record Deleted - applying flex model --- .../new-record-instant/new-record-instant.mjs | 3 +- .../record-deleted-instant.mjs | 41 +++++++++++++-- .../sources/record-deleted/record-deleted.mjs | 51 ------------------- 3 files changed, 39 insertions(+), 56 deletions(-) delete mode 100644 components/salesforce_rest_api/sources/record-deleted/record-deleted.mjs diff --git a/components/salesforce_rest_api/sources/new-record-instant/new-record-instant.mjs b/components/salesforce_rest_api/sources/new-record-instant/new-record-instant.mjs index 44745b03faa3e..07cbd649143ca 100644 --- a/components/salesforce_rest_api/sources/new-record-instant/new-record-instant.mjs +++ b/components/salesforce_rest_api/sources/new-record-instant/new-record-instant.mjs @@ -6,8 +6,7 @@ export default { type: "source", name: "New Record (Instant, of Selectable Type)", key: "salesforce_rest_api-new-record-instant", - description: "Emit new event when a record of the selected object type is created", - // https://sforce.co/3yPSJZy + description: "Emit new event when a record of the selected object type is created. [See the documentation](https://sforce.co/3yPSJZy)", version: "0.0.{{ts}}", hooks: { ...common.hooks, diff --git a/components/salesforce_rest_api/sources/record-deleted-instant/record-deleted-instant.mjs b/components/salesforce_rest_api/sources/record-deleted-instant/record-deleted-instant.mjs index 3522cc44ba4da..da9f8805342e9 100644 --- a/components/salesforce_rest_api/sources/record-deleted-instant/record-deleted-instant.mjs +++ b/components/salesforce_rest_api/sources/record-deleted-instant/record-deleted-instant.mjs @@ -1,6 +1,5 @@ import startCase from "lodash/startCase.js"; - -import common from "../common-instant.mjs"; +import common from "../common.mjs"; export default { ...common, @@ -11,7 +10,7 @@ export default { version: "0.0.4", methods: { ...common.methods, - generateMeta(data) { + generateWebhookMeta(data) { const nameField = this.getNameField(); const { Old: oldObject } = data.body; const { @@ -29,8 +28,44 @@ export default { ts, }; }, + generateTimerMeta(item) { + const { + id, + deletedDate, + } = item; + const entityType = startCase(this.objectType); + const summary = `${entityType} deleted: ${id}`; + const ts = Date.parse(deletedDate); + return { + id, + summary, + ts, + }; + }, getEventType() { return "deleted"; }, + async processTimerEvent(eventData) { + const { + startTimestamp, + endTimestamp, + } = eventData; + const { + deletedRecords, + latestDateCovered, + } = await this.salesforce.getDeletedForObjectType( + this.objectType, + startTimestamp, + endTimestamp, + ); + this.setLatestDateCovered(latestDateCovered); + + // When a record is deleted, the `getDeleted` API only shows the ID of the + // deleted item and the date in which it was deleted. + deletedRecords.forEach((item) => { + const meta = this.generateMeta(item); + this.$emit(item, meta); + }); + }, }, }; diff --git a/components/salesforce_rest_api/sources/record-deleted/record-deleted.mjs b/components/salesforce_rest_api/sources/record-deleted/record-deleted.mjs deleted file mode 100644 index cda160468e9ea..0000000000000 --- a/components/salesforce_rest_api/sources/record-deleted/record-deleted.mjs +++ /dev/null @@ -1,51 +0,0 @@ -import startCase from "lodash/startCase.js"; - -import common from "../common.mjs"; - -export default { - ...common, - type: "source", - name: "New Deleted Record (of Selectable Type)", - key: "salesforce_rest_api-record-deleted", - description: "Emit new event (at regular intervals) when a record of arbitrary object type (selected as an input parameter by the user) is deleted. [See the docs](https://sforce.co/3msDDEE) for more information.", - version: "0.0.4", - methods: { - ...common.methods, - generateMeta(item) { - const { - id, - deletedDate, - } = item; - const entityType = startCase(this.objectType); - const summary = `${entityType} deleted: ${id}`; - const ts = Date.parse(deletedDate); - return { - id, - summary, - ts, - }; - }, - async processEvent(eventData) { - const { - startTimestamp, - endTimestamp, - } = eventData; - const { - deletedRecords, - latestDateCovered, - } = await this.salesforce.getDeletedForObjectType( - this.objectType, - startTimestamp, - endTimestamp, - ); - this.setLatestDateCovered(latestDateCovered); - - // When a record is deleted, the `getDeleted` API only shows the ID of the - // deleted item and the date in which it was deleted. - deletedRecords.forEach((item) => { - const meta = this.generateMeta(item); - this.$emit(item, meta); - }); - }, - }, -}; From 6a16a4bb87ab31a2d557d64940f4e359e63c6b7a Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sat, 15 Jun 2024 15:59:44 -0300 Subject: [PATCH 008/106] adjustment --- components/salesforce_rest_api/sources/common.mjs | 2 +- .../sources/record-deleted-instant/record-deleted-instant.mjs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/salesforce_rest_api/sources/common.mjs b/components/salesforce_rest_api/sources/common.mjs index 9ee8b58b2379b..a4f16f3e415f4 100644 --- a/components/salesforce_rest_api/sources/common.mjs +++ b/components/salesforce_rest_api/sources/common.mjs @@ -58,7 +58,7 @@ export default { const nameField = await this.salesforce.getNameFieldForObjectType(this.objectType); this.setNameField(nameField); - await this.timerActivateHook(); + await this.timerActivateHook?.(); } this._setSecretToken(secretToken); this._setWebhookData(webhookData); diff --git a/components/salesforce_rest_api/sources/record-deleted-instant/record-deleted-instant.mjs b/components/salesforce_rest_api/sources/record-deleted-instant/record-deleted-instant.mjs index da9f8805342e9..77756cd198e6b 100644 --- a/components/salesforce_rest_api/sources/record-deleted-instant/record-deleted-instant.mjs +++ b/components/salesforce_rest_api/sources/record-deleted-instant/record-deleted-instant.mjs @@ -6,7 +6,7 @@ export default { type: "source", name: "New Deleted Record (Instant, of Selectable Type)", key: "salesforce_rest_api-record-deleted-instant", - description: "Emit new event immediately after a record of arbitrary object type (selected as an input parameter by the user) is deleted", + description: "Emit new event when a record of the selected object type is deleted. [See the documentation]()", version: "0.0.4", methods: { ...common.methods, From 65d09cd3d58908b070f10f7dbc79c74a3db976c9 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sat, 15 Jun 2024 16:08:22 -0300 Subject: [PATCH 009/106] Record Updated - applying flex model --- .../record-deleted-instant.mjs | 4 +- .../record-updated-instant.mjs | 86 ++++++++++++++++- .../sources/record-updated/record-updated.mjs | 94 ------------------- 3 files changed, 83 insertions(+), 101 deletions(-) delete mode 100644 components/salesforce_rest_api/sources/record-updated/record-updated.mjs diff --git a/components/salesforce_rest_api/sources/record-deleted-instant/record-deleted-instant.mjs b/components/salesforce_rest_api/sources/record-deleted-instant/record-deleted-instant.mjs index 77756cd198e6b..6a22d07093d1b 100644 --- a/components/salesforce_rest_api/sources/record-deleted-instant/record-deleted-instant.mjs +++ b/components/salesforce_rest_api/sources/record-deleted-instant/record-deleted-instant.mjs @@ -6,8 +6,8 @@ export default { type: "source", name: "New Deleted Record (Instant, of Selectable Type)", key: "salesforce_rest_api-record-deleted-instant", - description: "Emit new event when a record of the selected object type is deleted. [See the documentation]()", - version: "0.0.4", + description: "Emit new event when a record of the selected object type is deleted. [See the documentation](https://sforce.co/3msDDEE)", + version: "0.0.{{ts}}", methods: { ...common.methods, generateWebhookMeta(data) { diff --git a/components/salesforce_rest_api/sources/record-updated-instant/record-updated-instant.mjs b/components/salesforce_rest_api/sources/record-updated-instant/record-updated-instant.mjs index 83663d0c790d6..9af80f1a81a70 100644 --- a/components/salesforce_rest_api/sources/record-updated-instant/record-updated-instant.mjs +++ b/components/salesforce_rest_api/sources/record-updated-instant/record-updated-instant.mjs @@ -1,17 +1,17 @@ import startCase from "lodash/startCase.js"; - -import common from "../common-instant.mjs"; +import common from "../common.mjs"; +import constants from "../../common/constants.mjs"; export default { ...common, type: "source", name: "New Updated Record (Instant, of Selectable Type)", key: "salesforce_rest_api-record-updated-instant", - description: "Emit new event immediately after a record of arbitrary type (selected as an input parameter by the user) is updated", - version: "0.1.7", + description: "Emit new event when a record of the selected type is updated. [See the documentation](https://sforce.co/3yPSJZy)", + version: "0.1.{{ts}}", methods: { ...common.methods, - generateMeta(data) { + generateWebhookMeta(data) { const nameField = this.getNameField(); const { New: newObject } = data.body; const { @@ -29,8 +29,84 @@ export default { ts, }; }, + generateTimerMeta(item, fieldName) { + const { objectType } = this; + + const { + LastModifiedDate: lastModifiedDate, + [fieldName]: name, + Id: id, + } = item; + + const entityType = startCase(objectType); + const summary = `${entityType} updated: ${name}`; + const ts = Date.parse(lastModifiedDate); + return { + id: `${id}-${ts}`, + summary, + ts, + }; + }, getEventType() { return "updated"; }, + async processTimerEvent(eventData) { + const { + getNameField, + getObjectTypeColumns, + paginate, + objectType, + setLatestDateCovered, + generateMeta, + $emit: emit, + } = this; + + const { + startTimestamp, + endTimestamp, + } = eventData; + + const fieldName = getNameField(); + const columns = getObjectTypeColumns(); + + const events = await paginate({ + objectType, + startTimestamp, + endTimestamp, + columns, + dateFieldName: constants.FIELD_NAME.LAST_MODIFIED_DATE, + }); + + const [ + latestEvent, + ] = events; + + if (latestEvent?.LastModifiedDate) { + const latestDateCovered = new Date(latestEvent.LastModifiedDate); + latestDateCovered.setSeconds(0); + setLatestDateCovered(latestDateCovered.toISOString()); + } + + Array.from(events) + .reverse() + .forEach((item) => { + const meta = generateMeta(item, fieldName); + emit(item, meta); + }); + }, + async timerActivateHook() { + const { + objectType, + getObjectTypeDescription, + setObjectTypeColumns, + } = this; + + await common.hooks.activate.call(this); + + const { fields } = await getObjectTypeDescription(objectType); + const columns = fields.map(({ name }) => name); + + setObjectTypeColumns(columns); + }, }, }; diff --git a/components/salesforce_rest_api/sources/record-updated/record-updated.mjs b/components/salesforce_rest_api/sources/record-updated/record-updated.mjs deleted file mode 100644 index 442bb74458415..0000000000000 --- a/components/salesforce_rest_api/sources/record-updated/record-updated.mjs +++ /dev/null @@ -1,94 +0,0 @@ -import startCase from "lodash/startCase.js"; -import common from "../common.mjs"; -import constants from "../../common/constants.mjs"; - -export default { - ...common, - type: "source", - name: "New Updated Record (of Selectable Type)", - key: "salesforce_rest_api-record-updated", - description: "Emit new event (at regular intervals) when a record of arbitrary type (selected as an input parameter by the user) is updated. [See the docs](https://sforce.co/3yPSJZy) for more information.", - version: "0.1.12", - hooks: { - ...common.hooks, - async activate() { - const { - objectType, - getObjectTypeDescription, - setObjectTypeColumns, - } = this; - - await common.hooks.activate.call(this); - - const { fields } = await getObjectTypeDescription(objectType); - const columns = fields.map(({ name }) => name); - - setObjectTypeColumns(columns); - }, - }, - methods: { - ...common.methods, - generateMeta(item, fieldName) { - const { objectType } = this; - - const { - LastModifiedDate: lastModifiedDate, - [fieldName]: name, - Id: id, - } = item; - - const entityType = startCase(objectType); - const summary = `${entityType} updated: ${name}`; - const ts = Date.parse(lastModifiedDate); - return { - id: `${id}-${ts}`, - summary, - ts, - }; - }, - async processEvent(eventData) { - const { - getNameField, - getObjectTypeColumns, - paginate, - objectType, - setLatestDateCovered, - generateMeta, - $emit: emit, - } = this; - - const { - startTimestamp, - endTimestamp, - } = eventData; - - const fieldName = getNameField(); - const columns = getObjectTypeColumns(); - - const events = await paginate({ - objectType, - startTimestamp, - endTimestamp, - columns, - dateFieldName: constants.FIELD_NAME.LAST_MODIFIED_DATE, - }); - - const [ - latestEvent, - ] = events; - - if (latestEvent?.LastModifiedDate) { - const latestDateCovered = new Date(latestEvent.LastModifiedDate); - latestDateCovered.setSeconds(0); - setLatestDateCovered(latestDateCovered.toISOString()); - } - - Array.from(events) - .reverse() - .forEach((item) => { - const meta = generateMeta(item, fieldName); - emit(item, meta); - }); - }, - }, -}; From eee3bb2a9f6933ee21184a029558e451d9f0f088 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sat, 15 Jun 2024 16:14:59 -0300 Subject: [PATCH 010/106] Applying flex model to 'updated field' --- .../updated-field-on-record-instant.mjs | 136 ++++++++++++++- .../updated-field-on-record.mjs | 161 ------------------ 2 files changed, 130 insertions(+), 167 deletions(-) delete mode 100644 components/salesforce_rest_api/sources/updated-field-on-record/updated-field-on-record.mjs diff --git a/components/salesforce_rest_api/sources/updated-field-on-record-instant/updated-field-on-record-instant.mjs b/components/salesforce_rest_api/sources/updated-field-on-record-instant/updated-field-on-record-instant.mjs index d6bd6eeb7db5b..493e3822d9135 100644 --- a/components/salesforce_rest_api/sources/updated-field-on-record-instant/updated-field-on-record-instant.mjs +++ b/components/salesforce_rest_api/sources/updated-field-on-record-instant/updated-field-on-record-instant.mjs @@ -1,23 +1,47 @@ import startCase from "lodash/startCase.js"; - -import common from "../common-instant.mjs"; +import common from "../common.mjs"; +import words from "lodash/words.js"; const { salesforce } = common.props; +/** + * The timer part uses the Salesforce REST API's [sObject Get Updated endpoint](https://sforce.co/3yPSJZy) on the + * [StandardObjectNamedHistory model](https://sforce.co/3Fn4lWB) to get changes to field values of + * an sObject type. Associated sObject records are retrieved and emitted for history object records + * matching configured `field` and `fieldUpdatedTo` prop values. + */ + export default { ...common, type: "source", name: "New Updated Field on Record (Instant, of Selectable Type)", key: "salesforce_rest_api-updated-field-on-record-instant", - description: "Emit new event immediately after a field of your choosing is updated on any record of a specified Salesforce object", - version: "0.1.6", + description: "Emit new event when the selected field is updated on any record of the selected Salesforce object. See the documentation on [field history tracking](https://sforce.co/3mtj0rF) and [history objects](https://sforce.co/3Fn4lWB)", + version: "0.1.{{ts}}", props: { ...common.props, + objectType: { + type: common.props.objectType.type, + label: common.props.objectType.label, + description: common.props.objectType.description, + propDefinition: [ + salesforce, + "objectType", + () => ({ + filter: ({ + replicateable, + associateEntityType, + }) => replicateable && associateEntityType === "History", + mapper: ({ associateParentEntity: value }) => words(value).join(" "), + }), + ], + }, field: { propDefinition: [ salesforce, "field", ({ objectType }) => ({ objectType, + filter: ({ updateable }) => updateable, }), ], }, @@ -38,7 +62,7 @@ export default { const { [this.field]: newFieldValue } = newObject; return !this.fieldUpdatedTo || this.fieldUpdatedTo === newFieldValue; }, - generateMeta(data) { + generateWebhookMeta(data) { const nameField = this.getNameField(); const { New: newObject } = data.body; const { @@ -56,7 +80,26 @@ export default { ts, }; }, - processEvent(event) { + generateTimerMeta(event) { + const { + objectType, + field, + } = this; + + const { + CreatedDate: createdDate, + Id: id, + [`${objectType}Id`]: objectId, + } = event; + + const ts = Date.parse(createdDate); + return { + id: `${id}-${ts}`, + summary: `${field} on ${objectType}: ${objectId}`, + ts, + }; + }, + processWebhookEvent(event) { const { body } = event; if (!this.isEventRelevant(event)) { return; @@ -72,5 +115,86 @@ export default { this.field, ]; }, + async processTimerEvent({ + startTimestamp, endTimestamp, + }) { + const { + getHistoryObjectType, + getObjectTypeColumns, + setLatestDateCovered, + isRelevant, + paginate, + generateMeta, + $emit: emit, + } = this; + + const objectType = getHistoryObjectType(); + const columns = getObjectTypeColumns(); + + const events = await paginate({ + objectType, + startTimestamp, + endTimestamp, + columns, + }); + + const [ + latestEvent, + ] = events; + + if (latestEvent?.CreatedDate) { + const latestDateCovered = new Date(latestEvent.CreatedDate); + latestDateCovered.setSeconds(0); + setLatestDateCovered(latestDateCovered.toISOString()); + } + + Array.from(events) + .reverse() + .filter(isRelevant) + .forEach((event) => { + const meta = generateMeta(event); + emit(event, meta); + }); + }, + getHistoryObjectType() { + return this.db.get("historyObjectType"); + }, + setHistoryObjectType(historyObjectType) { + this.db.set("historyObjectType", historyObjectType); + }, + isRelevant(item) { + const { + field, + fieldUpdatedTo, + } = this; + + const isFieldRelevant = + item.Field === field + || item.Field === `${item.DataType}${field}`; + + const isFieldValueRelevant = + !fieldUpdatedTo + || item.NewValue === fieldUpdatedTo; + + return isFieldRelevant && isFieldValueRelevant; + }, + async timerActivateHook() { + const { + objectType, + getObjectTypeDescription, + setHistoryObjectType, + setObjectTypeColumns, + } = this; + + await common.hooks.activate.call(this); + + const historyObjectType = `${objectType}History`; + + const { fields } = await getObjectTypeDescription(historyObjectType); + const columns = fields.map(({ name }) => name); + + setHistoryObjectType(historyObjectType); + setObjectTypeColumns(columns); + }, }, }; diff --git a/components/salesforce_rest_api/sources/updated-field-on-record/updated-field-on-record.mjs b/components/salesforce_rest_api/sources/updated-field-on-record/updated-field-on-record.mjs deleted file mode 100644 index bf173051f817c..0000000000000 --- a/components/salesforce_rest_api/sources/updated-field-on-record/updated-field-on-record.mjs +++ /dev/null @@ -1,161 +0,0 @@ -import words from "lodash/words.js"; -import common from "../common.mjs"; - -const { salesforce } = common.props; - -/** - * Uses the Salesforce REST API's [sObject Get Updated endpoint](https://sforce.co/3yPSJZy) on the - * [StandardObjectNamedHistory model](https://sforce.co/3Fn4lWB) to get changes to field values of - * an sObject type. Associated sObject records are retrieved and emitted for history object records - * matching configured `field` and `fieldUpdatedTo` prop values. - */ -export default { - ...common, - dedupe: "greatest", - type: "source", - name: "New Updated Field on Record (of Selectable Type)", - key: "salesforce_rest_api-updated-field-on-record", - description: "Emit new event (at regular intervals) when a field of your choosing is updated on any record of a specified Salesforce object. Field history tracking must be enabled for the chosen field. See the docs on [field history tracking](https://sforce.co/3mtj0rF) and [history objects](https://sforce.co/3Fn4lWB) for more information.", - version: "0.1.11", - props: { - ...common.props, - objectType: { - type: common.props.objectType.type, - label: common.props.objectType.label, - description: common.props.objectType.description, - propDefinition: [ - salesforce, - "objectType", - () => ({ - filter: ({ - replicateable, - associateEntityType, - }) => replicateable && associateEntityType === "History", - mapper: ({ associateParentEntity: value }) => words(value).join(" "), - }), - ], - }, - field: { - propDefinition: [ - salesforce, - "field", - ({ objectType }) => ({ - objectType, - filter: ({ updateable }) => updateable, - }), - ], - }, - fieldUpdatedTo: { - propDefinition: [ - salesforce, - "fieldUpdatedTo", - ], - }, - }, - hooks: { - ...common.hooks, - async activate() { - const { - objectType, - getObjectTypeDescription, - setHistoryObjectType, - setObjectTypeColumns, - } = this; - - await common.hooks.activate.call(this); - - const historyObjectType = `${objectType}History`; - - const { fields } = await getObjectTypeDescription(historyObjectType); - const columns = fields.map(({ name }) => name); - - setHistoryObjectType(historyObjectType); - setObjectTypeColumns(columns); - }, - }, - methods: { - ...common.methods, - getHistoryObjectType() { - return this.db.get("historyObjectType"); - }, - setHistoryObjectType(historyObjectType) { - this.db.set("historyObjectType", historyObjectType); - }, - isRelevant(item) { - const { - field, - fieldUpdatedTo, - } = this; - - const isFieldRelevant = - item.Field === field - || item.Field === `${item.DataType}${field}`; - - const isFieldValueRelevant = - !fieldUpdatedTo - || item.NewValue === fieldUpdatedTo; - - return isFieldRelevant && isFieldValueRelevant; - }, - generateMeta(event) { - const { - objectType, - field, - } = this; - - const { - CreatedDate: createdDate, - Id: id, - [`${objectType}Id`]: objectId, - } = event; - - const ts = Date.parse(createdDate); - return { - id: `${id}-${ts}`, - summary: `${field} on ${objectType}: ${objectId}`, - ts, - }; - }, - async processEvent({ - startTimestamp, endTimestamp, - }) { - const { - getHistoryObjectType, - getObjectTypeColumns, - setLatestDateCovered, - isRelevant, - paginate, - generateMeta, - $emit: emit, - } = this; - - const objectType = getHistoryObjectType(); - const columns = getObjectTypeColumns(); - - const events = await paginate({ - objectType, - startTimestamp, - endTimestamp, - columns, - }); - - const [ - latestEvent, - ] = events; - - if (latestEvent?.CreatedDate) { - const latestDateCovered = new Date(latestEvent.CreatedDate); - latestDateCovered.setSeconds(0); - setLatestDateCovered(latestDateCovered.toISOString()); - } - - Array.from(events) - .reverse() - .filter(isRelevant) - .forEach((event) => { - const meta = generateMeta(event); - emit(event, meta); - }); - }, - }, -}; From fba5ab9600f76203322910bf4b7f3501ad6e6514 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sat, 15 Jun 2024 19:22:59 -0300 Subject: [PATCH 011/106] Method name adjustments --- .../record-deleted-instant/record-deleted-instant.mjs | 2 +- .../record-updated-instant/record-updated-instant.mjs | 4 ++-- .../updated-field-on-record-instant.mjs | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/components/salesforce_rest_api/sources/record-deleted-instant/record-deleted-instant.mjs b/components/salesforce_rest_api/sources/record-deleted-instant/record-deleted-instant.mjs index 6a22d07093d1b..ad53ec3d49406 100644 --- a/components/salesforce_rest_api/sources/record-deleted-instant/record-deleted-instant.mjs +++ b/components/salesforce_rest_api/sources/record-deleted-instant/record-deleted-instant.mjs @@ -63,7 +63,7 @@ export default { // When a record is deleted, the `getDeleted` API only shows the ID of the // deleted item and the date in which it was deleted. deletedRecords.forEach((item) => { - const meta = this.generateMeta(item); + const meta = this.generateTimerMeta(item); this.$emit(item, meta); }); }, diff --git a/components/salesforce_rest_api/sources/record-updated-instant/record-updated-instant.mjs b/components/salesforce_rest_api/sources/record-updated-instant/record-updated-instant.mjs index 9af80f1a81a70..2cd59abe1d81c 100644 --- a/components/salesforce_rest_api/sources/record-updated-instant/record-updated-instant.mjs +++ b/components/salesforce_rest_api/sources/record-updated-instant/record-updated-instant.mjs @@ -57,7 +57,7 @@ export default { paginate, objectType, setLatestDateCovered, - generateMeta, + generateTimerMeta, $emit: emit, } = this; @@ -90,7 +90,7 @@ export default { Array.from(events) .reverse() .forEach((item) => { - const meta = generateMeta(item, fieldName); + const meta = generateTimerMeta(item, fieldName); emit(item, meta); }); }, diff --git a/components/salesforce_rest_api/sources/updated-field-on-record-instant/updated-field-on-record-instant.mjs b/components/salesforce_rest_api/sources/updated-field-on-record-instant/updated-field-on-record-instant.mjs index 493e3822d9135..488fc53fee008 100644 --- a/components/salesforce_rest_api/sources/updated-field-on-record-instant/updated-field-on-record-instant.mjs +++ b/components/salesforce_rest_api/sources/updated-field-on-record-instant/updated-field-on-record-instant.mjs @@ -104,7 +104,7 @@ export default { if (!this.isEventRelevant(event)) { return; } - const meta = this.generateMeta(event); + const meta = this.generateWebhookMeta(event); this.$emit(body, meta); }, getEventType() { @@ -124,7 +124,7 @@ export default { setLatestDateCovered, isRelevant, paginate, - generateMeta, + generateTimerMeta, $emit: emit, } = this; @@ -152,7 +152,7 @@ export default { .reverse() .filter(isRelevant) .forEach((event) => { - const meta = generateMeta(event); + const meta = generateTimerMeta(event); emit(event, meta); }); }, From 7c60629e526e21d201619f79c3a3d04d73159917 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sat, 15 Jun 2024 19:28:50 -0300 Subject: [PATCH 012/106] adjustment --- components/salesforce_rest_api/sources/common.mjs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/salesforce_rest_api/sources/common.mjs b/components/salesforce_rest_api/sources/common.mjs index a4f16f3e415f4..38dbf81babe83 100644 --- a/components/salesforce_rest_api/sources/common.mjs +++ b/components/salesforce_rest_api/sources/common.mjs @@ -55,13 +55,13 @@ export default { this.setLatestDateCovered(now); } - const nameField = await this.salesforce.getNameFieldForObjectType(this.objectType); - this.setNameField(nameField); - await this.timerActivateHook?.(); } this._setSecretToken(secretToken); this._setWebhookData(webhookData); + + const nameField = await this.salesforce.getNameFieldForObjectType(this.objectType); + this.setNameField(nameField); }, async deactivate() { // Delete the webhook, if it exists From 7978eb642a41fbc3c75dd9759ea2f348f40c9f81 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sun, 16 Jun 2024 01:48:52 -0300 Subject: [PATCH 013/106] adjustment --- .../updated-field-on-record-instant.mjs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/components/salesforce_rest_api/sources/updated-field-on-record-instant/updated-field-on-record-instant.mjs b/components/salesforce_rest_api/sources/updated-field-on-record-instant/updated-field-on-record-instant.mjs index 488fc53fee008..64acc6ed810f7 100644 --- a/components/salesforce_rest_api/sources/updated-field-on-record-instant/updated-field-on-record-instant.mjs +++ b/components/salesforce_rest_api/sources/updated-field-on-record-instant/updated-field-on-record-instant.mjs @@ -20,9 +20,7 @@ export default { props: { ...common.props, objectType: { - type: common.props.objectType.type, - label: common.props.objectType.label, - description: common.props.objectType.description, + ...common.props.objectType, propDefinition: [ salesforce, "objectType", From 3a5c607be1205cf2c0017f840b443207c5b14d20 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sun, 16 Jun 2024 01:53:44 -0300 Subject: [PATCH 014/106] adjustments --- .../sources/record-updated-instant/record-updated-instant.mjs | 2 -- .../updated-field-on-record-instant.mjs | 2 -- 2 files changed, 4 deletions(-) diff --git a/components/salesforce_rest_api/sources/record-updated-instant/record-updated-instant.mjs b/components/salesforce_rest_api/sources/record-updated-instant/record-updated-instant.mjs index 2cd59abe1d81c..a20fd21c50c38 100644 --- a/components/salesforce_rest_api/sources/record-updated-instant/record-updated-instant.mjs +++ b/components/salesforce_rest_api/sources/record-updated-instant/record-updated-instant.mjs @@ -101,8 +101,6 @@ export default { setObjectTypeColumns, } = this; - await common.hooks.activate.call(this); - const { fields } = await getObjectTypeDescription(objectType); const columns = fields.map(({ name }) => name); diff --git a/components/salesforce_rest_api/sources/updated-field-on-record-instant/updated-field-on-record-instant.mjs b/components/salesforce_rest_api/sources/updated-field-on-record-instant/updated-field-on-record-instant.mjs index 64acc6ed810f7..15f46d34a538f 100644 --- a/components/salesforce_rest_api/sources/updated-field-on-record-instant/updated-field-on-record-instant.mjs +++ b/components/salesforce_rest_api/sources/updated-field-on-record-instant/updated-field-on-record-instant.mjs @@ -184,8 +184,6 @@ export default { setObjectTypeColumns, } = this; - await common.hooks.activate.call(this); - const historyObjectType = `${objectType}History`; const { fields } = await getObjectTypeDescription(historyObjectType); From 34ecbff350b728218ee6d782916f36759cd1bfbe Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Thu, 20 Jun 2024 19:01:27 -0300 Subject: [PATCH 015/106] Adding field filtering to 'record updated' --- .../record-updated-instant.mjs | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/components/salesforce_rest_api/sources/record-updated-instant/record-updated-instant.mjs b/components/salesforce_rest_api/sources/record-updated-instant/record-updated-instant.mjs index a20fd21c50c38..7eefafd0ac527 100644 --- a/components/salesforce_rest_api/sources/record-updated-instant/record-updated-instant.mjs +++ b/components/salesforce_rest_api/sources/record-updated-instant/record-updated-instant.mjs @@ -1,6 +1,7 @@ import startCase from "lodash/startCase.js"; import common from "../common.mjs"; import constants from "../../common/constants.mjs"; +const { salesforce } = common.props; export default { ...common, @@ -9,6 +10,23 @@ export default { key: "salesforce_rest_api-record-updated-instant", description: "Emit new event when a record of the selected type is updated. [See the documentation](https://sforce.co/3yPSJZy)", version: "0.1.{{ts}}", + props: { + ...common.props, + fields: { + propDefinition: [ + salesforce, + "field", + ({ objectType }) => ({ + objectType, + filter: ({ updateable }) => updateable, + }), + ], + label: "Fields To Watch", + type: "string[]", + optional: true, + description: "If specified, events will only be emitted if at least one of the selected fields is updated", + }, + }, methods: { ...common.methods, generateWebhookMeta(data) { @@ -50,6 +68,46 @@ export default { getEventType() { return "updated"; }, + isEventRelevant(changedFields) { + const { fields } = this; + return fields?.length + ? Object.keys(changedFields).some((key) => fields.includes(key)) + : true; + }, + getChangedFields(body) { + return Object.entries(body.New).filter(([ + key, + value, + ]) => { + const oldValue = body.Old[key]; + return ( + value !== undefined + && oldValue !== undefined + && JSON.stringify(value) !== JSON.stringify(oldValue) + ); + }) + .reduce((obj, [ + key, + value, + ]) => { + obj[key] = { + old: body.Old[key], + new: value, + }; + return obj; + }, {}); + }, + processWebhookEvent(event) { + const { body } = event; + const changedFields = this.getChangedFields(body); + if (this.isEventRelevant(changedFields)) { + const meta = this.generateWebhookMeta(event); + this.$emit({ + ...body, + changedFields, + }, meta); + } + }, async processTimerEvent(eventData) { const { getNameField, From d889677b1deff2a42e82f2e515d7dba6e32eb337 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Fri, 21 Jun 2024 22:38:37 -0300 Subject: [PATCH 016/106] Removing source no longer used --- .../updated-field-on-record-instant.mjs | 196 ------------------ 1 file changed, 196 deletions(-) delete mode 100644 components/salesforce_rest_api/sources/updated-field-on-record-instant/updated-field-on-record-instant.mjs diff --git a/components/salesforce_rest_api/sources/updated-field-on-record-instant/updated-field-on-record-instant.mjs b/components/salesforce_rest_api/sources/updated-field-on-record-instant/updated-field-on-record-instant.mjs deleted file mode 100644 index 15f46d34a538f..0000000000000 --- a/components/salesforce_rest_api/sources/updated-field-on-record-instant/updated-field-on-record-instant.mjs +++ /dev/null @@ -1,196 +0,0 @@ -import startCase from "lodash/startCase.js"; -import common from "../common.mjs"; -import words from "lodash/words.js"; -const { salesforce } = common.props; - -/** - * The timer part uses the Salesforce REST API's [sObject Get Updated endpoint](https://sforce.co/3yPSJZy) on the - * [StandardObjectNamedHistory model](https://sforce.co/3Fn4lWB) to get changes to field values of - * an sObject type. Associated sObject records are retrieved and emitted for history object records - * matching configured `field` and `fieldUpdatedTo` prop values. - */ - -export default { - ...common, - type: "source", - name: "New Updated Field on Record (Instant, of Selectable Type)", - key: "salesforce_rest_api-updated-field-on-record-instant", - description: "Emit new event when the selected field is updated on any record of the selected Salesforce object. See the documentation on [field history tracking](https://sforce.co/3mtj0rF) and [history objects](https://sforce.co/3Fn4lWB)", - version: "0.1.{{ts}}", - props: { - ...common.props, - objectType: { - ...common.props.objectType, - propDefinition: [ - salesforce, - "objectType", - () => ({ - filter: ({ - replicateable, - associateEntityType, - }) => replicateable && associateEntityType === "History", - mapper: ({ associateParentEntity: value }) => words(value).join(" "), - }), - ], - }, - field: { - propDefinition: [ - salesforce, - "field", - ({ objectType }) => ({ - objectType, - filter: ({ updateable }) => updateable, - }), - ], - }, - fieldUpdatedTo: { - propDefinition: [ - salesforce, - "fieldUpdatedTo", - ], - }, - }, - methods: { - ...common.methods, - isEventRelevant(event) { - if (!this.fieldUpdatedTo) { - return true; - } - const { New: newObject } = event.body; - const { [this.field]: newFieldValue } = newObject; - return !this.fieldUpdatedTo || this.fieldUpdatedTo === newFieldValue; - }, - generateWebhookMeta(data) { - const nameField = this.getNameField(); - const { New: newObject } = data.body; - const { - LastModifiedDate: lastModifiedDate, - Id: id, - [nameField]: name, - } = newObject; - const entityType = startCase(this.objectType); - const summary = `${this.field} on ${entityType}: ${name}`; - const ts = Date.parse(lastModifiedDate); - const compositeId = `${id}-${ts}`; - return { - id: compositeId, - summary, - ts, - }; - }, - generateTimerMeta(event) { - const { - objectType, - field, - } = this; - - const { - CreatedDate: createdDate, - Id: id, - [`${objectType}Id`]: objectId, - } = event; - - const ts = Date.parse(createdDate); - return { - id: `${id}-${ts}`, - summary: `${field} on ${objectType}: ${objectId}`, - ts, - }; - }, - processWebhookEvent(event) { - const { body } = event; - if (!this.isEventRelevant(event)) { - return; - } - const meta = this.generateWebhookMeta(event); - this.$emit(body, meta); - }, - getEventType() { - return "updated"; - }, - getFieldsToCheck() { - return [ - this.field, - ]; - }, - async processTimerEvent({ - startTimestamp, endTimestamp, - }) { - const { - getHistoryObjectType, - getObjectTypeColumns, - setLatestDateCovered, - isRelevant, - paginate, - generateTimerMeta, - $emit: emit, - } = this; - - const objectType = getHistoryObjectType(); - const columns = getObjectTypeColumns(); - - const events = await paginate({ - objectType, - startTimestamp, - endTimestamp, - columns, - }); - - const [ - latestEvent, - ] = events; - - if (latestEvent?.CreatedDate) { - const latestDateCovered = new Date(latestEvent.CreatedDate); - latestDateCovered.setSeconds(0); - setLatestDateCovered(latestDateCovered.toISOString()); - } - - Array.from(events) - .reverse() - .filter(isRelevant) - .forEach((event) => { - const meta = generateTimerMeta(event); - emit(event, meta); - }); - }, - getHistoryObjectType() { - return this.db.get("historyObjectType"); - }, - setHistoryObjectType(historyObjectType) { - this.db.set("historyObjectType", historyObjectType); - }, - isRelevant(item) { - const { - field, - fieldUpdatedTo, - } = this; - - const isFieldRelevant = - item.Field === field - || item.Field === `${item.DataType}${field}`; - - const isFieldValueRelevant = - !fieldUpdatedTo - || item.NewValue === fieldUpdatedTo; - - return isFieldRelevant && isFieldValueRelevant; - }, - async timerActivateHook() { - const { - objectType, - getObjectTypeDescription, - setHistoryObjectType, - setObjectTypeColumns, - } = this; - - const historyObjectType = `${objectType}History`; - - const { fields } = await getObjectTypeDescription(historyObjectType); - const columns = fields.map(({ name }) => name); - - setHistoryObjectType(historyObjectType); - setObjectTypeColumns(columns); - }, - }, -}; From 0e4b4401bed174b44c27a10bb79fcad5b64d2289 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sun, 23 Jun 2024 20:44:35 -0300 Subject: [PATCH 017/106] Description adjustment --- .../sources/record-updated-instant/record-updated-instant.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/salesforce_rest_api/sources/record-updated-instant/record-updated-instant.mjs b/components/salesforce_rest_api/sources/record-updated-instant/record-updated-instant.mjs index 7eefafd0ac527..1796df4aa9c56 100644 --- a/components/salesforce_rest_api/sources/record-updated-instant/record-updated-instant.mjs +++ b/components/salesforce_rest_api/sources/record-updated-instant/record-updated-instant.mjs @@ -24,7 +24,7 @@ export default { label: "Fields To Watch", type: "string[]", optional: true, - description: "If specified, events will only be emitted if at least one of the selected fields is updated", + description: "If specified, events will only be emitted if at least one of the selected fields is updated. This filter is only available when a webhook is created successfully.", }, }, methods: { From f3b48650ae3a58216da3ca2f4499aba24a9ff0f4 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Mon, 24 Jun 2024 02:40:13 -0300 Subject: [PATCH 018/106] New Outbound Message adjustments --- .../new-outbound-message/new-outbound-message.mjs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/components/salesforce_rest_api/sources/new-outbound-message/new-outbound-message.mjs b/components/salesforce_rest_api/sources/new-outbound-message/new-outbound-message.mjs index b1067ea92de9f..e45c3f7b9f68e 100644 --- a/components/salesforce_rest_api/sources/new-outbound-message/new-outbound-message.mjs +++ b/components/salesforce_rest_api/sources/new-outbound-message/new-outbound-message.mjs @@ -5,17 +5,25 @@ export default { type: "source", name: "New Outbound Message (Instant)", key: "salesforce_rest_api-new-outbound-message", - description: "Emit new event when a new outbound message is received in Salesforce. See Salesforce's guide on setting up [Outbound Messaging](https://sforce.co/3JbZJom). Set the Outbound Message's Endpoint URL to the endpoint of the created source. The \"Send Session ID\" option must be enabled for validating outbound messages from Salesforce.", - version: "0.1.6", + description: "Emit new event when a new outbound message is received in Salesforce.", + version: "0.1.7", dedupe: "unique", props: { db: "$.service.db", - // eslint-disable-next-line pipedream/props-label,pipedream/props-description http: { type: "$.interface.http", customResponse: true, }, salesforce, + alertTest: { + type: "alert", + alertType: "info", + content: `See Salesforce's guide on [setting up Outbound Messaging](https://sforce.co/3JbZJom). +\\ +Set the Outbound Message's \`Endpoint URL\` to the endpoint of this source, which you can view after it is created. +\\ +The \`Send Session ID\` option must be enabled in Salesforce for validating outbound messages.`, + }, }, methods: { _unwrapMessage(message) { From 78adc43ae4d7062d8f4ac52d07dfbfa5d68e24e6 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Mon, 24 Jun 2024 19:49:40 -0300 Subject: [PATCH 019/106] Adjusting requests to include $ debug param --- .../add-contact-to-campaign.mjs | 19 +++++++++++-------- .../add-lead-to-campaign.mjs | 14 ++++++++------ .../find-create-record/find-create-record.mjs | 9 +++++---- .../salesforce_rest_api.app.mjs | 9 +++++---- 4 files changed, 29 insertions(+), 22 deletions(-) diff --git a/components/salesforce_rest_api/actions/add-contact-to-campaign/add-contact-to-campaign.mjs b/components/salesforce_rest_api/actions/add-contact-to-campaign/add-contact-to-campaign.mjs index e3c2745f4262a..cb856bb249f48 100644 --- a/components/salesforce_rest_api/actions/add-contact-to-campaign/add-contact-to-campaign.mjs +++ b/components/salesforce_rest_api/actions/add-contact-to-campaign/add-contact-to-campaign.mjs @@ -1,7 +1,5 @@ import salesForceRestApi from "../../salesforce_rest_api.app.mjs"; -import { - removeNullEntries, toSingleLineString, -} from "../../common/utils.mjs"; +import { toSingleLineString } from "../../common/utils.mjs"; import constants from "../../common/constants.mjs"; export default { @@ -40,13 +38,18 @@ export default { }, }, async run({ $ }) { - const data = removeNullEntries({ + const data = { CampaignId: this.campaignId, ContactId: this.contactId, - }); - const response = await this.salesForceRestApi - .createObject(constants.OBJECT_TYPE.CAMPAIGN_MEMBER, data); - response && $.export("$summary", "Successfully added contact to campaign"); + }; + const response = await this.salesForceRestApi.createObject( + { + $, + objectType: constants.OBJECT_TYPE.CAMPAIGN_MEMBER, + data, + }, + ); + $.export("$summary", "Successfully added contact to campaign"); return response; }, }; diff --git a/components/salesforce_rest_api/actions/add-lead-to-campaign/add-lead-to-campaign.mjs b/components/salesforce_rest_api/actions/add-lead-to-campaign/add-lead-to-campaign.mjs index 15bedd89e365a..fa8e461b98e1a 100644 --- a/components/salesforce_rest_api/actions/add-lead-to-campaign/add-lead-to-campaign.mjs +++ b/components/salesforce_rest_api/actions/add-lead-to-campaign/add-lead-to-campaign.mjs @@ -1,7 +1,5 @@ import salesForceRestApi from "../../salesforce_rest_api.app.mjs"; -import { - removeNullEntries, toSingleLineString, -} from "../../common/utils.mjs"; +import { toSingleLineString } from "../../common/utils.mjs"; import constants from "../../common/constants.mjs"; export default { @@ -40,12 +38,16 @@ export default { }, }, async run({ $ }) { - const data = removeNullEntries({ + const data = { CampaignId: this.campaignId, LeadId: this.leadId, + }; + const response = await this.salesForceRestApi.createObject({ + $, + objectType: constants.OBJECT_TYPE.CAMPAIGN_MEMBER, + data, }); - const response = await this.salesForceRestApi.createObject("CampaignMember", data); - response && $.export("$summary", "Successfully added lead to campaign"); + $.export("$summary", "Successfully added lead to campaign"); return response; }, }; diff --git a/components/salesforce_rest_api/actions/find-create-record/find-create-record.mjs b/components/salesforce_rest_api/actions/find-create-record/find-create-record.mjs index e4e947bb79709..7dbf5f0b3444e 100644 --- a/components/salesforce_rest_api/actions/find-create-record/find-create-record.mjs +++ b/components/salesforce_rest_api/actions/find-create-record/find-create-record.mjs @@ -72,10 +72,11 @@ export default { } if (createIfNotFound && !data) { - const response = await this.salesForceRestApi.createObject( - sobjectType, - sobject, - ); + const response = await this.salesForceRestApi.createObject({ + $, + objectType: sobjectType, + data: sobject, + }); response && $.export( "$summary", "Record successfully created", ); diff --git a/components/salesforce_rest_api/salesforce_rest_api.app.mjs b/components/salesforce_rest_api/salesforce_rest_api.app.mjs index 432218f1b751d..f19cc96e2aea9 100644 --- a/components/salesforce_rest_api/salesforce_rest_api.app.mjs +++ b/components/salesforce_rest_api/salesforce_rest_api.app.mjs @@ -232,12 +232,13 @@ export default { ); return historyObject; }, - async createObject(objectType, data) { - const url = `${this._sObjectsApiUrl()}/${objectType}`; + async createObject({ + objectType, ...args + }) { return this._makeRequest({ - url, - data, + url: `${this._sObjectsApiUrl()}/${objectType}`, method: "POST", + ...args, }); }, async deleteObject(objectType, sobjectId) { From 7b7e46cd5fcd5c2bfec241af04b550e2e1aaabe2 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Mon, 24 Jun 2024 22:57:11 -0300 Subject: [PATCH 020/106] Description updates --- .../add-contact-to-campaign/add-contact-to-campaign.mjs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/components/salesforce_rest_api/actions/add-contact-to-campaign/add-contact-to-campaign.mjs b/components/salesforce_rest_api/actions/add-contact-to-campaign/add-contact-to-campaign.mjs index cb856bb249f48..f6812f48b82a7 100644 --- a/components/salesforce_rest_api/actions/add-contact-to-campaign/add-contact-to-campaign.mjs +++ b/components/salesforce_rest_api/actions/add-contact-to-campaign/add-contact-to-campaign.mjs @@ -6,9 +6,7 @@ export default { key: "salesforce_rest_api-add-contact-to-campaign", name: "Add Contact to Campaign", description: toSingleLineString(` - Adds an existing contact to an existing campaign. - See [Event SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_campaignmember.htm) - and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm) + Adds an existing contact to an existing campaign. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_campaignmember.htm) `), version: "0.0.6", type: "action", @@ -23,7 +21,7 @@ export default { }), ], label: "Campaign ID", - description: "ID of the Campaign to which this Lead is associated.", + description: "The Campaign to add a Contact to.", }, contactId: { propDefinition: [ @@ -34,7 +32,7 @@ export default { }), ], label: "Contact ID", - description: "ID of the Contact who is associated with a Campaign.", + description: "The Contact to add to the selected Campaign.", }, }, async run({ $ }) { From 04fde4bc2834fc79ac637f85f279362db5d65860 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Tue, 2 Jul 2024 22:43:36 -0300 Subject: [PATCH 021/106] Adding $ to remaining requests --- .../actions/delete-record/delete-record.mjs | 5 +++-- .../actions/find-records/find-records.mjs | 8 +++++--- .../actions/search-string/search-string.mjs | 9 ++++++--- .../salesforce_rest_api.app.mjs | 15 ++++++++++----- 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/components/salesforce_rest_api/actions/delete-record/delete-record.mjs b/components/salesforce_rest_api/actions/delete-record/delete-record.mjs index db7f508eb6e62..a75d8927952d1 100644 --- a/components/salesforce_rest_api/actions/delete-record/delete-record.mjs +++ b/components/salesforce_rest_api/actions/delete-record/delete-record.mjs @@ -32,10 +32,11 @@ export default { sobjectType, sobjectId, } = this; - const response = await this.salesForceRestApi.deleteObject( + const response = await this.salesForceRestApi.deleteObject({ + $, sobjectType, sobjectId, - ); + }); response && $.export("$summary", `Successfully deleted record with ID ${sobjectId}`); return response; }, diff --git a/components/salesforce_rest_api/actions/find-records/find-records.mjs b/components/salesforce_rest_api/actions/find-records/find-records.mjs index 53df0cba502fd..aa978681788c0 100644 --- a/components/salesforce_rest_api/actions/find-records/find-records.mjs +++ b/components/salesforce_rest_api/actions/find-records/find-records.mjs @@ -38,12 +38,14 @@ export default { fields, ids, } = this; - const response = await this.salesForceRestApi.getRecords( - sobjectType, { + const response = await this.salesForceRestApi.getRecords({ + $, + sobjectType, + params: { fields: Array.isArray(fields) && fields.join(",") || fields, ids: Array.isArray(ids) && ids.join(",") || ids, }, - ); + }); if (response) { $.export("$summary", "Record found successfully"); } diff --git a/components/salesforce_rest_api/actions/search-string/search-string.mjs b/components/salesforce_rest_api/actions/search-string/search-string.mjs index b490099f33c32..2f06ad83958cb 100644 --- a/components/salesforce_rest_api/actions/search-string/search-string.mjs +++ b/components/salesforce_rest_api/actions/search-string/search-string.mjs @@ -35,9 +35,12 @@ export default { } = this; try { const response = await this.salesForceRestApi.parameterizedSearch({ - q: searchTerm, - sobject: sobjectType, - fields: fields.join(","), + $, + params: { + q: searchTerm, + sobject: sobjectType, + fields: fields.join(","), + }, }); const resultsFound = response.searchRecords.length; $.export("$summary", "Search completed successfully"); diff --git a/components/salesforce_rest_api/salesforce_rest_api.app.mjs b/components/salesforce_rest_api/salesforce_rest_api.app.mjs index f19cc96e2aea9..7a37b04f13ae3 100644 --- a/components/salesforce_rest_api/salesforce_rest_api.app.mjs +++ b/components/salesforce_rest_api/salesforce_rest_api.app.mjs @@ -241,18 +241,23 @@ export default { ...args, }); }, - async deleteObject(objectType, sobjectId) { + async deleteObject({ + objectType, sobjectId, ...args + }) { const url = `${this._sObjectsApiUrl()}/${objectType}/${sobjectId}`; return this._makeRequest({ url, method: "DELETE", + ...args, }); }, - async getRecords(objectType, params) { + async getRecords({ + objectType, ...args + }) { const url = `${this._sCompositeApiUrl()}/${objectType}`; return this._makeRequest({ url, - params, + ...args, }); }, async getSObject(objectType, id, params = null) { @@ -510,14 +515,14 @@ export default { url, }); }, - async parameterizedSearch(params) { + async parameterizedSearch(args) { const baseUrl = this._baseApiVersionUrl(); const url = `${baseUrl}/parameterizedSearch/`; return this._makeRequest({ url, method: "GET", - params, + ...args, }); }, async insertBlobData(sobjectName, { From 6bb73b5d9ab2d0a7c1a2e2d678e1098ecb95645b Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 3 Jul 2024 01:12:17 -0300 Subject: [PATCH 022/106] Version bumps --- .../actions/add-contact-to-campaign/add-contact-to-campaign.mjs | 2 +- .../actions/add-lead-to-campaign/add-lead-to-campaign.mjs | 2 +- .../convert-soap-xml-to-json/convert-soap-xml-to-json.mjs | 2 +- .../actions/create-account/create-account.mjs | 2 +- .../actions/create-attachment/create-attachment.mjs | 2 +- .../actions/create-campaign/create-campaign.mjs | 2 +- .../salesforce_rest_api/actions/create-case/create-case.mjs | 2 +- .../actions/create-casecomment/create-casecomment.mjs | 2 +- .../actions/create-contact/create-contact.mjs | 2 +- .../salesforce_rest_api/actions/create-event/create-event.mjs | 2 +- .../salesforce_rest_api/actions/create-lead/create-lead.mjs | 2 +- .../salesforce_rest_api/actions/create-note/create-note.mjs | 2 +- .../actions/create-opportunity/create-opportunity.mjs | 2 +- .../salesforce_rest_api/actions/create-record/create-record.mjs | 2 +- .../salesforce_rest_api/actions/create-task/create-task.mjs | 2 +- .../salesforce_rest_api/actions/create-user/create-user.mjs | 2 +- .../actions/delete-opportunity/delete-opportunity.mjs | 2 +- .../salesforce_rest_api/actions/delete-record/delete-record.mjs | 2 +- .../actions/find-create-record/find-create-record.mjs | 2 +- .../salesforce_rest_api/actions/find-records/find-records.mjs | 2 +- .../get-sobject-fields-values/get-sobject-fields-values.mjs | 2 +- .../actions/insert-blob-data/insert-blob-data.mjs | 2 +- .../actions/post-feed-to-chatter/post-feed-to-chatter.mjs | 2 +- .../salesforce_rest_api/actions/search-string/search-string.mjs | 2 +- .../salesforce_rest_api/actions/soql-search/soql-search.mjs | 2 +- .../salesforce_rest_api/actions/sosl-search/sosl-search.mjs | 2 +- .../actions/update-account/update-account.mjs | 2 +- .../actions/update-contact/update-contact.mjs | 2 +- .../actions/update-opportunity/update-opportunity.mjs | 2 +- .../salesforce_rest_api/actions/update-record/update-record.mjs | 2 +- 30 files changed, 30 insertions(+), 30 deletions(-) diff --git a/components/salesforce_rest_api/actions/add-contact-to-campaign/add-contact-to-campaign.mjs b/components/salesforce_rest_api/actions/add-contact-to-campaign/add-contact-to-campaign.mjs index f6812f48b82a7..240302cce6dd2 100644 --- a/components/salesforce_rest_api/actions/add-contact-to-campaign/add-contact-to-campaign.mjs +++ b/components/salesforce_rest_api/actions/add-contact-to-campaign/add-contact-to-campaign.mjs @@ -8,7 +8,7 @@ export default { description: toSingleLineString(` Adds an existing contact to an existing campaign. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_campaignmember.htm) `), - version: "0.0.6", + version: "0.1.0", type: "action", props: { salesForceRestApi, diff --git a/components/salesforce_rest_api/actions/add-lead-to-campaign/add-lead-to-campaign.mjs b/components/salesforce_rest_api/actions/add-lead-to-campaign/add-lead-to-campaign.mjs index fa8e461b98e1a..efb0f9e019b38 100644 --- a/components/salesforce_rest_api/actions/add-lead-to-campaign/add-lead-to-campaign.mjs +++ b/components/salesforce_rest_api/actions/add-lead-to-campaign/add-lead-to-campaign.mjs @@ -10,7 +10,7 @@ export default { See [Event SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_campaignmember.htm) and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm) `), - version: "0.0.6", + version: "0.1.0", type: "action", props: { salesForceRestApi, diff --git a/components/salesforce_rest_api/actions/convert-soap-xml-to-json/convert-soap-xml-to-json.mjs b/components/salesforce_rest_api/actions/convert-soap-xml-to-json/convert-soap-xml-to-json.mjs index 3da34fd40dcf4..70ce1588be17e 100644 --- a/components/salesforce_rest_api/actions/convert-soap-xml-to-json/convert-soap-xml-to-json.mjs +++ b/components/salesforce_rest_api/actions/convert-soap-xml-to-json/convert-soap-xml-to-json.mjs @@ -5,7 +5,7 @@ export default { key: "salesforce_rest_api-convert-soap-xml-to-json", name: "Convert SOAP XML Object to JSON", description: "Converts a SOAP XML Object received from Salesforce to JSON", - version: "0.0.5", + version: "0.1.0", type: "action", props: { salesforce_rest_api, diff --git a/components/salesforce_rest_api/actions/create-account/create-account.mjs b/components/salesforce_rest_api/actions/create-account/create-account.mjs index 892c38806ab0c..e16b355c63549 100644 --- a/components/salesforce_rest_api/actions/create-account/create-account.mjs +++ b/components/salesforce_rest_api/actions/create-account/create-account.mjs @@ -17,7 +17,7 @@ export default { See [Account SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_account.htm) and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm) `), - version: "0.2.7", + version: "0.3.0", type: "action", props: { salesforce, diff --git a/components/salesforce_rest_api/actions/create-attachment/create-attachment.mjs b/components/salesforce_rest_api/actions/create-attachment/create-attachment.mjs index 0bee1fe1087d4..029c864213d15 100644 --- a/components/salesforce_rest_api/actions/create-attachment/create-attachment.mjs +++ b/components/salesforce_rest_api/actions/create-attachment/create-attachment.mjs @@ -16,7 +16,7 @@ export default { See [Attachment SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_attachment.htm) and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm) `), - version: "0.3.7", + version: "0.4.0", type: "action", props: { salesforce, diff --git a/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs b/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs index 7a702ddcdd2ee..1868f8bdee9ed 100644 --- a/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs +++ b/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs @@ -16,7 +16,7 @@ export default { See [Campaign SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_campaign.htm) and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm) `), - version: "0.2.7", + version: "0.3.0", type: "action", props: { salesforce, diff --git a/components/salesforce_rest_api/actions/create-case/create-case.mjs b/components/salesforce_rest_api/actions/create-case/create-case.mjs index 3639dc94a78a8..c32aaa0d35f09 100644 --- a/components/salesforce_rest_api/actions/create-case/create-case.mjs +++ b/components/salesforce_rest_api/actions/create-case/create-case.mjs @@ -16,7 +16,7 @@ export default { See [Case SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_case.htm) and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm) `), - version: "0.2.7", + version: "0.3.0", type: "action", props: { salesforce, diff --git a/components/salesforce_rest_api/actions/create-casecomment/create-casecomment.mjs b/components/salesforce_rest_api/actions/create-casecomment/create-casecomment.mjs index b382c01377675..5d7533ba7c528 100644 --- a/components/salesforce_rest_api/actions/create-casecomment/create-casecomment.mjs +++ b/components/salesforce_rest_api/actions/create-casecomment/create-casecomment.mjs @@ -16,7 +16,7 @@ export default { See [CaseComment SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_casecomment.htm) and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm) `), - version: "0.2.7", + version: "0.3.0", type: "action", props: { salesforce, diff --git a/components/salesforce_rest_api/actions/create-contact/create-contact.mjs b/components/salesforce_rest_api/actions/create-contact/create-contact.mjs index ac56612e98dbc..2d67e7f8801f4 100644 --- a/components/salesforce_rest_api/actions/create-contact/create-contact.mjs +++ b/components/salesforce_rest_api/actions/create-contact/create-contact.mjs @@ -16,7 +16,7 @@ export default { See [Contact SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_contact.htm) and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm) `), - version: "0.2.7", + version: "0.3.0", type: "action", props: { salesforce, diff --git a/components/salesforce_rest_api/actions/create-event/create-event.mjs b/components/salesforce_rest_api/actions/create-event/create-event.mjs index fb233f865f7e5..dff3a36f73c7d 100644 --- a/components/salesforce_rest_api/actions/create-event/create-event.mjs +++ b/components/salesforce_rest_api/actions/create-event/create-event.mjs @@ -11,7 +11,7 @@ export default { See [Event SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_event.htm) and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm) `), - version: "0.2.7", + version: "0.3.0", type: "action", props: { salesforce, diff --git a/components/salesforce_rest_api/actions/create-lead/create-lead.mjs b/components/salesforce_rest_api/actions/create-lead/create-lead.mjs index 8bb5954d38617..d6a627eae6628 100644 --- a/components/salesforce_rest_api/actions/create-lead/create-lead.mjs +++ b/components/salesforce_rest_api/actions/create-lead/create-lead.mjs @@ -16,7 +16,7 @@ export default { See [Lead SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_lead.htm) and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm) `), - version: "0.2.7", + version: "0.3.0", type: "action", props: { salesforce, diff --git a/components/salesforce_rest_api/actions/create-note/create-note.mjs b/components/salesforce_rest_api/actions/create-note/create-note.mjs index 47b167281d580..3108bdf9451ad 100644 --- a/components/salesforce_rest_api/actions/create-note/create-note.mjs +++ b/components/salesforce_rest_api/actions/create-note/create-note.mjs @@ -16,7 +16,7 @@ export default { See [Note SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_note.htm) and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm) `), - version: "0.2.7", + version: "0.3.0", type: "action", props: { salesforce, diff --git a/components/salesforce_rest_api/actions/create-opportunity/create-opportunity.mjs b/components/salesforce_rest_api/actions/create-opportunity/create-opportunity.mjs index 6d0f561d47a5f..d2d07c0723cf5 100644 --- a/components/salesforce_rest_api/actions/create-opportunity/create-opportunity.mjs +++ b/components/salesforce_rest_api/actions/create-opportunity/create-opportunity.mjs @@ -16,7 +16,7 @@ export default { See [Opportunity SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_opportunity.htm) and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm) `), - version: "0.2.7", + version: "0.3.0", type: "action", props: { salesforce, diff --git a/components/salesforce_rest_api/actions/create-record/create-record.mjs b/components/salesforce_rest_api/actions/create-record/create-record.mjs index 8e22d0d271869..c0f11bd6cf56b 100644 --- a/components/salesforce_rest_api/actions/create-record/create-record.mjs +++ b/components/salesforce_rest_api/actions/create-record/create-record.mjs @@ -8,7 +8,7 @@ export default { Create new records of a given resource. See [docs](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_create.htm) `), - version: "0.2.7", + version: "0.3.0", type: "action", props: { salesforce, diff --git a/components/salesforce_rest_api/actions/create-task/create-task.mjs b/components/salesforce_rest_api/actions/create-task/create-task.mjs index 54b10bdbf2dc7..ab7709f2ebda7 100644 --- a/components/salesforce_rest_api/actions/create-task/create-task.mjs +++ b/components/salesforce_rest_api/actions/create-task/create-task.mjs @@ -16,7 +16,7 @@ export default { See [Task SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_task.htm) and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm) `), - version: "0.3.7", + version: "0.4.0", type: "action", props: { salesforce, diff --git a/components/salesforce_rest_api/actions/create-user/create-user.mjs b/components/salesforce_rest_api/actions/create-user/create-user.mjs index 8d0a33718dd70..ae85513bfb942 100644 --- a/components/salesforce_rest_api/actions/create-user/create-user.mjs +++ b/components/salesforce_rest_api/actions/create-user/create-user.mjs @@ -13,7 +13,7 @@ export default { See [User SObject](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_user.htm) and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_create.htm) `), - version: "0.0.1", + version: "0.1.0", type: "action", props: { salesforce, diff --git a/components/salesforce_rest_api/actions/delete-opportunity/delete-opportunity.mjs b/components/salesforce_rest_api/actions/delete-opportunity/delete-opportunity.mjs index 3a79d64fddd5c..562e714be8492 100644 --- a/components/salesforce_rest_api/actions/delete-opportunity/delete-opportunity.mjs +++ b/components/salesforce_rest_api/actions/delete-opportunity/delete-opportunity.mjs @@ -9,7 +9,7 @@ export default { See [Opportunity SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_opportunity.htm) and [Delete Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_delete_record.htm) `), - version: "0.2.7", + version: "0.3.0", type: "action", props: { salesforce, diff --git a/components/salesforce_rest_api/actions/delete-record/delete-record.mjs b/components/salesforce_rest_api/actions/delete-record/delete-record.mjs index a75d8927952d1..91a64f9f99e33 100644 --- a/components/salesforce_rest_api/actions/delete-record/delete-record.mjs +++ b/components/salesforce_rest_api/actions/delete-record/delete-record.mjs @@ -5,7 +5,7 @@ export default { name: "Delete a Record in an Object", description: "Deletes an existing record in an object. [API Doc](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_query.htm)", - version: "0.1.5", + version: "0.2.0", type: "action", props: { salesForceRestApi, diff --git a/components/salesforce_rest_api/actions/find-create-record/find-create-record.mjs b/components/salesforce_rest_api/actions/find-create-record/find-create-record.mjs index 7dbf5f0b3444e..69042b9d47f42 100644 --- a/components/salesforce_rest_api/actions/find-create-record/find-create-record.mjs +++ b/components/salesforce_rest_api/actions/find-create-record/find-create-record.mjs @@ -6,7 +6,7 @@ export default { name: "Get Field Values from Object Record and optionally create one is none is found. ", description: "Finds a specified Salesforce record by a field. Optionally, create one if none is found. [API Docs](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_get_field_values.htm)", - version: "0.1.5", + version: "0.2.0", type: "action", props: { salesForceRestApi, diff --git a/components/salesforce_rest_api/actions/find-records/find-records.mjs b/components/salesforce_rest_api/actions/find-records/find-records.mjs index aa978681788c0..78a3ee0fedc9c 100644 --- a/components/salesforce_rest_api/actions/find-records/find-records.mjs +++ b/components/salesforce_rest_api/actions/find-records/find-records.mjs @@ -5,7 +5,7 @@ export default { name: "Get Object Records", description: "Retrieves all records in an object or a record in an object by the given ID or criteria. [API Doc](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_get_field_values.htm)", - version: "0.1.5", + version: "0.2.0", type: "action", props: { salesForceRestApi, diff --git a/components/salesforce_rest_api/actions/get-sobject-fields-values/get-sobject-fields-values.mjs b/components/salesforce_rest_api/actions/get-sobject-fields-values/get-sobject-fields-values.mjs index 741ae8451d889..68f39cbe1778f 100644 --- a/components/salesforce_rest_api/actions/get-sobject-fields-values/get-sobject-fields-values.mjs +++ b/components/salesforce_rest_api/actions/get-sobject-fields-values/get-sobject-fields-values.mjs @@ -8,7 +8,7 @@ export default { Retrieve field values from a record. You can specify the fields you want to retrieve. See [docs](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_get_field_values.htm) `), - version: "0.2.7", + version: "0.3.0", type: "action", props: { salesforce, diff --git a/components/salesforce_rest_api/actions/insert-blob-data/insert-blob-data.mjs b/components/salesforce_rest_api/actions/insert-blob-data/insert-blob-data.mjs index e870dc6ed2af3..3092494862aeb 100644 --- a/components/salesforce_rest_api/actions/insert-blob-data/insert-blob-data.mjs +++ b/components/salesforce_rest_api/actions/insert-blob-data/insert-blob-data.mjs @@ -8,7 +8,7 @@ export default { Inserts blob data in Salesforce standard objects. See [docs](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_insert_update_blob.htm) `), - version: "0.2.7", + version: "0.3.0", type: "action", props: { salesforce, diff --git a/components/salesforce_rest_api/actions/post-feed-to-chatter/post-feed-to-chatter.mjs b/components/salesforce_rest_api/actions/post-feed-to-chatter/post-feed-to-chatter.mjs index 5b46ed9ea1358..31c77251e03af 100644 --- a/components/salesforce_rest_api/actions/post-feed-to-chatter/post-feed-to-chatter.mjs +++ b/components/salesforce_rest_api/actions/post-feed-to-chatter/post-feed-to-chatter.mjs @@ -8,7 +8,7 @@ export default { Posts a message to the Chatter Feed. [See doc](https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/quickreference_post_feed_item.htm) `), - version: "0.0.6", + version: "0.1.0", type: "action", props: { salesForceRestApi, diff --git a/components/salesforce_rest_api/actions/search-string/search-string.mjs b/components/salesforce_rest_api/actions/search-string/search-string.mjs index 2f06ad83958cb..29c1a9ff82acf 100644 --- a/components/salesforce_rest_api/actions/search-string/search-string.mjs +++ b/components/salesforce_rest_api/actions/search-string/search-string.mjs @@ -5,7 +5,7 @@ export default { name: "Search Object Records", description: "Searches for records in an object using a parameterized search. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_search_parameterized.htm)", - version: "0.0.1", + version: "0.1.0", type: "action", props: { salesForceRestApi, diff --git a/components/salesforce_rest_api/actions/soql-search/soql-search.mjs b/components/salesforce_rest_api/actions/soql-search/soql-search.mjs index 0ae23f48e5c58..e3a0bac5774e3 100644 --- a/components/salesforce_rest_api/actions/soql-search/soql-search.mjs +++ b/components/salesforce_rest_api/actions/soql-search/soql-search.mjs @@ -8,7 +8,7 @@ export default { Executes a SOQL query. See [docs](https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql.htm) `), - version: "0.2.8", + version: "0.3.0", type: "action", props: { salesforce, diff --git a/components/salesforce_rest_api/actions/sosl-search/sosl-search.mjs b/components/salesforce_rest_api/actions/sosl-search/sosl-search.mjs index 0e9f03c864e03..5e108053e3162 100644 --- a/components/salesforce_rest_api/actions/sosl-search/sosl-search.mjs +++ b/components/salesforce_rest_api/actions/sosl-search/sosl-search.mjs @@ -8,7 +8,7 @@ export default { Executes the specified SOSL search. See [docs](https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_sosl.htm) `), - version: "0.2.7", + version: "0.3.0", type: "action", props: { salesforce, diff --git a/components/salesforce_rest_api/actions/update-account/update-account.mjs b/components/salesforce_rest_api/actions/update-account/update-account.mjs index a28f044beb96d..b7d38f7080113 100644 --- a/components/salesforce_rest_api/actions/update-account/update-account.mjs +++ b/components/salesforce_rest_api/actions/update-account/update-account.mjs @@ -17,7 +17,7 @@ export default { See [Account SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_account.htm) and [Update Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_update_fields.htm) `), - version: "0.2.7", + version: "0.3.0", type: "action", props: { salesforce, diff --git a/components/salesforce_rest_api/actions/update-contact/update-contact.mjs b/components/salesforce_rest_api/actions/update-contact/update-contact.mjs index 5a51d07995fa0..7cc300ffda56f 100644 --- a/components/salesforce_rest_api/actions/update-contact/update-contact.mjs +++ b/components/salesforce_rest_api/actions/update-contact/update-contact.mjs @@ -16,7 +16,7 @@ export default { See [Contact SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_contact.htm) and [Update Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_update_fields.htm) `), - version: "0.2.7", + version: "0.3.0", type: "action", props: { salesforce, diff --git a/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs b/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs index 684d3932ee586..c9746af6feca3 100644 --- a/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs +++ b/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs @@ -16,7 +16,7 @@ export default { See [Opportunity SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_opportunity.htm) and [Update Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_update_fields.htm) `), - version: "0.2.7", + version: "0.3.0", type: "action", props: { salesforce, diff --git a/components/salesforce_rest_api/actions/update-record/update-record.mjs b/components/salesforce_rest_api/actions/update-record/update-record.mjs index 6cf3d616eb279..dd7b6836763ba 100644 --- a/components/salesforce_rest_api/actions/update-record/update-record.mjs +++ b/components/salesforce_rest_api/actions/update-record/update-record.mjs @@ -8,7 +8,7 @@ export default { Updates a record of a given resource. [See docs here](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_update_fields.htm) `), - version: "0.2.7", + version: "0.3.0", type: "action", props: { salesforce, From bb8dfae7b68280f7d6d2b4fe87f721439d39540a Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 3 Jul 2024 01:27:54 -0300 Subject: [PATCH 023/106] Package update --- components/salesforce_rest_api/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/salesforce_rest_api/package.json b/components/salesforce_rest_api/package.json index 3cdfe0cb0335f..ccbf2505e532a 100644 --- a/components/salesforce_rest_api/package.json +++ b/components/salesforce_rest_api/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/salesforce_rest_api", - "version": "1.2.1", + "version": "1.3.0", "description": "Pipedream Salesforce (REST API) Components", "main": "salesforce_rest_api.app.mjs", "keywords": [ @@ -10,7 +10,7 @@ "homepage": "https://pipedream.com/apps/salesforce_rest_api", "author": "Pipedream (https://pipedream.com/)", "dependencies": { - "@pipedream/platform": "^1.2.0", + "@pipedream/platform": "^3.0.0", "fast-xml-parser": "^4.3.2", "handlebars": "^4.7.7", "lodash": "^4.17.21", From e08fc66793daa3e11b29f0b96300c571f573c383 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 3 Jul 2024 01:28:35 -0300 Subject: [PATCH 024/106] pnpm --- pnpm-lock.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 19f9f6c6a0950..f53032c33c889 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -7675,7 +7675,7 @@ importers: components/salesforce_rest_api: specifiers: - '@pipedream/platform': ^1.2.0 + '@pipedream/platform': ^3.0.0 fast-xml-parser: ^4.3.2 handlebars: ^4.7.7 lodash: ^4.17.21 @@ -7683,7 +7683,7 @@ importers: salesforce-webhooks: ^1.1.11 uuid: ^9.0.1 dependencies: - '@pipedream/platform': 1.5.1 + '@pipedream/platform': 3.0.0 fast-xml-parser: 4.3.2 handlebars: 4.7.8 lodash: 4.17.21 From 385c768227cc7feffc560dbf39a2a543d5c5771d Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 3 Jul 2024 01:54:11 -0300 Subject: [PATCH 025/106] Summary improvements --- .../convert-soap-xml-to-json/convert-soap-xml-to-json.mjs | 1 + .../actions/create-campaign/create-campaign.mjs | 2 +- .../salesforce_rest_api/actions/create-event/create-event.mjs | 2 +- .../salesforce_rest_api/actions/create-record/create-record.mjs | 2 +- .../salesforce_rest_api/actions/create-user/create-user.mjs | 2 +- .../actions/delete-opportunity/delete-opportunity.mjs | 2 +- .../salesforce_rest_api/actions/delete-record/delete-record.mjs | 2 +- .../get-sobject-fields-values/get-sobject-fields-values.mjs | 2 +- .../actions/insert-blob-data/insert-blob-data.mjs | 2 +- .../salesforce_rest_api/actions/sosl-search/sosl-search.mjs | 2 +- .../actions/update-account/update-account.mjs | 2 +- .../actions/update-contact/update-contact.mjs | 2 +- .../actions/update-opportunity/update-opportunity.mjs | 2 +- 13 files changed, 13 insertions(+), 12 deletions(-) diff --git a/components/salesforce_rest_api/actions/convert-soap-xml-to-json/convert-soap-xml-to-json.mjs b/components/salesforce_rest_api/actions/convert-soap-xml-to-json/convert-soap-xml-to-json.mjs index 70ce1588be17e..1ea86c0ca285b 100644 --- a/components/salesforce_rest_api/actions/convert-soap-xml-to-json/convert-soap-xml-to-json.mjs +++ b/components/salesforce_rest_api/actions/convert-soap-xml-to-json/convert-soap-xml-to-json.mjs @@ -44,6 +44,7 @@ export default { try { const notifications = json.elements[0].elements[0].elements[0].elements .filter(({ name }) => name === "Notification"); + $.export("$summary", "Successfully converted to JSON and extracted notifications"); return { notifications, }; diff --git a/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs b/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs index 1868f8bdee9ed..b28735e44a0a7 100644 --- a/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs +++ b/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs @@ -48,7 +48,7 @@ export default { $, data, }); - $.export("$summary", `Created campaign "${this.Name}"`); + $.export("$summary", `Successfully created campaign "${this.Name}"`); return response; }, }; diff --git a/components/salesforce_rest_api/actions/create-event/create-event.mjs b/components/salesforce_rest_api/actions/create-event/create-event.mjs index dff3a36f73c7d..2ee5a72584753 100644 --- a/components/salesforce_rest_api/actions/create-event/create-event.mjs +++ b/components/salesforce_rest_api/actions/create-event/create-event.mjs @@ -74,7 +74,7 @@ export default { $, data, }); - $.export("$summary", "Succcessfully created event"); + $.export("$summary", `Succcessfully created event "${this.Subject}"`); return response; }, }; diff --git a/components/salesforce_rest_api/actions/create-record/create-record.mjs b/components/salesforce_rest_api/actions/create-record/create-record.mjs index c0f11bd6cf56b..91506741d6790 100644 --- a/components/salesforce_rest_api/actions/create-record/create-record.mjs +++ b/components/salesforce_rest_api/actions/create-record/create-record.mjs @@ -30,7 +30,7 @@ export default { $, data: this.sobject, }); - $.export("$summary", `Created record "${this.objectType}"`); + $.export("$summary", `Successfully created ${this.objectType} record`); return response; }, }; diff --git a/components/salesforce_rest_api/actions/create-user/create-user.mjs b/components/salesforce_rest_api/actions/create-user/create-user.mjs index ae85513bfb942..4bd7af207a9c9 100644 --- a/components/salesforce_rest_api/actions/create-user/create-user.mjs +++ b/components/salesforce_rest_api/actions/create-user/create-user.mjs @@ -209,7 +209,7 @@ export default { $, data: utils.keysToCapitalCase(data), }); - $.export("$summary", `Successfully created user with ID \`${response.id}\``); + $.export("$summary", `Successfully created user (ID: ${response.id})`); return response; }, }; diff --git a/components/salesforce_rest_api/actions/delete-opportunity/delete-opportunity.mjs b/components/salesforce_rest_api/actions/delete-opportunity/delete-opportunity.mjs index 562e714be8492..751fe24f8402b 100644 --- a/components/salesforce_rest_api/actions/delete-opportunity/delete-opportunity.mjs +++ b/components/salesforce_rest_api/actions/delete-opportunity/delete-opportunity.mjs @@ -24,7 +24,7 @@ export default { $, id: this.OpportunityId, }); - $.export("$summary", "Successfully deleted opportunity"); + $.export("$summary", `Successfully deleted opportunity (ID: ${this.OpportunityId})`); return response; }, }; diff --git a/components/salesforce_rest_api/actions/delete-record/delete-record.mjs b/components/salesforce_rest_api/actions/delete-record/delete-record.mjs index 91a64f9f99e33..020afebfec1b9 100644 --- a/components/salesforce_rest_api/actions/delete-record/delete-record.mjs +++ b/components/salesforce_rest_api/actions/delete-record/delete-record.mjs @@ -37,7 +37,7 @@ export default { sobjectType, sobjectId, }); - response && $.export("$summary", `Successfully deleted record with ID ${sobjectId}`); + response && $.export("$summary", `Successfully deleted record (ID: ${sobjectId})`); return response; }, }; diff --git a/components/salesforce_rest_api/actions/get-sobject-fields-values/get-sobject-fields-values.mjs b/components/salesforce_rest_api/actions/get-sobject-fields-values/get-sobject-fields-values.mjs index 68f39cbe1778f..a523e94eb4c92 100644 --- a/components/salesforce_rest_api/actions/get-sobject-fields-values/get-sobject-fields-values.mjs +++ b/components/salesforce_rest_api/actions/get-sobject-fields-values/get-sobject-fields-values.mjs @@ -51,7 +51,7 @@ export default { id: this.sobjectId, params, }); - $.export("$summary", `Retrieved ${this.objectType} field values`); + $.export("$summary", `Successfully retrieved ${this.objectType} field values`); return response; }, }; diff --git a/components/salesforce_rest_api/actions/insert-blob-data/insert-blob-data.mjs b/components/salesforce_rest_api/actions/insert-blob-data/insert-blob-data.mjs index 3092494862aeb..4089c6eccdc36 100644 --- a/components/salesforce_rest_api/actions/insert-blob-data/insert-blob-data.mjs +++ b/components/salesforce_rest_api/actions/insert-blob-data/insert-blob-data.mjs @@ -71,7 +71,7 @@ export default { headers, data, }); - $.export("$summary", `Inserted Blob data to ${this.sobjectName}`); + $.export("$summary", `Successfully inserted blob data in ${this.sobjectName}`); return response; }, }; diff --git a/components/salesforce_rest_api/actions/sosl-search/sosl-search.mjs b/components/salesforce_rest_api/actions/sosl-search/sosl-search.mjs index 5e108053e3162..1b1dc8e4c34ef 100644 --- a/components/salesforce_rest_api/actions/sosl-search/sosl-search.mjs +++ b/components/salesforce_rest_api/actions/sosl-search/sosl-search.mjs @@ -23,7 +23,7 @@ export default { $, search: this.search, }); - $.export("$summary", "Successfully returned ${response.length} results for SOSL search"); + $.export("$summary", `Successfully returned ${response.length} results for SOSL search`); return response; }, }; diff --git a/components/salesforce_rest_api/actions/update-account/update-account.mjs b/components/salesforce_rest_api/actions/update-account/update-account.mjs index b7d38f7080113..c07ae5017ba43 100644 --- a/components/salesforce_rest_api/actions/update-account/update-account.mjs +++ b/components/salesforce_rest_api/actions/update-account/update-account.mjs @@ -56,7 +56,7 @@ export default { id: this.AccountId, data, }); - $.export("$summary", `Successfully updated account ${this.AccountId}`); + $.export("$summary", `Successfully updated account (ID: ${this.AccountId})`); return response; }, }; diff --git a/components/salesforce_rest_api/actions/update-contact/update-contact.mjs b/components/salesforce_rest_api/actions/update-contact/update-contact.mjs index 7cc300ffda56f..710478a2aad21 100644 --- a/components/salesforce_rest_api/actions/update-contact/update-contact.mjs +++ b/components/salesforce_rest_api/actions/update-contact/update-contact.mjs @@ -55,7 +55,7 @@ export default { id: this.ContactId, data, }); - $.export("$summary", `Successfully updated contact for ${this.ContactId}`); + $.export("$summary", `Successfully updated contact (ID: ${this.ContactId})`); return response; }, }; diff --git a/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs b/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs index c9746af6feca3..75f0b148f0492 100644 --- a/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs +++ b/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs @@ -69,7 +69,7 @@ export default { id: this.OpportunityId, data, }); - $.export("$summary", `Successfully updated opportunity ${this.OpportunityId}`); + $.export("$summary", `Successfully updated opportunity (ID: ${this.OpportunityId})`); return response; }, }; From 7009d5f77612bd0e41b600ae634dcce73d528327 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 3 Jul 2024 18:49:55 -0300 Subject: [PATCH 026/106] pnpm --- pnpm-lock.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e05bc5b124006..16c1ca609acaf 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -16237,8 +16237,6 @@ packages: - debug dev: false -<<<<<<< HEAD -======= /@pipedream/snowflake-sdk/1.0.8_asn1.js@5.4.1: resolution: {integrity: sha512-/nLCQNjlSCz71MUnOUZqWmnjZTbEX7mie91mstPspb8uDG/GvaDk/RynLGhhYfgEP5d1KWj+OPaI71hmPSxReg==} dependencies: @@ -16250,7 +16248,6 @@ packages: - supports-color dev: false ->>>>>>> origin/master /@pipedream/types/0.0.5: resolution: {integrity: sha512-VVQB9j+94XG/EB7fzKA1t0McQcQIPhaireePeLRTlJIN4y5W59SJjERjW4h5l7zWIfTnwpLizk3qGholyiw1Vw==} dependencies: From afa932d965e84e3e6f2b6c48deb5ed11e528df39 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Thu, 4 Jul 2024 20:53:56 -0300 Subject: [PATCH 027/106] Refined account props --- .../common/sobjects/account.mjs | 409 +++++++++++++++++- 1 file changed, 386 insertions(+), 23 deletions(-) diff --git a/components/salesforce_rest_api/common/sobjects/account.mjs b/components/salesforce_rest_api/common/sobjects/account.mjs index 1db5c40635645..3def08a25937f 100644 --- a/components/salesforce_rest_api/common/sobjects/account.mjs +++ b/components/salesforce_rest_api/common/sobjects/account.mjs @@ -1,27 +1,390 @@ export default { - AccountNumber: { - type: "string", - label: "Account Number", - description: "Account number assigned to this account (not the unique, system-generated ID assigned during creation). Maximum size is 40 characters.", + createProps: { + Name: { + type: "", + label: "Account Name", + description: "Name of the account. Max 255 characters.", + }, }, - AccountSource: { - type: "string", - label: "Account Source", - description: "The source of the account record. For example, Advertisement, Data.com, or Trade Show. The source is selected from a picklist of available values, which are set by an administrator in Salesforce. Each picklist value can have up to 40 characters.", - }, - AnnualRevenue: { - type: "string", - label: "Annual Revenue", - description: "Estimated annual revenue of the account.", - }, - BillingCity: { - type: "string", - label: "Billing City", - description: "Details for the billing address of this account. Maximum size is 40 characters.", - }, - BillingCountry: { - type: "string", - label: "Billing Country", - description: "Details for the billing address of this account. Maximum size is 80 characters.", + initialProps: {}, + extraProps: { + AccountNumber: { + type: "string", + label: "Account Number", + description: + "Account number assigned to this account (not the unique, system-generated ID assigned during creation). Max 40 characters.", + optional: true, + }, + AccountSource: { + type: "string", + label: "Account Source", + description: + "The source of the account record. Available values are set by an administrator.", + optional: true, + options: [], + }, + AnnualRevenue: { + type: "string", + label: "Annual Revenue", + description: "Estimated annual revenue of the account.", + optional: true, + }, + BillingCity: { + type: "string", + label: "Billing City", + description: "Max 40 characters.", + optional: true, + }, + BillingCountry: { + type: "string", + label: "Billing Country", + description: "Max 80 characters.", + optional: true, + }, + BillingCountryCode: { + type: "string", + label: "Billing Country Code", + description: "The ISO country code for the account's billing address.", + optional: true, + options: [], + }, + BillingGeocodeAccuracy: { + type: "string", + label: "Billing Geocode Accuracy", + description: + "Accuracy level of the geocode for the billing address.", + optional: true, + options: [], + }, + BillingLatitude: { + type: "string", + label: "Billing Latitude", + description: + "A number between -90 and 90 with up to 15 decimal places. Use with `Billing Longitude` to specify the precise geolocation of a billing address.", + optional: true, + }, + BillingLongitude: { + type: "string", + label: "Billing Longitude", + description: + "A number between -180 and 180 with up to 15 decimal places. Use with `Billing Latitude` to specify the precise geolocation of a billing address.", + optional: true, + }, + BillingPostalCode: { + type: "string", + label: "Billing Zip/Postal Code", + description: "Max 20 characters.", + optional: true, + }, + BillingState: { + type: "string", + label: "Billing State/Province", + description: "Max 80 characters.", + optional: true, + }, + BillingStateCode: { + type: "string", + label: "Billing State Code", + description: "The ISO state code for the account's billing address.", + optional: true, + options: [], + }, + BillingStreet: { + type: "string", + label: "Billing Street", + description: "Street address for the billing address of this account.", + optional: true, + }, + CleanStatus: { + type: "string", + label: "Clean Status", + description: + "Indicates the record's clean status as compared with Data.com.", + optional: true, + options: [ + { + value: "Acknowledged", + label: "The label on the account record detail page is Reviewed.", + }, + { + value: "Different", + label: "Different", + }, + { + value: "Inactive", + label: "Inactive", + }, + { + value: "Matched", + label: "The label on the account record detail page is In Sync.", + }, + { + value: "NotFound", + label: "NotFound", + }, + { + value: "Pending", + label: "The label on the account record detail page is Not Compared.", + }, + { + value: "SelectMatch", + label: "SelectMatch", + }, + { + value: "Skipped", + label: "Skipped", + }, + ], + }, + ConnectionReceivedId: { + type: "string", + label: "Connection Received ID", + description: + "ID of the PartnerNetworkConnection that shared this record with your organization.", + optional: true, + async options() {}, + }, + Description: { + type: "string", + label: "Account Description", + description: "Text description of the account. Limited to 32,000 KB.", + optional: true, + }, + DunsNumber: { + type: "string", + label: "D-U-N-S Number", + description: "Unique 9-digit number (Data Universal Numbering System).", + optional: true, + }, + Fax: { + type: "string", + label: "Account Fax", + description: "Fax number for the account.", + optional: true, + }, + Industry: { + type: "string", + label: "Industry", + description: "An industry associated with this account. Max 40 characters.", + optional: true, + }, + IsCustomerPortal: { + type: "boolean", + label: "Is Customer Portal", + description: "Indicates whether the account has at least one contact enabled to use the org's Experience Cloud site or Customer Portal.", + optional: true, + }, + IsPartner: { + type: "boolean", + label: "Is Partner", + description: "Indicates whether the account has at least one contact enabled to use the org's partner portal.", + optional: true, + }, + IsPriorityRecord: { + type: "boolean", + label: "Is Priority Record", + description: "Shows whether the user has marked the account as important.", + optional: true, + }, + NaicsCode: { + type: "string", + label: "NAICS Code", + description: "6-digit code (North American Industry Classification System)", + optional: true, + }, + NaicsDesc: { + type: "", + label: "NAICS Description", + description: "A brief description of an org's line of business, based on its NAICS code. Max 120 characters.", + optional: true, + }, + NumberOfEmployees: { + type: "integer", + label: "Employees", + description: "Number of employees working at the company represented by this account.", + max: 99999999, + optional: true, + }, + OperatingHoursId: { + type: "string", + label: "Operating Hour ID", + description: "The operating hours associated with the account. Available only if Field Service is enabled.", + optional: true, + async options() {}, + }, + OwnerId: { + type: "string", + label: "Owner ID", + description: "The ID of the user who currently owns this account. You must have the “Transfer Record” permission in order to update (transfer) account ownership using this field.", + optional: true, + async options() {}, + }, + Ownership: { + type: "string", + label: "Ownership", + description: "Ownership type for the account.", + optional: true, + options: [], + }, + ParentId: { + type: "string", + label: "Parent Account ID", + description: "ID of the parent object, if any.", + optional: true, + async options() {}, + }, + PersonIndividualId: { + type: "string", + label: "Person Individual ID", + description: "ID of the data privacy record associated with this person's account.", + optional: true, + async options() { }, + }, + Phone: { + type: "string", + label: "Account Phone", + description: "Phone number for this account. Max 40 characters.", + optional: true, + }, + PhotoUrl: { + type: "string", + label: "Photo URL", + description: "Path to be combined with the URL of a Salesforce instance (for example, `https://yourInstance.salesforce.com/`) to generate a URL to request the social network profile image associated with the account.", + optional: true, + }, + Rating: { + type: "string", + label: "Account Rating", + description: "The account's prospect rating.", + optional: true, + options: [], + }, + RecordTypeId: { + type: "string", + label: "Record Type ID", + description: "ID of the record type assigned to this object.", + optional: true, + async options() {}, + }, + Salutation: { + type: "string", + label: "Salutation", + description: "Honorific added to the name for use in letters, etc.", + optional: true, + options: [], + }, + ShippingCity: { + type: "string", + label: "Shipping City", + description: "Max 40 characters.", + optional: true, + }, + ShippingCountry: { + type: "string", + label: "Shipping Country", + description: "Max 80 characters.", + optional: true, + }, + ShippingCountryCode: { + type: "string", + label: "Shipping Country Code", + description: "The ISO country code for the account's shipping address.", + optional: true, + options: [], + }, + ShippingGeocodeAccuracy: { + type: "string", + label: "Shipping Geocode Accuracy", + description: "Accuracy level of the geocode for the shipping address.", + optional: true, + options: [], + }, + ShippingLatitude: { + type: "string", + label: "Shipping Latitude", + description: + "A number between -90 and 90 with up to 15 decimal places. Use with `Shipping Longitude` to specify the precise geolocation of a shipping address.", + optional: true, + }, + ShippingLongitude: { + type: "string", + label: "Shipping Longitude", + description: + "A number between -180 and 180 with up to 15 decimal places. Use with `Shipping Latitude` to specify the precise geolocation of a shipping address.", + optional: true, + }, + ShippingPostalCode: { + type: "string", + label: "Shipping Zip/Postal Code", + description: "Max 20 characters.", + optional: true, + }, + ShippingState: { + type: "string", + label: "Shipping State/Province", + description: "Max 80 characters.", + optional: true, + }, + ShippingStateCode: { + type: "string", + label: "Shipping State Code", + description: "The ISO state code for the account's shipping address.", + optional: true, + options: [], + }, + ShippingStreet: { + type: "string", + label: "Shipping Street", + description: "The street address of the shipping address for this account. Max 255 characters.", + optional: true, + }, + Sic: { + type: "string", + label: "SIC Code", + description: "Standard Industrial Classification code of the company's main business categorization, for example, 57340 for Electronics. Max 20 characters.", + optional: true, + }, + SicDesc: { + type: "string", + label: "SIC Description", + description: "A brief description of an org's line of business, based on its SIC code. Max 80 characters.", + optional: true, + }, + Site: { + type: "string", + label: "Account Site", + description: "Name of the account's location, for example Headquarters or London. Max 80 characters.", + optional: true, + }, + TickerSymbol: { + type: "string", + label: "Ticker Symbol", + description: "The stock market symbol for this account. Maximum of 20 characters.", + optional: true, + }, + Tradestyle: { + type: "string", + label: "Tradestyle", + description: "A name, different from its legal name, that an org may use for conducting business. Similar to “Doing business as” or “DBA”. Max 255 characters.", + optional: true, + }, + Type: { + type: "string", + label: "Account Type", + description: "Type of account.", + optional: true, + }, + Website: { + type: "string", + label: "Website", + description: "The website of this account. Max 255 characters.", + optional: true, + }, + YearStarted: { + type: "string", + label: "Year Started", + description: "The date when an org was legally established. Max 4 characters", + optional: true, + }, }, }; From 0ee24c25c529361bb1bdb56c0d3c5d7e5a5ecfb3 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Thu, 4 Jul 2024 23:04:55 -0300 Subject: [PATCH 028/106] Adding static options to account props --- .../common/sobjects/account.mjs | 229 ++++++++++-------- 1 file changed, 125 insertions(+), 104 deletions(-) diff --git a/components/salesforce_rest_api/common/sobjects/account.mjs b/components/salesforce_rest_api/common/sobjects/account.mjs index 3def08a25937f..3e59444bab1fc 100644 --- a/components/salesforce_rest_api/common/sobjects/account.mjs +++ b/components/salesforce_rest_api/common/sobjects/account.mjs @@ -1,7 +1,7 @@ export default { createProps: { Name: { - type: "", + type: "string", label: "Account Name", description: "Name of the account. Max 255 characters.", }, @@ -21,7 +21,13 @@ export default { description: "The source of the account record. Available values are set by an administrator.", optional: true, - options: [], + options: [ + "Web", + "Phone Inquiry", + "Partner Referral", + "Purchased List", + "Other", + ], }, AnnualRevenue: { type: "string", @@ -41,20 +47,57 @@ export default { description: "Max 80 characters.", optional: true, }, - BillingCountryCode: { - type: "string", - label: "Billing Country Code", - description: "The ISO country code for the account's billing address.", - optional: true, - options: [], - }, BillingGeocodeAccuracy: { type: "string", label: "Billing Geocode Accuracy", - description: - "Accuracy level of the geocode for the billing address.", + description: "Accuracy level of the geocode for the billing address.", optional: true, - options: [], + options: [ + { + label: "Address", + value: "Address", + }, + { + label: "Near Address", + value: "NearAddress", + }, + { + label: "Block", + value: "Block", + }, + { + label: "Street", + value: "Street", + }, + { + label: "Extended Zip", + value: "ExtendedZip", + }, + { + label: "Zip", + value: "Zip", + }, + { + label: "Neighborhood", + value: "Neighborhood", + }, + { + label: "City", + value: "City", + }, + { + label: "County", + value: "County", + }, + { + label: "State", + value: "State", + }, + { + label: "Unknown", + value: "Unknown", + }, + ], }, BillingLatitude: { type: "string", @@ -82,13 +125,6 @@ export default { description: "Max 80 characters.", optional: true, }, - BillingStateCode: { - type: "string", - label: "Billing State Code", - description: "The ISO state code for the account's billing address.", - optional: true, - options: [], - }, BillingStreet: { type: "string", label: "Billing Street", @@ -136,14 +172,6 @@ export default { }, ], }, - ConnectionReceivedId: { - type: "string", - label: "Connection Received ID", - description: - "ID of the PartnerNetworkConnection that shared this record with your organization.", - optional: true, - async options() {}, - }, Description: { type: "string", label: "Account Description", @@ -165,80 +193,64 @@ export default { Industry: { type: "string", label: "Industry", - description: "An industry associated with this account. Max 40 characters.", + description: + "An industry associated with this account. Max 40 characters.", optional: true, }, IsCustomerPortal: { type: "boolean", label: "Is Customer Portal", - description: "Indicates whether the account has at least one contact enabled to use the org's Experience Cloud site or Customer Portal.", + description: + "Indicates whether the account has at least one contact enabled to use the org's Experience Cloud site or Customer Portal.", optional: true, }, IsPartner: { type: "boolean", label: "Is Partner", - description: "Indicates whether the account has at least one contact enabled to use the org's partner portal.", + description: + "Indicates whether the account has at least one contact enabled to use the org's partner portal.", optional: true, }, IsPriorityRecord: { type: "boolean", label: "Is Priority Record", - description: "Shows whether the user has marked the account as important.", + description: + "Shows whether the user has marked the account as important.", optional: true, }, NaicsCode: { type: "string", label: "NAICS Code", - description: "6-digit code (North American Industry Classification System)", + description: + "6-digit code (North American Industry Classification System)", optional: true, }, NaicsDesc: { - type: "", + type: "string", label: "NAICS Description", - description: "A brief description of an org's line of business, based on its NAICS code. Max 120 characters.", + description: + "A brief description of an org's line of business, based on its NAICS code. Max 120 characters.", optional: true, }, NumberOfEmployees: { type: "integer", label: "Employees", - description: "Number of employees working at the company represented by this account.", + description: + "Number of employees working at the company represented by this account.", max: 99999999, optional: true, }, - OperatingHoursId: { - type: "string", - label: "Operating Hour ID", - description: "The operating hours associated with the account. Available only if Field Service is enabled.", - optional: true, - async options() {}, - }, - OwnerId: { - type: "string", - label: "Owner ID", - description: "The ID of the user who currently owns this account. You must have the “Transfer Record” permission in order to update (transfer) account ownership using this field.", - optional: true, - async options() {}, - }, Ownership: { type: "string", label: "Ownership", description: "Ownership type for the account.", optional: true, - options: [], - }, - ParentId: { - type: "string", - label: "Parent Account ID", - description: "ID of the parent object, if any.", - optional: true, - async options() {}, - }, - PersonIndividualId: { - type: "string", - label: "Person Individual ID", - description: "ID of the data privacy record associated with this person's account.", - optional: true, - async options() { }, + options: [ + "Public", + "Private", + "Subsidiary", + "Other", + ], }, Phone: { type: "string", @@ -249,7 +261,8 @@ export default { PhotoUrl: { type: "string", label: "Photo URL", - description: "Path to be combined with the URL of a Salesforce instance (for example, `https://yourInstance.salesforce.com/`) to generate a URL to request the social network profile image associated with the account.", + description: + "Path to be combined with the URL of a Salesforce instance (for example, `https://yourInstance.salesforce.com/`) to generate a URL to request the social network profile image associated with the account.", optional: true, }, Rating: { @@ -257,21 +270,11 @@ export default { label: "Account Rating", description: "The account's prospect rating.", optional: true, - options: [], - }, - RecordTypeId: { - type: "string", - label: "Record Type ID", - description: "ID of the record type assigned to this object.", - optional: true, - async options() {}, - }, - Salutation: { - type: "string", - label: "Salutation", - description: "Honorific added to the name for use in letters, etc.", - optional: true, - options: [], + options: [ + "Hot", + "Warm", + "Cold", + ], }, ShippingCity: { type: "string", @@ -285,32 +288,50 @@ export default { description: "Max 80 characters.", optional: true, }, - ShippingCountryCode: { - type: "string", - label: "Shipping Country Code", - description: "The ISO country code for the account's shipping address.", - optional: true, - options: [], - }, ShippingGeocodeAccuracy: { type: "string", label: "Shipping Geocode Accuracy", description: "Accuracy level of the geocode for the shipping address.", optional: true, - options: [], + options: [ + { + label: "Address", + value: "Address", + }, + { + label: "Near Address", + value: "NearAddress", + }, + { + label: "Block", + value: "Block", + }, + { + label: "Street", + value: "Street", + }, + { + label: "Extended Zip", + value: "ExtendedZip", + }, + { + label: "Zip", + value: "Zip", + }, + ], }, ShippingLatitude: { type: "string", label: "Shipping Latitude", description: - "A number between -90 and 90 with up to 15 decimal places. Use with `Shipping Longitude` to specify the precise geolocation of a shipping address.", + "A number between -90 and 90 with up to 15 decimal places. Use with `Shipping Longitude` to specify the precise geolocation of a shipping address.", optional: true, }, ShippingLongitude: { type: "string", label: "Shipping Longitude", description: - "A number between -180 and 180 with up to 15 decimal places. Use with `Shipping Latitude` to specify the precise geolocation of a shipping address.", + "A number between -180 and 180 with up to 15 decimal places. Use with `Shipping Latitude` to specify the precise geolocation of a shipping address.", optional: true, }, ShippingPostalCode: { @@ -325,47 +346,46 @@ export default { description: "Max 80 characters.", optional: true, }, - ShippingStateCode: { - type: "string", - label: "Shipping State Code", - description: "The ISO state code for the account's shipping address.", - optional: true, - options: [], - }, ShippingStreet: { type: "string", label: "Shipping Street", - description: "The street address of the shipping address for this account. Max 255 characters.", + description: + "The street address of the shipping address for this account. Max 255 characters.", optional: true, }, Sic: { type: "string", label: "SIC Code", - description: "Standard Industrial Classification code of the company's main business categorization, for example, 57340 for Electronics. Max 20 characters.", + description: + "Standard Industrial Classification code of the company's main business categorization, for example, 57340 for Electronics. Max 20 characters.", optional: true, }, SicDesc: { type: "string", label: "SIC Description", - description: "A brief description of an org's line of business, based on its SIC code. Max 80 characters.", + description: + "A brief description of an org's line of business, based on its SIC code. Max 80 characters.", optional: true, }, Site: { type: "string", label: "Account Site", - description: "Name of the account's location, for example Headquarters or London. Max 80 characters.", + description: + "Name of the account's location, for example Headquarters or London. Max 80 characters.", optional: true, }, TickerSymbol: { type: "string", label: "Ticker Symbol", - description: "The stock market symbol for this account. Maximum of 20 characters.", + description: + "The stock market symbol for this account. Maximum of 20 characters.", optional: true, }, Tradestyle: { type: "string", label: "Tradestyle", - description: "A name, different from its legal name, that an org may use for conducting business. Similar to “Doing business as” or “DBA”. Max 255 characters.", + description: + "A name, different from its legal name, that an org may use for conducting business. Similar to “Doing business as” or “DBA”. Max 255 characters.", optional: true, }, Type: { @@ -383,7 +403,8 @@ export default { YearStarted: { type: "string", label: "Year Started", - description: "The date when an org was legally established. Max 4 characters", + description: + "The date when an org was legally established. Max 4 characters", optional: true, }, }, From c339a0b8c14e965da808f71601fb347da7d07e74 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Fri, 5 Jul 2024 00:34:00 -0300 Subject: [PATCH 029/106] additionalProps mechanism + splitting into initial and extra props --- .../actions/common/base.mjs | 15 +++--- .../actions/create-account/create-account.mjs | 19 ++++--- .../common/sobjects/account.mjs | 50 +++++++++++-------- .../salesforce_rest_api.app.mjs | 7 +++ 4 files changed, 53 insertions(+), 38 deletions(-) diff --git a/components/salesforce_rest_api/actions/common/base.mjs b/components/salesforce_rest_api/actions/common/base.mjs index 251cd3f8200a6..338d379544c72 100644 --- a/components/salesforce_rest_api/actions/common/base.mjs +++ b/components/salesforce_rest_api/actions/common/base.mjs @@ -5,14 +5,13 @@ export default { salesforce, }, methods: { - additionalProps(selector, sobject) { - if (!selector || !sobject) { - return {}; - } - return selector.reduce((props, prop) => ({ - ...props, - [prop]: sobject[prop], - }), {}); + getAdvancedProps() { + return {}; + }, + additionalProps() { + return this.useAdvancedProps + ? this.getAdvancedProps() + : {}; }, }, }; diff --git a/components/salesforce_rest_api/actions/create-account/create-account.mjs b/components/salesforce_rest_api/actions/create-account/create-account.mjs index e16b355c63549..2a3f586d25c8e 100644 --- a/components/salesforce_rest_api/actions/create-account/create-account.mjs +++ b/components/salesforce_rest_api/actions/create-account/create-account.mjs @@ -19,21 +19,20 @@ export default { `), version: "0.3.0", type: "action", + methods: { + getAdvancedProps() { + return account.extraProps; + }, + }, props: { salesforce, - Name: { - type: "string", - label: "Name", - description: "Name of the account.", - }, - selector: { + ...account.createProps, + ...account.initialProps, + useAdvancedProps: { propDefinition: [ salesforce, - "fieldSelector", + "useAdvancedProps", ], - description: `${salesforce.propDefinitions.fieldSelector.description} Account`, - options: () => Object.keys(account), - reloadProps: true, }, }, additionalProps() { diff --git a/components/salesforce_rest_api/common/sobjects/account.mjs b/components/salesforce_rest_api/common/sobjects/account.mjs index 3e59444bab1fc..a62ef6b44ad49 100644 --- a/components/salesforce_rest_api/common/sobjects/account.mjs +++ b/components/salesforce_rest_api/common/sobjects/account.mjs @@ -6,8 +6,7 @@ export default { description: "Name of the account. Max 255 characters.", }, }, - initialProps: {}, - extraProps: { + initialProps: { AccountNumber: { type: "string", label: "Account Number", @@ -15,6 +14,26 @@ export default { "Account number assigned to this account (not the unique, system-generated ID assigned during creation). Max 40 characters.", optional: true, }, + Description: { + type: "string", + label: "Account Description", + description: "Text description of the account. Limited to 32,000 KB.", + optional: true, + }, + Phone: { + type: "string", + label: "Account Phone", + description: "Phone number for this account. Max 40 characters.", + optional: true, + }, + Website: { + type: "string", + label: "Website", + description: "The website of this account. Max 255 characters.", + optional: true, + }, + }, + extraProps: { AccountSource: { type: "string", label: "Account Source", @@ -172,12 +191,6 @@ export default { }, ], }, - Description: { - type: "string", - label: "Account Description", - description: "Text description of the account. Limited to 32,000 KB.", - optional: true, - }, DunsNumber: { type: "string", label: "D-U-N-S Number", @@ -252,12 +265,6 @@ export default { "Other", ], }, - Phone: { - type: "string", - label: "Account Phone", - description: "Phone number for this account. Max 40 characters.", - optional: true, - }, PhotoUrl: { type: "string", label: "Photo URL", @@ -393,12 +400,15 @@ export default { label: "Account Type", description: "Type of account.", optional: true, - }, - Website: { - type: "string", - label: "Website", - description: "The website of this account. Max 255 characters.", - optional: true, + options: [ + "Prospect", + "Customer - Direct", + "Customer - Channel", + "Channel Partner / Reseller", + "Installation Partner", + "Technology Partner", + "Other", + ], }, YearStarted: { type: "string", diff --git a/components/salesforce_rest_api/salesforce_rest_api.app.mjs b/components/salesforce_rest_api/salesforce_rest_api.app.mjs index 7a37b04f13ae3..ee7d83d3eff17 100644 --- a/components/salesforce_rest_api/salesforce_rest_api.app.mjs +++ b/components/salesforce_rest_api/salesforce_rest_api.app.mjs @@ -85,6 +85,13 @@ export default { }, description: "A string array of contact or lead IDs who accepted this event. This JunctionIdList is linked to the AcceptedEventRelation child relationship. Warning Adding a JunctionIdList field name to the fieldsToNull property deletes all related junction records. This action can't be undone.", }, + useAdvancedProps: { + type: "boolean", + label: "Use Advanced Props", + description: "Set to true to see all available props for this object.", + optional: true, + reloadProps: true, + }, }, methods: { _authToken() { From 7fa2bbf07f24c672f9107d2a81a472914e588ea3 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sat, 6 Jul 2024 18:31:27 -0300 Subject: [PATCH 030/106] Adjustments for additionalProps model --- .../actions/common/base.mjs | 10 ++++---- .../actions/create-account/create-account.mjs | 24 ++++++++----------- .../salesforce_rest_api.app.mjs | 2 +- 3 files changed, 16 insertions(+), 20 deletions(-) diff --git a/components/salesforce_rest_api/actions/common/base.mjs b/components/salesforce_rest_api/actions/common/base.mjs index 338d379544c72..ecbaf178a49c6 100644 --- a/components/salesforce_rest_api/actions/common/base.mjs +++ b/components/salesforce_rest_api/actions/common/base.mjs @@ -8,10 +8,10 @@ export default { getAdvancedProps() { return {}; }, - additionalProps() { - return this.useAdvancedProps - ? this.getAdvancedProps() - : {}; - }, + }, + additionalProps() { + return this.useAdvancedProps + ? this.getAdvancedProps() + : {}; }, }; diff --git a/components/salesforce_rest_api/actions/create-account/create-account.mjs b/components/salesforce_rest_api/actions/create-account/create-account.mjs index 2a3f586d25c8e..01753b95992e7 100644 --- a/components/salesforce_rest_api/actions/create-account/create-account.mjs +++ b/components/salesforce_rest_api/actions/create-account/create-account.mjs @@ -1,8 +1,5 @@ import common from "../common/base.mjs"; import account from "../../common/sobjects/account.mjs"; -import { - pickBy, pick, -} from "lodash-es"; import { toSingleLineString } from "../../common/utils.mjs"; const { salesforce } = common.props; @@ -14,10 +11,8 @@ export default { description: toSingleLineString(` Creates a Salesforce account, representing an individual account, which is an organization or person involved with your business (such as customers, competitors, and partners). - See [Account SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_account.htm) - and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm) `), - version: "0.3.0", + version: "0.3.{{ts}}", type: "action", methods: { getAdvancedProps() { @@ -28,6 +23,11 @@ export default { salesforce, ...account.createProps, ...account.initialProps, + docsInfo: { + type: "alert", + alertType: "info", + content: "[See the documentation](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_account.htm) for more information on Account fields.", + }, useAdvancedProps: { propDefinition: [ salesforce, @@ -35,15 +35,11 @@ export default { ], }, }, - additionalProps() { - return this.additionalProps(this.selector, account); - }, async run({ $ }) { - const data = pickBy(pick(this, [ - "Name", - ...this.selector, - ])); - const response = await this.salesforce.createAccount({ + const { // eslint-disable-next-line no-unused-vars + salesforce, useAdvancedProps, docsInfo, ...data + } = this; + const response = await salesforce.createAccount({ $, data, }); diff --git a/components/salesforce_rest_api/salesforce_rest_api.app.mjs b/components/salesforce_rest_api/salesforce_rest_api.app.mjs index ee7d83d3eff17..dd205c4c7a083 100644 --- a/components/salesforce_rest_api/salesforce_rest_api.app.mjs +++ b/components/salesforce_rest_api/salesforce_rest_api.app.mjs @@ -87,7 +87,7 @@ export default { }, useAdvancedProps: { type: "boolean", - label: "Use Advanced Props", + label: "See All Props", description: "Set to true to see all available props for this object.", optional: true, reloadProps: true, From 7efa109b3fa90c1d451ee0b18d0c6038380b3b3d Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sun, 7 Jul 2024 04:11:55 -0300 Subject: [PATCH 031/106] Adding additionalFields common object --- .../actions/common/base.mjs | 29 ++++++++++++++++++- .../actions/create-account/create-account.mjs | 8 +++-- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/components/salesforce_rest_api/actions/common/base.mjs b/components/salesforce_rest_api/actions/common/base.mjs index ecbaf178a49c6..95ecc3df6238c 100644 --- a/components/salesforce_rest_api/actions/common/base.mjs +++ b/components/salesforce_rest_api/actions/common/base.mjs @@ -8,10 +8,37 @@ export default { getAdvancedProps() { return {}; }, + getAdditionalFields() { + return Object.fromEntries(Object.entries(this.additionalFields ?? {}).map(([ + key, + value, + ]) => { + try { + return [ + key, + JSON.parse(value), + ]; + } catch (err) { + return [ + key, + value, + ]; + } + })); + }, }, additionalProps() { return this.useAdvancedProps - ? this.getAdvancedProps() + ? { + ...this.getAdvancedProps(), + additionalFields: { + type: "object", + label: "Additional Fields", + description: + "Other fields to set for this object. Values will be parsed as JSON where applicable.", + optional: true, + }, + } : {}; }, }; diff --git a/components/salesforce_rest_api/actions/create-account/create-account.mjs b/components/salesforce_rest_api/actions/create-account/create-account.mjs index 01753b95992e7..6adf8b4f7949c 100644 --- a/components/salesforce_rest_api/actions/create-account/create-account.mjs +++ b/components/salesforce_rest_api/actions/create-account/create-account.mjs @@ -15,6 +15,7 @@ export default { version: "0.3.{{ts}}", type: "action", methods: { + ...common.methods, getAdvancedProps() { return account.extraProps; }, @@ -37,11 +38,14 @@ export default { }, async run({ $ }) { const { // eslint-disable-next-line no-unused-vars - salesforce, useAdvancedProps, docsInfo, ...data + salesforce, useAdvancedProps, docsInfo, additionalFields, ...data } = this; const response = await salesforce.createAccount({ $, - data, + data: { + ...data, + ...this.getAdditionalFields(), + }, }); $.export("$summary", `Successfully created account "${this.Name}"`); return response; From 52b1e86ed0996129ea3617d6b556cdabddd10e29 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Tue, 9 Jul 2024 21:48:32 -0300 Subject: [PATCH 032/106] Attachment props + common props w/ async options --- .../salesforce_rest_api/common/props.mjs | 28 +++++++ .../common/sobjects/attachment.mjs | 78 +++++++++++++++---- 2 files changed, 89 insertions(+), 17 deletions(-) create mode 100644 components/salesforce_rest_api/common/props.mjs diff --git a/components/salesforce_rest_api/common/props.mjs b/components/salesforce_rest_api/common/props.mjs new file mode 100644 index 0000000000000..3e32a9f30ba90 --- /dev/null +++ b/components/salesforce_rest_api/common/props.mjs @@ -0,0 +1,28 @@ +export default { + PartnerNetworkConnectionId: { + type: "string", + label: "Partner Network Connection ID", + description: "The ID of a connection between Salesforce organizations.", + optional: true, + async options() { + const items = await this.salesforce.listSObjectTypeIds("PartnerNetworkConnection"); + return items?.map((item) => ({ + label: item.ConnectionName, + value: item.Id, + })); + }, + }, + UserId: { + type: "string", + label: "User ID", + description: "The ID of a user in your organization.", + optional: true, + async options() { + const items = await this.salesforce.listSObjectTypeIds("User"); + return items?.map((item) => ({ + label: item.Name, + value: item.Id, + })); + }, + }, +}; diff --git a/components/salesforce_rest_api/common/sobjects/attachment.mjs b/components/salesforce_rest_api/common/sobjects/attachment.mjs index 1253504928220..e139ae33428df 100644 --- a/components/salesforce_rest_api/common/sobjects/attachment.mjs +++ b/components/salesforce_rest_api/common/sobjects/attachment.mjs @@ -1,22 +1,66 @@ +import commonProps from "../props.mjs"; + export default { - ContentType: { - type: "string", - label: "Content Type", - description: "The content type of the attachment. If the Don't allow HTML uploads as attachments or document records security setting is enabled for your organization, you cannot upload files with the following file extensions: .htm, .html, .htt, .htx, .mhtm, .mhtml, .shtm, .shtml, .acgi, .svg. When you insert a document or attachment through the API, make sure that this field is set to the appropriate MIME type.", + createProps: { + Name: { + type: "string", + label: "File Name", + description: "Name of the attached file. Max 255 characters.", + }, + filePathOrContent: { + type: "string", + label: "File Path or Content", + description: "The path to a file in the `tmp` folder [(see the documentation)](https://pipedream.com/docs/code/nodejs/working-with-files). Alternatively, you can provide the base64-encoded file data.", + }, + ContentType: { + type: "string", + label: "Content Type", + description: "The content type (MIME type) of the attachment. For example, `image/png`.", + }, }, - Description: { - type: "string", - label: "Description", - description: "Description of the attachment. Maximum size is 500 characters. This field is available in API version 18.0 and later.", + initialProps: { + Description: { + type: "string", + label: "Description", + description: "Description of the attachment. Max 500 characters.", + optional: true, + }, }, - IsPrivate: { - type: "boolean", - label: "Is Private?", - description: "Indicates whether this record is viewable only by the owner and administrators (true) or viewable by all otherwise-allowed users (false). During a create or update call, it is possible to mark an Attachment record as private even if you are not the owner. This can result in a situation in which you can no longer access the record that you just inserted or updated. Label is Private.Attachments on tasks or events can't be marked private.", - }, - OwnerId: { - type: "string", - label: "Owner ID", - description: "ID of the User who owns the attachment. This field was required previous to release 9.0. Beginning with release 9.0, it can be null on create. The owner of an attachment on a task or event must be the same as the owner of the task or event.", + extraProps: { + ConnectionReceivedId: { + ...commonProps.PartnerNetworkConnectionId, + label: "Connection Received ID", + description: "ID of the `PartnerNetworkConnection` that shared this record with your organization.", + }, + IsEncrypted: { + type: "boolean", + label: "Is Encrypted", + description: "Whether the attachment is encrypted using Shield Platform Encryption.", + optional: true, + }, + IsPartnerShared: { + type: "boolean", + label: "Is Shared With Partner", + description: "Whether this record is shared with a connection using Salesforce to Salesforce.", + optional: true, + }, + IsPrivate: { + type: "boolean", + label: "Private", + description: "Whether this record is viewable only by the owner and administrators (true) or viewable by all otherwise-allowed users (false).", + optional: true, + }, + OwnerId: { + ...commonProps.UserId, + label: "Owner ID", + description: "ID of the user who owns the attachment.", + optional: true, + }, + ParentId: { + type: "string", + label: "Parent ID", + description: "ID of the parent object of the attachment. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_attachment.htm) for supported objects.", + optional: true, + }, }, }; From d38111d0017c9416607cdaafd59af92ab38336a2 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Tue, 9 Jul 2024 22:13:29 -0300 Subject: [PATCH 033/106] Prop adjustments --- components/salesforce_rest_api/common/props.mjs | 2 -- components/salesforce_rest_api/common/sobjects/attachment.mjs | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/components/salesforce_rest_api/common/props.mjs b/components/salesforce_rest_api/common/props.mjs index 3e32a9f30ba90..186e70f14c694 100644 --- a/components/salesforce_rest_api/common/props.mjs +++ b/components/salesforce_rest_api/common/props.mjs @@ -3,7 +3,6 @@ export default { type: "string", label: "Partner Network Connection ID", description: "The ID of a connection between Salesforce organizations.", - optional: true, async options() { const items = await this.salesforce.listSObjectTypeIds("PartnerNetworkConnection"); return items?.map((item) => ({ @@ -16,7 +15,6 @@ export default { type: "string", label: "User ID", description: "The ID of a user in your organization.", - optional: true, async options() { const items = await this.salesforce.listSObjectTypeIds("User"); return items?.map((item) => ({ diff --git a/components/salesforce_rest_api/common/sobjects/attachment.mjs b/components/salesforce_rest_api/common/sobjects/attachment.mjs index e139ae33428df..3928c3e950af6 100644 --- a/components/salesforce_rest_api/common/sobjects/attachment.mjs +++ b/components/salesforce_rest_api/common/sobjects/attachment.mjs @@ -31,6 +31,7 @@ export default { ...commonProps.PartnerNetworkConnectionId, label: "Connection Received ID", description: "ID of the `PartnerNetworkConnection` that shared this record with your organization.", + optional: true, }, IsEncrypted: { type: "boolean", From 6f80db10d7767c9df7f95d1055eb2a11d26ed09a Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Tue, 9 Jul 2024 23:20:00 -0300 Subject: [PATCH 034/106] Case props and lots of async options props --- .../salesforce_rest_api/common/props.mjs | 84 ++++++++ .../common/sobjects/case.mjs | 201 ++++++++++++++++-- 2 files changed, 272 insertions(+), 13 deletions(-) diff --git a/components/salesforce_rest_api/common/props.mjs b/components/salesforce_rest_api/common/props.mjs index 186e70f14c694..8bdc76c9fc649 100644 --- a/components/salesforce_rest_api/common/props.mjs +++ b/components/salesforce_rest_api/common/props.mjs @@ -1,4 +1,64 @@ export default { + AccountId: { + type: "string", + label: "Account ID", + description: "The ID of an Account.", + async options() { + const items = await this.salesforce.listSObjectTypeIds("Account"); + return items?.map((item) => ({ + label: item.Name, + value: item.Id, + })); + }, + }, + BusinessHoursId: { + type: "string", + label: "Business Hours ID", + description: "The ID of a Business Hours object.", + async options() { + const items = await this.salesforce.listSObjectTypeIds("BusinessHours"); + return items?.map((item) => ({ + label: item.Name, + value: item.Id, + })); + }, + }, + CaseId: { + type: "string", + label: "Case ID", + description: "The ID of a Case object.", + async options() { + const items = await this.salesforce.listSObjectTypeIds("Case"); + return items?.map((item) => ({ + label: item.Name, + value: item.Id, + })); + }, + }, + CommunityId: { + type: "string", + label: "Community ID", + description: "The ID of a Community (Zone) object.", + async options() { + const items = await this.salesforce.listSObjectTypeIds("Community"); + return items?.map((item) => ({ + label: item.Name, + value: item.Id, + })); + }, + }, + ContactId: { + type: "string", + label: "Account ID", + description: "The ID of a Contact.", + async options() { + const items = await this.salesforce.listSObjectTypeIds("Contact"); + return items?.map((item) => ({ + label: item.Name, + value: item.Id, + })); + }, + }, PartnerNetworkConnectionId: { type: "string", label: "Partner Network Connection ID", @@ -23,4 +83,28 @@ export default { })); }, }, + QuestionId: { + type: "string", + label: "Question ID", + description: "The ID of a Question object.", + async options() { + const items = await this.salesforce.listSObjectTypeIds("Question"); + return items?.map((item) => ({ + label: item.Title, + value: item.Id, + })); + }, + }, + RecordTypeId: { + type: "string", + label: "Record Type ID", + description: "ID of the record type assigned to this object.", + async options() { + const items = await this.salesforce.listSObjectTypeIds("RecordType"); + return items?.map((item) => ({ + label: item.Title, + value: item.Id, + })); + }, + }, }; diff --git a/components/salesforce_rest_api/common/sobjects/case.mjs b/components/salesforce_rest_api/common/sobjects/case.mjs index 6a40093d57e38..02a9380f4b7e9 100644 --- a/components/salesforce_rest_api/common/sobjects/case.mjs +++ b/components/salesforce_rest_api/common/sobjects/case.mjs @@ -1,17 +1,192 @@ +import commonProps from "../props.mjs"; + export default { - AccountId: { - type: "string", - label: "Account ID", - description: "ID of the account associated with this case.", + createProps: {}, + initialProps: { + Description: { + type: "string", + label: "Description", + description: "A text description of the case. Limit: 32 KB.", + optional: true, + }, + Status: { + type: "string", + label: "Status", + description: "The status of the case.", + optional: true, + options: [ + "New", + "Working", + "Escalated", + "Closed", + ], + }, + Subject: { + type: "string", + label: "Subject", + description: "The subject of the case. Max 255 characters.", + optional: true, + }, }, - Description: { - type: "string", - label: "Description", - description: "A text description of the case. Limit: 32 KB.", - }, - IsEscalated: { - type: "boolean", - label: "Is Escalated?", - description: "Indicates whether the case has been escalated (true) or not. A case's escalated state does not affect how you can use a case, or whether you can query, delete, or update it. You can set this flag via the API. Label is Escalated.", + extraProps: { + AccountId: { + ...commonProps.AccountId, + description: "ID of the Account associated with this case.", + optional: true, + }, + BusinessHoursId: { + ...commonProps.BusinessHoursId, + description: "ID of the Business Hours associated with this case.", + optional: true, + }, + CommunityId: { + ...commonProps.CommunityId, + description: + "ID of the [Community (Zone)](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_community.htm) associated with this case.", + optional: true, + }, + ConnectionReceivedId: { + ...commonProps.PartnerNetworkConnectionId, + label: "Connection Received ID", + description: + "ID of the `PartnerNetworkConnection` that shared this record with your organization.", + optional: true, + }, + ContactId: { + ...commonProps.ContactId, + description: "ID of the Contact associated with this case.", + optional: true, + }, + FeedItemId: { + ...commonProps.FeedItemId, + description: "ID of the question in Chatter associated with the case.", + optional: true, + }, + IsEscalated: { + type: "boolean", + label: "Escalated", + description: + "Indicates whether the case has been escalated. A case's escalated state does not affect how you can use a case, or whether you can query, delete, or update it.", + optional: true, + }, + IsStopped: { + type: "boolean", + label: "Is Stopped", + description: + "Indicates whether an entitlement process on a case is stopped.", + optional: true, + }, + Language: { + type: "string", + label: "Language", + description: "The language of the case.", + optional: true, + }, + Origin: { + type: "string", + label: "Case Origin", + description: "The source of the case.", + optional: true, + options: [ + "Phone", + "Email", + "Web", + ], + }, + OwnerId: { + ...commonProps.ContactId, + description: "ID of the contact who owns the case.", + optional: true, + }, + ParentId: { + ...commonProps.CaseId, + description: "The ID of the parent case in the hierarchy.", + optional: true, + }, + Priority: { + type: "string", + label: "Priority", + description: "The importance or urgency of the case.", + optional: true, + options: [ + "High", + "Medium", + "Low", + ], + }, + QuestionId: { + ...commonProps.QuestionId, + description: + "The question in the answers community that is associated with the case.", + optional: true, + }, + Reason: { + type: "string", + label: "Reason", + description: "The reason why the case was created.", + optional: true, + options: [ + "Installation", + "Equipment Complexity", + "Performance", + "Breakdown", + "Equipment Design", + "Feedback", + "Other", + ], + }, + RecordTypeId: { + ...commonProps.RecordTypeId, + optional: true, + }, + SlaStartDate: { + type: "string", + label: "SLA Start Date", + description: "The time that the case entered an entitlement process.", + optional: true, + }, + SourceId: { + type: "string", + label: "Source ID", + description: "The ID of the social post source.", + optional: true, + }, + SuppliedCompany: { + type: "string", + label: "Company", + description: "The company name that was entered when the case was created.", + optional: true, + }, + SuppliedEmail: { + type: "string", + label: "Email", + description: "The email address that was entered when the case was created.", + optional: true, + }, + SuppliedName: { + type: "string", + label: "Name", + description: "The name that was entered when the case was created.", + optional: true, + }, + SuppliedPhone: { + type: "string", + label: "Phone", + description: "The phone number that was entered when the case was created.", + optional: true, + }, + Type: { + type: "string", + label: "Type", + description: "The type of case.", + optional: true, + options: [ + "Mechanical", + "Electrical", + "Electronic", + "Structural", + "Other", + ], + }, }, }; From b4577b69eacdc13e81fd1ccfae148819826b5c4b Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Tue, 9 Jul 2024 23:54:41 -0300 Subject: [PATCH 035/106] Prop adjustments --- .../common/sobjects/account.mjs | 43 ++++++++++--------- .../common/sobjects/attachment.mjs | 33 +++++--------- 2 files changed, 33 insertions(+), 43 deletions(-) diff --git a/components/salesforce_rest_api/common/sobjects/account.mjs b/components/salesforce_rest_api/common/sobjects/account.mjs index a62ef6b44ad49..9757b8350b21e 100644 --- a/components/salesforce_rest_api/common/sobjects/account.mjs +++ b/components/salesforce_rest_api/common/sobjects/account.mjs @@ -203,6 +203,12 @@ export default { description: "Fax number for the account.", optional: true, }, + HasOptedOutOfEmail: { + type: "boolean", + label: "Email Opt Out", + description: "Indicates whether the contact doesn't want to receive email from Salesforce (true) or does (false)", + optional: true, + }, Industry: { type: "string", label: "Industry", @@ -210,20 +216,6 @@ export default { "An industry associated with this account. Max 40 characters.", optional: true, }, - IsCustomerPortal: { - type: "boolean", - label: "Is Customer Portal", - description: - "Indicates whether the account has at least one contact enabled to use the org's Experience Cloud site or Customer Portal.", - optional: true, - }, - IsPartner: { - type: "boolean", - label: "Is Partner", - description: - "Indicates whether the account has at least one contact enabled to use the org's partner portal.", - optional: true, - }, IsPriorityRecord: { type: "boolean", label: "Is Priority Record", @@ -265,13 +257,6 @@ export default { "Other", ], }, - PhotoUrl: { - type: "string", - label: "Photo URL", - description: - "Path to be combined with the URL of a Salesforce instance (for example, `https://yourInstance.salesforce.com/`) to generate a URL to request the social network profile image associated with the account.", - optional: true, - }, Rating: { type: "string", label: "Account Rating", @@ -418,4 +403,20 @@ export default { optional: true, }, }, + updateProps: { + IsCustomerPortal: { + type: "boolean", + label: "Is Customer Portal", + description: + "Indicates whether the account has at least one contact enabled to use the org's Experience Cloud site or Customer Portal.", + optional: true, + }, + IsPartner: { + type: "boolean", + label: "Is Partner", + description: + "Indicates whether the account has at least one contact enabled to use the org's partner portal.", + optional: true, + }, + }, }; diff --git a/components/salesforce_rest_api/common/sobjects/attachment.mjs b/components/salesforce_rest_api/common/sobjects/attachment.mjs index 3928c3e950af6..c25b29d33962e 100644 --- a/components/salesforce_rest_api/common/sobjects/attachment.mjs +++ b/components/salesforce_rest_api/common/sobjects/attachment.mjs @@ -17,6 +17,11 @@ export default { label: "Content Type", description: "The content type (MIME type) of the attachment. For example, `image/png`.", }, + ParentId: { + type: "string", + label: "Parent ID", + description: "ID of the parent object of the attachment. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_attachment.htm) for supported objects.", + }, }, initialProps: { Description: { @@ -27,24 +32,6 @@ export default { }, }, extraProps: { - ConnectionReceivedId: { - ...commonProps.PartnerNetworkConnectionId, - label: "Connection Received ID", - description: "ID of the `PartnerNetworkConnection` that shared this record with your organization.", - optional: true, - }, - IsEncrypted: { - type: "boolean", - label: "Is Encrypted", - description: "Whether the attachment is encrypted using Shield Platform Encryption.", - optional: true, - }, - IsPartnerShared: { - type: "boolean", - label: "Is Shared With Partner", - description: "Whether this record is shared with a connection using Salesforce to Salesforce.", - optional: true, - }, IsPrivate: { type: "boolean", label: "Private", @@ -57,10 +44,12 @@ export default { description: "ID of the user who owns the attachment.", optional: true, }, - ParentId: { - type: "string", - label: "Parent ID", - description: "ID of the parent object of the attachment. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_attachment.htm) for supported objects.", + }, + updateProps: { + IsPartnerShared: { + type: "boolean", + label: "Is Shared With Partner", + description: "Whether this record is shared with a connection using Salesforce to Salesforce.", optional: true, }, }, From 746f5d7ba72d955964646b4c59e29e974ce9da90 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 10 Jul 2024 00:08:31 -0300 Subject: [PATCH 036/106] Prop updates --- .../salesforce_rest_api/common/props.mjs | 12 ++++++++ .../common/sobjects/account.mjs | 29 +++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/components/salesforce_rest_api/common/props.mjs b/components/salesforce_rest_api/common/props.mjs index 8bdc76c9fc649..2b027ecb2728c 100644 --- a/components/salesforce_rest_api/common/props.mjs +++ b/components/salesforce_rest_api/common/props.mjs @@ -59,6 +59,18 @@ export default { })); }, }, + OperatingHoursId: { + type: "string", + label: "Operating Hours ID", + description: "The ID of an Operating Hours object.", + async options() { + const items = await this.salesforce.listSObjectTypeIds("OperatingHours"); + return items?.map((item) => ({ + label: item.Name, + value: item.Id, + })); + }, + }, PartnerNetworkConnectionId: { type: "string", label: "Partner Network Connection ID", diff --git a/components/salesforce_rest_api/common/sobjects/account.mjs b/components/salesforce_rest_api/common/sobjects/account.mjs index 9757b8350b21e..7a5dc986936fd 100644 --- a/components/salesforce_rest_api/common/sobjects/account.mjs +++ b/components/salesforce_rest_api/common/sobjects/account.mjs @@ -1,3 +1,5 @@ +import commonProps from "../props.mjs"; + export default { createProps: { Name: { @@ -245,6 +247,17 @@ export default { max: 99999999, optional: true, }, + OperatingHoursId: { + ...commonProps.OperatingHoursId, + description: "The operating hours associated with the account.", + optional: true, + }, + OwnerId: { + ...commonProps.UserId, + label: "Owner ID", + description: "The ID of the user who currently owns this account (defaults to the user logged in).", + optional: true, + }, Ownership: { type: "string", label: "Ownership", @@ -257,6 +270,18 @@ export default { "Other", ], }, + ParentId: { + ...commonProps.AccountId, + label: "Parent Account ID", + description: "ID of the parent account, if any.", + optional: true, + }, + PersonIndividualId: { + type: "string", + label: "Person Individual ID", + description: "ID of the data privacy record associated with this person's account.", + optional: true, + }, Rating: { type: "string", label: "Account Rating", @@ -268,6 +293,10 @@ export default { "Cold", ], }, + RecordTypeId: { + ...commonProps.RecordTypeId, + optional: true, + }, ShippingCity: { type: "string", label: "Shipping City", From 3ae947f587b1130bf765329d4ff06836f77ea310 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 10 Jul 2024 23:35:41 -0300 Subject: [PATCH 037/106] Syntax adjustments --- .../common/sobjects/account.mjs | 32 +++++++++---------- .../common/sobjects/attachment.mjs | 16 +++++----- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/components/salesforce_rest_api/common/sobjects/account.mjs b/components/salesforce_rest_api/common/sobjects/account.mjs index 7a5dc986936fd..b0257a46d1153 100644 --- a/components/salesforce_rest_api/common/sobjects/account.mjs +++ b/components/salesforce_rest_api/common/sobjects/account.mjs @@ -8,6 +8,22 @@ export default { description: "Name of the account. Max 255 characters.", }, }, + updateProps: { + IsCustomerPortal: { + type: "boolean", + label: "Is Customer Portal", + description: + "Indicates whether the account has at least one contact enabled to use the org's Experience Cloud site or Customer Portal.", + optional: true, + }, + IsPartner: { + type: "boolean", + label: "Is Partner", + description: + "Indicates whether the account has at least one contact enabled to use the org's partner portal.", + optional: true, + }, + }, initialProps: { AccountNumber: { type: "string", @@ -432,20 +448,4 @@ export default { optional: true, }, }, - updateProps: { - IsCustomerPortal: { - type: "boolean", - label: "Is Customer Portal", - description: - "Indicates whether the account has at least one contact enabled to use the org's Experience Cloud site or Customer Portal.", - optional: true, - }, - IsPartner: { - type: "boolean", - label: "Is Partner", - description: - "Indicates whether the account has at least one contact enabled to use the org's partner portal.", - optional: true, - }, - }, }; diff --git a/components/salesforce_rest_api/common/sobjects/attachment.mjs b/components/salesforce_rest_api/common/sobjects/attachment.mjs index c25b29d33962e..04d08e64f78a0 100644 --- a/components/salesforce_rest_api/common/sobjects/attachment.mjs +++ b/components/salesforce_rest_api/common/sobjects/attachment.mjs @@ -23,6 +23,14 @@ export default { description: "ID of the parent object of the attachment. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_attachment.htm) for supported objects.", }, }, + updateProps: { + IsPartnerShared: { + type: "boolean", + label: "Is Shared With Partner", + description: "Whether this record is shared with a connection using Salesforce to Salesforce.", + optional: true, + }, + }, initialProps: { Description: { type: "string", @@ -45,12 +53,4 @@ export default { optional: true, }, }, - updateProps: { - IsPartnerShared: { - type: "boolean", - label: "Is Shared With Partner", - description: "Whether this record is shared with a connection using Salesforce to Salesforce.", - optional: true, - }, - }, }; From c2bcd9018c08927de4d53e4ac6a45a8219488bb3 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Thu, 11 Jul 2024 01:19:05 -0300 Subject: [PATCH 038/106] CaseComment props --- .../common/sobjects/caseComment.mjs | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/components/salesforce_rest_api/common/sobjects/caseComment.mjs b/components/salesforce_rest_api/common/sobjects/caseComment.mjs index faf33431e887a..553baf53335f2 100644 --- a/components/salesforce_rest_api/common/sobjects/caseComment.mjs +++ b/components/salesforce_rest_api/common/sobjects/caseComment.mjs @@ -1,7 +1,23 @@ +import commonProps from "../props.mjs"; + export default { - CommentBody: { - type: "string", - label: "Comment Body", - description: "Text of the CaseComment. The maximum size of the comment body is 4,000 bytes. Label is Body.", + initialProps: { + CommentBody: { + type: "string", + label: "Body", + description: "Text of the CaseComment. Max size is 4,000 bytes.", + optional: true, + }, + ParentId: { + ...commonProps.CaseId, + label: "Parent Case ID", + description: "ID of the parent Case.", + }, + IsNotificationSelected: { + type: "boolean", + label: "Is Notification Selected", + description: "Indicates whether an email notification is sent to the case contact when a CaseComment is created or updated.", + optional: true, + }, }, }; From 16d737a4397e6ec9e6dadbb460dae12d8664eda5 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Thu, 11 Jul 2024 01:21:34 -0300 Subject: [PATCH 039/106] adding prop --- .../salesforce_rest_api/common/sobjects/caseComment.mjs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/components/salesforce_rest_api/common/sobjects/caseComment.mjs b/components/salesforce_rest_api/common/sobjects/caseComment.mjs index 553baf53335f2..dabf5c2e66730 100644 --- a/components/salesforce_rest_api/common/sobjects/caseComment.mjs +++ b/components/salesforce_rest_api/common/sobjects/caseComment.mjs @@ -19,5 +19,11 @@ export default { description: "Indicates whether an email notification is sent to the case contact when a CaseComment is created or updated.", optional: true, }, + IsPublished: { + type: "boolean", + label: "Is Published", + description: "Indicates whether the CaseComment is visible to customers in the Self-Service portal.", + optional: true, + }, }, }; From 1278a51043482efc7001b3c771ba6ceaa5c6e283 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Fri, 12 Jul 2024 03:22:04 -0300 Subject: [PATCH 040/106] Campaign props --- .../salesforce_rest_api/common/props.mjs | 12 ++ .../common/sobjects/campaign.mjs | 148 +++++++++++++++--- 2 files changed, 137 insertions(+), 23 deletions(-) diff --git a/components/salesforce_rest_api/common/props.mjs b/components/salesforce_rest_api/common/props.mjs index 2b027ecb2728c..0fa23a930d350 100644 --- a/components/salesforce_rest_api/common/props.mjs +++ b/components/salesforce_rest_api/common/props.mjs @@ -35,6 +35,18 @@ export default { })); }, }, + CampaignId: { + type: "string", + label: "Campaign ID", + description: "The ID of a Campaign object.", + async options() { + const items = await this.salesforce.listSObjectTypeIds("Campaign"); + return items?.map((item) => ({ + label: item.Name, + value: item.Id, + })); + }, + }, CommunityId: { type: "string", label: "Community ID", diff --git a/components/salesforce_rest_api/common/sobjects/campaign.mjs b/components/salesforce_rest_api/common/sobjects/campaign.mjs index 229ae6dc7d6d0..993946677ad8f 100644 --- a/components/salesforce_rest_api/common/sobjects/campaign.mjs +++ b/components/salesforce_rest_api/common/sobjects/campaign.mjs @@ -1,27 +1,129 @@ +import commonProps from "../props.mjs"; + export default { - ActualCost: { - type: "string", - label: "Actual Cost", - description: "Amount of money spent to run the campaign.", + initialProps: { + Name: { + type: "string", + label: "Name", + description: "Name of the campaign. Max 80 characters.", + }, + Description: { + type: "string", + label: "Description", + description: + "Description of the campaign. Limit: 32 KB. Only the first 255 characters display in reports.", + optional: true, + }, + Status: { + type: "string", + label: "Status", + description: "Status of the campaign. Max 40 characters.", + optional: true, + options: [ + "Planned", + "In Progress", + "Completed", + "Aborted", + ], + }, + Type: { + type: "string", + label: "Type", + description: "Type of campaign. Max 40 characters.", + optional: true, + options: [ + "Conference", + "Webinar", + "Trade Show", + "Public Relations", + "Partners", + "Referral Program", + "Advertisement", + "Banner Ads", + "Direct Mail", + "Email", + "Telemarketing", + "Other", + ], + }, }, - BudgetedCost: { - type: "string", - label: "Budgeted Cost", - description: "Amount of money budgeted for the campaign.", - }, - CampaignImageId: { - type: "string", - label: "Campaign Image ID", - description: "ID of the campaign image. Available in API version 42.0 and later.", - }, - CampaignMemberRecordTypeId: { - type: "string", - label: "Campaign Member Record Type ID", - description: "The record type ID for CampaignMember records associated with the campaign.", - }, - Description: { - type: "string", - label: "Description", - description: "Description of the campaign. Limit: 32 KB. Only the first 255 characters display in reports.", + extraProps: { + StartDate: { + type: "string", + label: "Start Date", + description: "Starting date for the campaign.", + optional: true, + }, + EndDate: { + type: "string", + label: "End Date", + description: "Ending date for the campaign. Responses received after this date are still counted.", + optional: true, + }, + ActualCost: { + type: "string", + label: "Actual Cost", + description: "Amount of money spent to run the campaign.", + optional: true, + }, + BudgetedCost: { + type: "string", + label: "Budgeted Cost", + description: "Amount of money budgeted for the campaign.", + optional: true, + }, + CampaignImageId: { + type: "string", + label: "Campaign Image ID", + description: "ID of the campaign image.", + optional: true, + }, + CurrencyIsoCode: { + type: "string", + label: "Currency ISO Code", + description: + "Available only for organizations with the multicurrency feature enabled. Contains the ISO code for any currency allowed by the organization.", + optional: true, + }, + ExpectedResponse: { + type: "string", + label: "Expected Response (%)", + description: "Percentage of responses you expect to receive for the campaign.", + optional: true, + }, + ExpectedRevenue: { + type: "string", + label: "Expected Revenue", + description: "Amount of money you expect to generate from the campaign.", + optional: true, + }, + IsActive: { + type: "boolean", + label: "Active", + description: "Indicates whether this campaign is active (default is `false`).", + optional: true, + }, + NumberSent: { + type: "integer", + label: "Number Sent", + description: "Number of individuals targeted by the campaign. For example, the number of emails sent.", + optional: true, + }, + OwnerId: { + ...commonProps.UserId, + label: "Owner ID", + description: "The ID of the user who owns this campaign (defaults to the user logged in).", + optional: true, + }, + ParentCampaign: { + ...commonProps.CampaignId, + label: "Parent Campaign ID", + description: "The campaign above this one in the campaign hierarchy.", + optional: true, + }, + RecordTypeId: { + ...commonProps.RecordTypeId, + optional: true, + }, }, }; From 51e6125b9dcbe43010779b80605e7c7861302b82 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sat, 13 Jul 2024 16:05:14 -0300 Subject: [PATCH 041/106] Contact props --- .../salesforce_rest_api/common/props.mjs | 12 + .../common/sobjects/contact.mjs | 336 +++++++++++++++--- 2 files changed, 305 insertions(+), 43 deletions(-) diff --git a/components/salesforce_rest_api/common/props.mjs b/components/salesforce_rest_api/common/props.mjs index 0fa23a930d350..43613b7798fc0 100644 --- a/components/salesforce_rest_api/common/props.mjs +++ b/components/salesforce_rest_api/common/props.mjs @@ -71,6 +71,18 @@ export default { })); }, }, + IndividualId: { + type: "string", + label: "Individual ID", + description: "The ID of an Individual object.", + async options() { + const items = await this.salesforce.listSObjectTypeIds("Individual"); + return items?.map((item) => ({ + label: item.Name, + value: item.Id, + })); + }, + }, OperatingHoursId: { type: "string", label: "Operating Hours ID", diff --git a/components/salesforce_rest_api/common/sobjects/contact.mjs b/components/salesforce_rest_api/common/sobjects/contact.mjs index 31eee067ba28f..5ed9cb4b23218 100644 --- a/components/salesforce_rest_api/common/sobjects/contact.mjs +++ b/components/salesforce_rest_api/common/sobjects/contact.mjs @@ -1,47 +1,297 @@ +import commonProps from "../props.mjs"; + export default { - AccountId: { - type: "string", - label: "Account ID", - description: "ID of the account that's the parent of this contact. We recommend that you update up to 50 contacts simultaneously when changing the accounts on contacts enabled for a Customer Portal or partner portal. We also recommend that you make this update after business hours.", + initialProps: { + Description: { + type: "string", + label: "Contact Description", + description: "A description of the contact, up to 32 KB.", + optional: true, + }, + Email: { + type: "string", + label: "Email", + description: "The contact's email address.", + optional: true, + }, + FirstName: { + type: "string", + label: "First Name", + description: "The contact's first name, up to 40 characters.", + optional: true, + }, + LastName: { + type: "string", + label: "Last Name", + description: "The contact's last name, up to 80 characters.", + }, + Phone: { + type: "string", + label: "Business Phone", + description: "Phone number for the contact.", + optional: true, + }, }, - Birthdate: { - type: "string", - label: "Birth Date", - description: "The contact's birth date.Filter criteria for report filters, list view filters, and SOQL queries ignore the year portion of the Birthdate field. For example, this SOQL query returns contacts with birthdays later in the year than today:view sourceprint?1SELECT Name, Birthdate2FROM Contact3WHERE Birthdate > TODAY", - }, - Department: { - type: "string", - label: "Department", - description: "The contact's department.", - }, - Description: { - type: "string", - label: "Description", - description: "A description of the contact. Label is Contact Description up to 32 KB.", - }, - Email: { - type: "string", - label: "Email", - description: "The contact's email address.", - }, - FirstName: { - type: "string", - label: "First Name", - description: "The contact's first name up to 40 characters.", - }, - Phone: { - type: "string", - label: "Phone", - description: "Telephone number for the contact. Label is Business Phone.", - }, - Suffix: { - type: "string", - label: "Suffix", - description: "Name suffix of the contact up to 40 characters. To enable this field, ask Salesforce Customer Support for help.", - }, - Title: { - type: "string", - label: "Title", - description: "Title of the contact, such as CEO or Vice President.", + extraProps: { + AccountId: { + ...commonProps.AccountId, + description: "ID of the account that's the parent of this contact.", + optional: true, + }, + AssistantName: { + type: "string", + label: "Assistant's Name", + description: "The assistant's name.", + optional: true, + }, + AssistantPhone: { + type: "string", + label: "Assistant's Phone", + description: "The assistant's phone number.", + optional: true, + }, + Birthdate: { + type: "string", + label: "Birthdate", + description: "The contact's birthdate.", + optional: true, + }, + CleanStatus: { + type: "string", + label: "Clean Status", + description: + "Indicates the record's clean status as compared with Data.com.", + optional: true, + options: [ + { + label: "In Sync", + value: "Matched", + }, + { + label: "Different", + value: "Different", + }, + { + label: "Reviewed", + value: "Acknowledged", + }, + { + label: "Not Found", + value: "NotFound", + }, + { + label: "Inactive", + value: "Inactive", + }, + { + label: "Not Compared", + value: "Pending", + }, + { + label: "Select Match", + value: "SelectMatch", + }, + { + label: "Skipped", + value: "Skipped", + }, + ], + }, + Department: { + type: "string", + label: "Department", + description: "The contact's department.", + optional: true, + }, + DoNotCall: { + type: "boolean", + label: "Do Not Call", + description: "Indicates that the contact doesn't want to receive calls.", + optional: true, + }, + Fax: { + type: "string", + label: "Business Fax", + description: "The contact's fax number.", + optional: true, + }, + HasOptedOutOfEmail: { + type: "boolean", + label: "Email Opt Out", + description: + "Indicates whether the contact doesn't want to receive email from Salesforce (`true`) or does (`false`).", + optional: true, + }, + HasOptedOutOfFax: { + type: "boolean", + label: "Fax Opt Out", + description: "Indicates whether the contact prohibits receiving faxes.", + optional: true, + }, + HomePhone: { + type: "string", + label: "Home Phone", + description: "The contact's home phone number.", + optional: true, + }, + IndividualId: { + ...commonProps.IndividualId, + optional: true, + }, + LeadSource: { + type: "string", + label: "Lead Source", + description: "The source of the lead that was converted to this contact.", + optional: true, + options: [ + "Web", + "Phone Inquiry", + "Partner Referral", + "Purchased List", + "Other", + ], + }, + MailingCity: { + type: "string", + label: "Mailing City", + description: "The city of the contact's mailing address.", + optional: true, + }, + MailingCountry: { + type: "string", + label: "Mailing Country", + description: "The country of the contact's mailing address.", + optional: true, + }, + MailingGeocodeAccuracy: { + type: "string", + label: "Mailing Geocode Accuracy", + description: "Accuracy level of the geocode for the mailing address.", + optional: true, + options: [ + { + label: "Address", + value: "Address", + }, + { + label: "Near Address", + value: "NearAddress", + }, + { + label: "Block", + value: "Block", + }, + { + label: "Street", + value: "Street", + }, + { + label: "Extended Zip", + value: "ExtendedZip", + }, + { + label: "Zip", + value: "Zip", + }, + { + label: "Neighborhood", + value: "Neighborhood", + }, + { + label: "City", + value: "City", + }, + { + label: "County", + value: "County", + }, + { + label: "State", + value: "State", + }, + { + label: "Unknown", + value: "Unknown", + }, + ], + }, + MailingLatitude: { + type: "string", + label: "Mailing Latitude", + description: + "A number between -90 and 90 with up to 15 decimal places. Use with `Mailing Longitude` to specify the precise geolocation of a mailing address.", + optional: true, + }, + MailingLongitude: { + type: "string", + label: "Mailing Longitude", + description: + "A number between -180 and 180 with up to 15 decimal places. Use with `Mailing Latitude` to specify the precise geolocation of a mailing address.", + optional: true, + }, + MailingPostalCode: { + type: "string", + label: "Mailing Postal Code", + description: "The postal code of the contact's mailing address.", + optional: true, + }, + MailingState: { + type: "string", + label: "Mailing State", + description: "The state of the contact's mailing address.", + optional: true, + }, + MiddleName: { + type: "string", + label: "Middle Name", + description: "The contact's middle name, up to 40 characters.", + optional: true, + }, + MobilePhone: { + type: "string", + label: "Mobile Phone", + description: "The contact's mobile phone number.", + optional: true, + }, + OwnerId: { + ...commonProps.UserId, + description: + "The ID of the owner of the account associated with this contact.", + optional: true, + }, + RecordTypeId: { + ...commonProps.RecordTypeId, + optional: true, + }, + ReportsToId: { + ...commonProps.ContactId, + optional: true, + }, + Salutation: { + type: "string", + label: "Salutation", + description: "The contact's salutation.", + optional: true, + options: [ + "Mr.", + "Ms.", + "Mrs.", + "Dr.", + "Prof.", + "Mx.", + ], + }, + Suffix: { + type: "string", + label: "Suffix", + description: "Name suffix of the contact up to 40 characters.", + optional: true, + }, + Title: { + type: "string", + label: "Title", + description: "Title of the contact, such as CEO or Vice President.", + optional: true, + }, }, }; From 96ed4ca8a8c08984187a784f68d375ef874036c0 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sun, 14 Jul 2024 23:14:27 -0300 Subject: [PATCH 042/106] Event props --- .../salesforce_rest_api/common/props.mjs | 16 + .../common/sobjects/event.mjs | 713 +++++++++++++++++- 2 files changed, 711 insertions(+), 18 deletions(-) diff --git a/components/salesforce_rest_api/common/props.mjs b/components/salesforce_rest_api/common/props.mjs index 43613b7798fc0..4200f6229c081 100644 --- a/components/salesforce_rest_api/common/props.mjs +++ b/components/salesforce_rest_api/common/props.mjs @@ -71,6 +71,22 @@ export default { })); }, }, + ContactOrLeadIds: { + type: "string[]", + label: "Contact or Lead IDs", + description: "The IDs of Contact or Lead objects.", + async options() { + const contacts = await this.salesforce.listSObjectTypeIds("Contact"); + const leads = await this.salesforce.listSObjectTypeIds("Lead"); + return [ + ...(contacts ?? []), + ...(leads ?? []), + ]?.map((item) => ({ + label: item.Name, + value: item.Id, + })); + }, + }, IndividualId: { type: "string", label: "Individual ID", diff --git a/components/salesforce_rest_api/common/sobjects/event.mjs b/components/salesforce_rest_api/common/sobjects/event.mjs index 80405e519cb8f..60bd124b7a622 100644 --- a/components/salesforce_rest_api/common/sobjects/event.mjs +++ b/components/salesforce_rest_api/common/sobjects/event.mjs @@ -1,22 +1,699 @@ +import commonProps from "../props.mjs"; + export default { - AcceptedEventInviteeIds: { - type: "string", - label: "Accepted Event Invitee IDs", - description: "A string array of contact or lead IDs who accepted this event. This JunctionIdList is linked to the AcceptedEventRelation child relationship. Warning Adding a JunctionIdList field name to the fieldsToNull property deletes all related junction records. This action can't be undone.", + initialProps: { + AcceptedEventInviteeIds: { + ...commonProps.ContactOrLeadIds, + label: "Accepted Event Invitee IDs", + description: "One or more Contact or Lead IDs who accepted this event.", + optional: true, + }, + ActivityDate: { + type: "string", + label: "Due Date / Time", + description: + "The date/time (`ActivityDateTime`) of the event, or only the date (`ActivityDate`) if it is an all-day event.", + }, + Description: { + type: "string", + label: "Description", + description: "A text description of the event. Limit: 32,000 characters.", + optional: true, + }, + DurationInMinutes: { + type: "integer", + label: "Duration (in minutes)", + description: "The event length in minutes.", + optional: true, + }, + EndDateTime: { + type: "string", + label: "End Date / Time", + description: "The date/time when the event ends.", + optional: true, + }, + IsAllDayEvent: { + type: "boolean", + label: "All-Day Event", + description: "Whether the event is an all-day event.", + optional: true, + }, + Location: { + type: "string", + label: "Location", + description: "The location of the event.", + optional: true, + }, }, - ActivityDate: { - type: "string", - label: "Activity Date", - description: "Contains the event's due date if the IsAllDayEvent flag is set to true. This field is a date field with a timestamp that is always set to midnight in the Coordinated Universal Time (UTC) time zone. Don't attempt to alter the timestamp to account for time zone differences. Label is Due Date Only.This field is required in versions 12.0 and earlier if the IsAllDayEvent flag is set to true. The value for this field and StartDateTime must match, or one of them must be null.", - }, - Description: { - type: "string", - label: "Description", - description: "Contains a text description of the event. Limit: 32,000 characters.", - }, - Subject: { - type: "string", - label: "Subject", - description: "The subject line of the event, such as Call, Email, or Meeting. Limit: 255 characters.", + extraProps: { + DeclinedEventInviteeIds: { + ...commonProps.ContactOrLeadIds, + label: "Declined Event Invitee IDs", + description: "One or more Contact or Lead IDs who declined this event.", + optional: true, + }, + IsPrivate: { + type: "boolean", + label: "Private", + description: + "If true, users other than the creator of the event can't see the event details when viewing the event user's calendar.", + optional: true, + }, + IsRecurrence: { + type: "boolean", + label: "Recurring Event", + description: + "Indicates whether a Salesforce Classic event is scheduled to repeat itself.", + optional: true, + }, + IsReminderSet: { + type: "boolean", + label: "Reminder Set", + description: "Indicates whether the activity is a reminder.", + optional: true, + }, + IsVisibleInSelfService: { + type: "boolean", + label: "Visible in Self-Service", + description: + "Indicates whether an event associated with an object can be viewed in the Customer Portal.", + optional: true, + }, + OwnerId: { + ...commonProps.UserId, + label: "Assigned to ID", + description: "ID of the user or public calendar who owns the event.", + optional: true, + }, + RecurrenceDayOfMonth: { + type: "integer", + label: "Recurrence Day of Month", + description: "The day of the month on which the event repeats.", + optional: true, + }, + RecurrenceDayOfWeekMask: { + type: "integer[]", + label: "Recurrence Day of Week", + description: "The day(s) of the week on which the event repeats.", + optional: true, + options: [ + { + label: "Sunday", + value: 1, + }, + { + label: "Monday", + value: 2, + }, + { + label: "Tuesday", + value: 4, + }, + { + label: "Wednesday", + value: 8, + }, + { + label: "Thursday", + value: 16, + }, + { + label: "Friday", + value: 32, + }, + { + label: "Saturday", + value: 64, + }, + ], + }, + RecurrenceEndDateOnly: { + type: "string", + label: "Recurrence End Date", + description: "Indicates the last date on which the event repeats.", + optional: true, + }, + RecurrenceInstance: { + type: "string", + label: "Recurrence Instance", + description: + "Indicates the frequency of the Salesforce Classic event's recurrence.", + optional: true, + options: [ + { + label: "1st", + value: "First", + }, + { + label: "2nd", + value: "Second", + }, + { + label: "3rd", + value: "Third", + }, + { + label: "4th", + value: "Fourth", + }, + { + label: "last", + value: "Last", + }, + ], + }, + RecurrenceInterval: { + type: "integer", + label: "Recurrence Interval", + description: + "Indicates the interval between Salesforce Classic recurring events.", + optional: true, + }, + RecurrenceMonthOfYear: { + type: "string", + label: "Recurrence Month of Year", + description: + "Indicates the month in which the Salesforce Classic recurring event repeats.", + optional: true, + options: [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December", + ], + }, + RecurrenceStartDateTime: { + type: "string", + label: "Recurrence Start Date / Time", + description: + "Indicates the date and time when the Salesforce Classic recurring event begins.", + optional: true, + }, + RecurrenceTimeZoneSidKey: { + type: "string", + label: "Recurrence Time Zone", + description: + "Indicates the time zone associated with a Salesforce Classic recurring event.", + optional: true, + options: [ + { + label: "(GMT+14:00) Line Islands Time (Pacific/Kiritimati)", + value: "Pacific/Kiritimati", + }, + { + label: "(GMT+13:00) Phoenix Islands Time (Pacific/Enderbury)", + value: "Pacific/Enderbury", + }, + { + label: "(GMT+13:00) Tonga Standard Time (Pacific/Tongatapu)", + value: "Pacific/Tongatapu", + }, + { + label: "(GMT+12:45) Chatham Standard Time (Pacific/Chatham)", + value: "Pacific/Chatham", + }, + { + label: + "(GMT+12:00) Petropavlovsk-Kamchatski Standard Time (Asia/Kamchatka)", + value: "Asia/Kamchatka", + }, + { + label: "(GMT+12:00) New Zealand Standard Time (Pacific/Auckland)", + value: "Pacific/Auckland", + }, + { + label: "(GMT+12:00) Fiji Standard Time (Pacific/Fiji)", + value: "Pacific/Fiji", + }, + { + label: "(GMT+11:00) Solomon Islands Time (Pacific/Guadalcanal)", + value: "Pacific/Guadalcanal", + }, + { + label: "(GMT+11:00) Norfolk Island Standard Time (Pacific/Norfolk)", + value: "Pacific/Norfolk", + }, + { + label: "(GMT+10:30) Lord Howe Standard Time (Australia/Lord_Howe)", + value: "Australia/Lord_Howe", + }, + { + label: + "(GMT+10:00) Australian Eastern Standard Time (Australia/Brisbane)", + value: "Australia/Brisbane", + }, + { + label: + "(GMT+10:00) Australian Eastern Standard Time (Australia/Sydney)", + value: "Australia/Sydney", + }, + { + label: + "(GMT+09:30) Australian Central Standard Time (Australia/Adelaide)", + value: "Australia/Adelaide", + }, + { + label: + "(GMT+09:30) Australian Central Standard Time (Australia/Darwin)", + value: "Australia/Darwin", + }, + { + label: "(GMT+09:00) Korean Standard Time (Asia/Seoul)", + value: "Asia/Seoul", + }, + { + label: "(GMT+09:00) Japan Standard Time (Asia/Tokyo)", + value: "Asia/Tokyo", + }, + { + label: "(GMT+08:00) Hong Kong Standard Time (Asia/Hong_Kong)", + value: "Asia/Hong_Kong", + }, + { + label: "(GMT+08:00) Malaysia Time (Asia/Kuala_Lumpur)", + value: "Asia/Kuala_Lumpur", + }, + { + label: "(GMT+08:00) Philippine Standard Time (Asia/Manila)", + value: "Asia/Manila", + }, + { + label: "(GMT+08:00) China Standard Time (Asia/Shanghai)", + value: "Asia/Shanghai", + }, + { + label: "(GMT+08:00) Singapore Standard Time (Asia/Singapore)", + value: "Asia/Singapore", + }, + { + label: "(GMT+08:00) Taipei Standard Time (Asia/Taipei)", + value: "Asia/Taipei", + }, + { + label: + "(GMT+08:00) Australian Western Standard Time (Australia/Perth)", + value: "Australia/Perth", + }, + { + label: "(GMT+07:00) Indochina Time (Asia/Bangkok)", + value: "Asia/Bangkok", + }, + { + label: "(GMT+07:00) Indochina Time (Asia/Ho_Chi_Minh)", + value: "Asia/Ho_Chi_Minh", + }, + { + label: "(GMT+07:00) Western Indonesia Time (Asia/Jakarta)", + value: "Asia/Jakarta", + }, + { + label: "(GMT+06:30) Myanmar Time (Asia/Rangoon)", + value: "Asia/Rangoon", + }, + { + label: "(GMT+06:00) Bangladesh Standard Time (Asia/Dhaka)", + value: "Asia/Dhaka", + }, + { + label: "(GMT+05:45) Nepal Time (Asia/Kathmandu)", + value: "Asia/Kathmandu", + }, + { + label: "(GMT+05:30) India Standard Time (Asia/Colombo)", + value: "Asia/Colombo", + }, + { + label: "(GMT+05:30) India Standard Time (Asia/Kolkata)", + value: "Asia/Kolkata", + }, + { + label: "(GMT+05:00) Pakistan Standard Time (Asia/Karachi)", + value: "Asia/Karachi", + }, + { + label: "(GMT+05:00) Uzbekistan Standard Time (Asia/Tashkent)", + value: "Asia/Tashkent", + }, + { + label: "(GMT+05:00) Yekaterinburg Standard Time (Asia/Yekaterinburg)", + value: "Asia/Yekaterinburg", + }, + { + label: "(GMT+04:30) Afghanistan Time (Asia/Kabul)", + value: "Asia/Kabul", + }, + { + label: "(GMT+04:00) Azerbaijan Standard Time (Asia/Baku)", + value: "Asia/Baku", + }, + { + label: "(GMT+04:00) Gulf Standard Time (Asia/Dubai)", + value: "Asia/Dubai", + }, + { + label: "(GMT+04:00) Georgia Standard Time (Asia/Tbilisi)", + value: "Asia/Tbilisi", + }, + { + label: "(GMT+04:00) Armenia Standard Time (Asia/Yerevan)", + value: "Asia/Yerevan", + }, + { + label: "(GMT+03:00) Eastern European Standard Time (Africa/Cairo)", + value: "Africa/Cairo", + }, + { + label: "(GMT+03:00) East Africa Time (Africa/Nairobi)", + value: "Africa/Nairobi", + }, + { + label: "(GMT+03:00) Arabian Standard Time (Asia/Baghdad)", + value: "Asia/Baghdad", + }, + { + label: "(GMT+03:00) Eastern European Summer Time (Asia/Beirut)", + value: "Asia/Beirut", + }, + { + label: "(GMT+03:00) Israel Daylight Time (Asia/Jerusalem)", + value: "Asia/Jerusalem", + }, + { + label: "(GMT+03:00) Arabian Standard Time (Asia/Kuwait)", + value: "Asia/Kuwait", + }, + { + label: "(GMT+03:00) Arabian Standard Time (Asia/Riyadh)", + value: "Asia/Riyadh", + }, + { + label: "(GMT+03:00) Eastern European Summer Time (Europe/Athens)", + value: "Europe/Athens", + }, + { + label: "(GMT+03:00) Eastern European Summer Time (Europe/Bucharest)", + value: "Europe/Bucharest", + }, + { + label: "(GMT+03:00) Eastern European Summer Time (Europe/Helsinki)", + value: "Europe/Helsinki", + }, + { + label: "(GMT+03:00) Eastern European Standard Time (Europe/Istanbul)", + value: "Europe/Istanbul", + }, + { + label: "(GMT+03:00) Moscow Standard Time (Europe/Minsk)", + value: "Europe/Minsk", + }, + { + label: "(GMT+03:00) Moscow Standard Time (Europe/Moscow)", + value: "Europe/Moscow", + }, + { + label: "(GMT+02:00) South Africa Standard Time (Africa/Johannesburg)", + value: "Africa/Johannesburg", + }, + { + label: "(GMT+02:00) Central European Summer Time (Europe/Amsterdam)", + value: "Europe/Amsterdam", + }, + { + label: "(GMT+02:00) Central European Summer Time (Europe/Berlin)", + value: "Europe/Berlin", + }, + { + label: "(GMT+02:00) Central European Summer Time (Europe/Brussels)", + value: "Europe/Brussels", + }, + { + label: "(GMT+02:00) Central European Summer Time (Europe/Paris)", + value: "Europe/Paris", + }, + { + label: "(GMT+02:00) Central European Summer Time (Europe/Prague)", + value: "Europe/Prague", + }, + { + label: "(GMT+02:00) Central European Summer Time (Europe/Rome)", + value: "Europe/Rome", + }, + { + label: "(GMT+01:00) Central European Standard Time (Africa/Algiers)", + value: "Africa/Algiers", + }, + { + label: "(GMT+01:00) Western European Summer Time (Africa/Casablanca)", + value: "Africa/Casablanca", + }, + { + label: "(GMT+01:00) Irish Standard Time (Europe/Dublin)", + value: "Europe/Dublin", + }, + { + label: "(GMT+01:00) Western European Summer Time (Europe/Lisbon)", + value: "Europe/Lisbon", + }, + { + label: "(GMT+01:00) British Summer Time (Europe/London)", + value: "Europe/London", + }, + { + label: "(GMT+00:00) Azores Summer Time (Atlantic/Azores)", + value: "Atlantic/Azores", + }, + { + label: "(GMT+00:00) Greenwich Mean Time (GMT)", + value: "GMT", + }, + { + label: + "(GMT-01:00) East Greenland Summer Time (America/Scoresbysund)", + value: "America/Scoresbysund", + }, + { + label: "(GMT-01:00) Cape Verde Standard Time (Atlantic/Cape_Verde)", + value: "Atlantic/Cape_Verde", + }, + { + label: "(GMT-02:00) South Georgia Time (Atlantic/South_Georgia)", + value: "Atlantic/South_Georgia", + }, + { + label: "(GMT-02:30) Newfoundland Daylight Time (America/St_Johns)", + value: "America/St_Johns", + }, + { + label: + "(GMT-03:00) Argentina Standard Time (America/Argentina/Buenos_Aires)", + value: "America/Argentina/Buenos_Aires", + }, + { + label: "(GMT-03:00) Atlantic Daylight Time (America/Halifax)", + value: "America/Halifax", + }, + { + label: "(GMT-03:00) Brasilia Standard Time (America/Sao_Paulo)", + value: "America/Sao_Paulo", + }, + { + label: "(GMT-03:00) Atlantic Daylight Time (Atlantic/Bermuda)", + value: "Atlantic/Bermuda", + }, + { + label: "(GMT-04:00) Venezuela Time (America/Caracas)", + value: "America/Caracas", + }, + { + label: + "(GMT-04:00) Eastern Daylight Time (America/Indiana/Indianapolis)", + value: "America/Indiana/Indianapolis", + }, + { + label: "(GMT-04:00) Eastern Daylight Time (America/New_York)", + value: "America/New_York", + }, + { + label: "(GMT-04:00) Atlantic Standard Time (America/Puerto_Rico)", + value: "America/Puerto_Rico", + }, + { + label: "(GMT-04:00) Chile Standard Time (America/Santiago)", + value: "America/Santiago", + }, + { + label: "(GMT-05:00) Colombia Standard Time (America/Bogota)", + value: "America/Bogota", + }, + { + label: "(GMT-05:00) Central Daylight Time (America/Chicago)", + value: "America/Chicago", + }, + { + label: "(GMT-05:00) Peru Standard Time (America/Lima)", + value: "America/Lima", + }, + { + label: "(GMT-05:00) Eastern Standard Time (America/Panama)", + value: "America/Panama", + }, + { + label: "(GMT-06:00) Mountain Daylight Time (America/Denver)", + value: "America/Denver", + }, + { + label: "(GMT-06:00) Central Standard Time (America/El_Salvador)", + value: "America/El_Salvador", + }, + { + label: "(GMT-06:00) Central Standard Time (America/Mexico_City)", + value: "America/Mexico_City", + }, + { + label: "(GMT-07:00) Pacific Daylight Time (America/Los_Angeles)", + value: "America/Los_Angeles", + }, + { + label: "(GMT-07:00) Mexican Pacific Standard Time (America/Mazatlan)", + value: "America/Mazatlan", + }, + { + label: "(GMT-07:00) Mountain Standard Time (America/Phoenix)", + value: "America/Phoenix", + }, + { + label: "(GMT-07:00) Pacific Daylight Time (America/Tijuana)", + value: "America/Tijuana", + }, + { + label: "(GMT-08:00) Alaska Daylight Time (America/Anchorage)", + value: "America/Anchorage", + }, + { + label: "(GMT-08:00) Pitcairn Time (Pacific/Pitcairn)", + value: "Pacific/Pitcairn", + }, + { + label: "(GMT-09:00) Hawaii-Aleutian Daylight Time (America/Adak)", + value: "America/Adak", + }, + { + label: "(GMT-09:00) Gambier Time (Pacific/Gambier)", + value: "Pacific/Gambier", + }, + { + label: "(GMT-09:30) Marquesas Time (Pacific/Marquesas)", + value: "Pacific/Marquesas", + }, + { + label: "(GMT-10:00) Hawaii-Aleutian Standard Time (Pacific/Honolulu)", + value: "Pacific/Honolulu", + }, + { + label: "(GMT-11:00) Niue Time (Pacific/Niue)", + value: "Pacific/Niue", + }, + { + label: "(GMT-11:00) Samoa Standard Time (Pacific/Pago_Pago)", + value: "Pacific/Pago_Pago", + }, + ], + }, + RecurrenceType: { + type: "string", + label: "Recurrence Type", + description: "Indicates how often the Salesforce Classic event repeats.", + optional: true, + options: [ + { + label: "Recurs Daily", + value: "RecursDaily", + }, + { + label: "Recurs Every Weekday", + value: "RecursEveryWeekday", + }, + { + label: "Recurs Monthly", + value: "RecursMonthly", + }, + { + label: "Recurs Monthly Nth", + value: "RecursMonthlyNth", + }, + { + label: "Recurs Weekly", + value: "RecursWeekly", + }, + { + label: "Recurs Yearly", + value: "RecursYearly", + }, + { + label: "Recurs Yearly Nth", + value: "RecursYearlyNth", + }, + ], + }, + ReminderDateTime: { + type: "string", + label: "Reminder Date / Time", + description: "Represents the time when the reminder is scheduled to fire", + optional: true, + }, + ShowAs: { + type: "string", + label: "Show As", + description: + "Indicates how this event appears when another user views the calendar.", + optional: true, + options: [ + { + label: "Busy", + value: "Busy", + }, + { + label: "Out of Office", + value: "OutOfOffice", + }, + { + label: "Free", + value: "Free", + }, + ], + }, + StartDateTime: { + type: "string", + label: "Start Date / Time", + description: "Indicates the start date and time of the event.", + optional: true, + }, + Subject: { + type: "string", + label: "Subject", + description: "The subject line of the event. Limit: 255 characters.", + optional: true, + options: [ + "Call", + "Email", + "Meeting", + "Send Letter/Quote", + "Other", + ], + }, + UndecidedEventInviteeIds: { + ...commonProps.ContactOrLeadIds, + label: "Undecided Event Invitee IDs", + description: "One or more Contact or Lead IDs who are undecided about this event.", + optional: true, + }, }, }; From c2e652e2e84f542c03460c2ddc63da31d00308e0 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Tue, 16 Jul 2024 11:50:32 -0300 Subject: [PATCH 043/106] Lead fields --- .../salesforce_rest_api/common/props.mjs | 12 + .../common/sobjects/lead.mjs | 356 ++++++++++++++++-- 2 files changed, 346 insertions(+), 22 deletions(-) diff --git a/components/salesforce_rest_api/common/props.mjs b/components/salesforce_rest_api/common/props.mjs index 4200f6229c081..595ee258044bc 100644 --- a/components/salesforce_rest_api/common/props.mjs +++ b/components/salesforce_rest_api/common/props.mjs @@ -111,6 +111,18 @@ export default { })); }, }, + OpportunityId: { + type: "string", + label: "Opportunity ID", + description: "The ID of an Opportunity object.", + async options() { + const items = await this.salesforce.listSObjectTypeIds("Opportunity"); + return items?.map((item) => ({ + label: item.Name, + value: item.Id, + })); + }, + }, PartnerNetworkConnectionId: { type: "string", label: "Partner Network Connection ID", diff --git a/components/salesforce_rest_api/common/sobjects/lead.mjs b/components/salesforce_rest_api/common/sobjects/lead.mjs index 10c4a6aa4ebab..7074ffb84a233 100644 --- a/components/salesforce_rest_api/common/sobjects/lead.mjs +++ b/components/salesforce_rest_api/common/sobjects/lead.mjs @@ -1,27 +1,339 @@ +import commonProps from "../props.mjs"; + export default { - City: { - type: "string", - label: "City", - description: "City for the lead's address.", + createProps: { + IsConverted: { + type: "boolean", + label: "Converted", + description: "Indicates whether the lead has been converted", + optional: true, + }, }, - Country: { - type: "string", - label: "Country", - description: "The lead's country.", + updateProps: {}, + initialProps: { + Company: { + type: "string", + label: "Company", + description: "The lead's company.", + }, + Description: { + type: "string", + label: "Description", + description: "The lead's description.", + optional: true, + }, + Email: { + type: "string", + label: "Email", + description: "The lead's email address.", + optional: true, + }, + FirstName: { + type: "string", + label: "First Name", + description: "The lead's first name.", + optional: true, + }, + LastName: { + type: "string", + label: "Last Name", + description: "The lead's last name.", + }, + Phone: { + type: "string", + label: "Phone", + description: "The lead's phone number.", + optional: true, + }, }, - Description: { - type: "string", - label: "Description", - description: "The lead's description.", - }, - Email: { - type: "string", - label: "Email", - description: "The lead's email address.", - }, - FirstName: { - type: "string", - label: "First Name", - description: "The lead's first name up to 40 characters.", + extraProps: { + AnnualRevenue: { + type: "string", + label: "Annual Revenue", + description: "Annual revenue for the lead's company.", + optional: true, + }, + City: { + type: "string", + label: "City", + description: "City for the lead's address.", + optional: true, + }, + CleanStatus: { + type: "string", + label: "Clean Status", + description: + "Indicates the record's clean status compared with Data.com.", + options: [ + { + label: "In Sync", + value: "Matched", + }, + { + label: "Different", + value: "Different", + }, + { + label: "Reviewed", + value: "Acknowledged", + }, + { + label: "Not Found", + value: "NotFound", + }, + { + label: "Inactive", + value: "Inactive", + }, + { + label: "Not Compared", + value: "Pending", + }, + { + label: "Select Match", + value: "SelectMatch", + }, + { + label: "Skipped", + value: "Skipped", + }, + ], + }, + CompanyDunsNumber: { + type: "string", + label: "Company D-U-N-S Number", + description: + "The Data Universal Numbering System (D-U-N-S) number (max 9 characters).", + optional: true, + }, + ConvertedAccountId: { + ...commonProps.AccountId, + label: "Converted Account ID", + description: "The account into which the lead converted.", + optional: true, + }, + ConvertedContactId: { + ...commonProps.ContactId, + label: "Converted Contact ID", + description: "The contact into which the lead converted.", + optional: true, + }, + ConvertedOpportunityId: { + ...commonProps.OpportunityId, + label: "Converted Opportunity ID", + description: "The opportunity into which the lead converted.", + optional: true, + }, + Country: { + type: "string", + label: "Country", + description: "The lead's country.", + optional: true, + }, + Fax: { + type: "string", + label: "Fax", + description: "The lead's fax number.", + optional: true, + }, + HasOptedOutOfEmail: { + type: "boolean", + label: "Email Opt Out", + description: + "Indicates whether the lead doesn't want to receive email from Salesforce (`true`) or not (`false`)", + optional: true, + }, + HasOptedOutOfFax: { + type: "boolean", + label: "Fax Opt Out", + description: + "Indicates whether the lead doesn't want to receive faxes from Salesforce (`true`) or not (`false`)", + optional: true, + }, + GeocodeAccuracy: { + type: "string", + label: "Geocode Accuracy", + description: "Accuracy level of the geocode for the address.", + optional: true, + options: [ + { + label: "Address", + value: "Address", + }, + { + label: "Near Address", + value: "NearAddress", + }, + { + label: "Block", + value: "Block", + }, + { + label: "Street", + value: "Street", + }, + { + label: "Extended Zip", + value: "ExtendedZip", + }, + { + label: "Zip", + value: "Zip", + }, + { + label: "Neighborhood", + value: "Neighborhood", + }, + { + label: "City", + value: "City", + }, + { + label: "County", + value: "County", + }, + { + label: "State", + value: "State", + }, + { + label: "Unknown", + value: "Unknown", + }, + ], + }, + IndividualId: { + ...commonProps.IndividualId, + label: "Individual ID", + description: "ID of the data privacy record associated with this lead.", + optional: true, + }, + Industry: { + type: "string", + label: "Industry", + description: "Industry in which the lead works.", + optional: true, + }, + IsUnreadByOwner: { + type: "boolean", + label: "Unread by Owner", + description: "If true, lead has been assigned, but not yet viewed.", + optional: true, + }, + Latitude: { + type: "string", + label: "Latitude", + description: + "A number between -90 and 90 with up to 15 decimal places. Use with `Longitude` to specify the precise geolocation of a billing address.", + optional: true, + }, + Longitude: { + type: "string", + label: "Longitude", + description: + "A number between -180 and 180 with up to 15 decimal places. Use with `Latitude` to specify the precise geolocation of an address.", + optional: true, + }, + LeadSource: { + type: "string", + label: "Lead Source", + description: "The lead's source.", + optional: true, + options: [ + "Web", + "Phone Inquiry", + "Partner Referral", + "Purchased List", + "Other", + ], + }, + MiddleName: { + type: "string", + label: "Middle Name", + description: "The lead's middle name up to 40 characters.", + optional: true, + }, + MobilePhone: { + type: "string", + label: "Mobile Phone", + description: "The lead's mobile phone number.", + optional: true, + }, + NumberOfEmployees: { + type: "integer", + label: "Employees", + description: "Number of employees at the lead's company.", + optional: true, + }, + OwnerId: { + ...commonProps.UserId, + label: "Owner ID", + description: "ID of the lead's owner.", + optional: true, + }, + PostalCode: { + type: "string", + label: "Zip/Postal Code", + description: "The lead's postal code.", + optional: true, + }, + Rating: { + type: "string", + label: "Rating", + description: "Rating of the lead.", + optional: true, + options: [ + "Hot", + "Warm", + "Cold", + ], + }, + RecordTypeId: { + ...commonProps.RecordTypeId, + optional: true, + }, + State: { + type: "string", + label: "State/Province", + description: "State for the address of the lead.", + optional: true, + }, + Status: { + type: "string", + label: "Status", + description: "Status code for this converted lead.", + optional: true, + options: [ + "Open - Not Contacted", + "Working - Contacted", + "Closed - Converted", + "Closed - Not Converted", + ], + }, + Street: { + type: "string", + label: "Street", + description: "Street number and name for the address of the lead.", + optional: true, + }, + Suffix: { + type: "string", + label: "Suffix", + description: "The lead's name suffix up to 40 characters.", + optional: true, + }, + Title: { + type: "string", + label: "Title", + description: + "Title for the lead, such as CFO or CEO. The maximum size is 128 characters. ", + optional: true, + }, + Website: { + type: "string", + label: "Website", + description: "Website for the lead.", + optional: true, + }, }, }; From 0a8d1a3b9b3702ea0ad6c6cec2886739b87a4aed Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Tue, 16 Jul 2024 16:19:21 -0300 Subject: [PATCH 044/106] Note and Opportunity props --- .../salesforce_rest_api/common/props.mjs | 26 +++ .../common/sobjects/note.mjs | 46 +++-- .../common/sobjects/opportunity.mjs | 173 +++++++++++++++--- 3 files changed, 209 insertions(+), 36 deletions(-) diff --git a/components/salesforce_rest_api/common/props.mjs b/components/salesforce_rest_api/common/props.mjs index 595ee258044bc..81c2e09064ef8 100644 --- a/components/salesforce_rest_api/common/props.mjs +++ b/components/salesforce_rest_api/common/props.mjs @@ -71,6 +71,20 @@ export default { })); }, }, + ContractId: { + type: "string", + label: "Contract ID", + description: "The ID of a Contract.", + async options() { + const items = await this.salesforce.listSObjectTypeIds("Contract"); + return items?.map((item) => ({ + label: item.ContractNumber + (item.Description + ? ` - ${item.Description}` + : ""), + value: item.Id, + })); + }, + }, ContactOrLeadIds: { type: "string[]", label: "Contact or Lead IDs", @@ -135,6 +149,18 @@ export default { })); }, }, + Pricebook2Id: { + type: "string", + label: "Pricebook2 ID", + description: "The ID of a Pricebook2 object.", + async options() { + const items = await this.salesforce.listSObjectTypeIds("Pricebook2"); + return items?.map((item) => ({ + label: item.Name, + value: item.Id, + })); + }, + }, UserId: { type: "string", label: "User ID", diff --git a/components/salesforce_rest_api/common/sobjects/note.mjs b/components/salesforce_rest_api/common/sobjects/note.mjs index 3a19c81aec589..23f5869e822e4 100644 --- a/components/salesforce_rest_api/common/sobjects/note.mjs +++ b/components/salesforce_rest_api/common/sobjects/note.mjs @@ -1,17 +1,35 @@ +import commonProps from "../props.mjs"; + export default { - Body: { - type: "string", - label: "Body", - description: "Body of the note. Limited to 32 KB.", - }, - IsPrivate: { - type: "boolean", - label: "Is Private", - description: "If true, only the note owner or a user with the “Modify All Data” permission can view the note or query it via the API. Note that if a user who does not have the “Modify All Data” permission sets this field to true on a note that they do not own, then they can no longer query, delete, or update the note.", - }, - OwnerId: { - type: "string", - label: "Owner ID", - description: "ID of the user who owns the note.", + initialProps: { + Body: { + type: "string", + label: "Body", + description: "Body of the note. Limited to 32 KB.", + }, + IsPrivate: { + type: "boolean", + label: "Private", + description: "If true, only the note owner or a user with the “Modify All Data” permission can view the note or query it via the API.", + optional: true, + }, + OwnerId: { + ...commonProps.UserId, + label: "Owner ID", + description: "ID of the user who owns the note.", + optional: true, + }, + ParentId: { + type: "string", + label: "Parent ID", + description: "ID of the object associated with the note. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_note.htm) for which objects can be referenced.", + optional: true, + }, + Title: { + type: "string", + label: "Title", + description: "Title of the note.", + optional: true, + }, }, }; diff --git a/components/salesforce_rest_api/common/sobjects/opportunity.mjs b/components/salesforce_rest_api/common/sobjects/opportunity.mjs index bdf96c354cfd7..21ebe9e006dba 100644 --- a/components/salesforce_rest_api/common/sobjects/opportunity.mjs +++ b/components/salesforce_rest_api/common/sobjects/opportunity.mjs @@ -1,27 +1,156 @@ +import commonProps from "../props.mjs"; + export default { - AccountId: { - type: "string", - label: "Account ID", - description: "ID of the account associated with this opportunity.", + createProps: { + ContactId: { + ...commonProps.ContactId, + description: + "ID of the contact associated with this opportunity, set as the primary contact.", + optional: true, + }, }, - Amount: { - type: "string", - label: "Amount", - description: "Estimated total sale amount. For opportunities with products, the amount is the sum of the related products. Any attempt to update this field, if the record has products, will be ignored. The update call will not be rejected, and other fields will be updated as specified, but the Amount will be unchanged.", + updateProps: {}, + initialProps: { + CloseDate: { + type: "string", + label: "Close Date", + description: "Date when the opportunity is expected to close.", + }, + Description: { + type: "string", + label: "Description", + description: + "Text description of the opportunity. Limit: 32,000 characters.", + optional: true, + }, + Name: { + type: "string", + label: "Name", + description: "A name for this opportunity. Limit: 120 characters", + }, + StageName: { + type: "string", + label: "Stage Name", + description: + "Current stage of this record. This controls several other fields on an opportunity.", + options: [ + "Prospecting", + "Qualification", + "Needs Analysis", + "Value Proposition", + "Id. Decision Makers", + "Perception Analysis", + "Proposal/Price Quote", + "Negotiation/Review", + "Closed Won", + "Closed Lost", + ], + }, }, - CampaignId: { - type: "string", - label: "Campaign ID", - description: "ID of a related Campaign. This field is defined only for those organizations that have the campaign feature Campaigns enabled. The User must have read access rights to the cross-referenced Campaign object in order to create or update that campaign into this field on the opportunity.", - }, - ContactId: { - type: "string", - label: "Contact ID", - description: "ID of the contact associated with this opportunity, set as the primary contact. Read-only field that is derived from the opportunity contact role, which is created at the same time the opportunity is created. This field can only be populated when it's created, and can't be updated. To update the value in this field, change the IsPrimary flag on the OpportunityContactRole associated with this opportunity. Available in API version 46.0 and later.", - }, - ContractId: { - type: "string", - label: "Contract ID", - description: "ID of the contract that's associated with this opportunity.", + extraProps: { + AccountId: { + ...commonProps.AccountId, + description: "ID of the account associated with this opportunity.", + optional: true, + }, + Amount: { + type: "string", + label: "Amount", + description: + "Estimated total sale amount. For opportunities with products, the amount is the sum of the related products.", + optional: true, + }, + CampaignId: { + ...commonProps.CampaignId, + description: "ID of a related Campaign.", + optional: true, + }, + ContractId: { + ...commonProps.ContractId, + description: + "ID of the contract that's associated with this opportunity.", + optional: true, + }, + ForecastCategoryName: { + type: "string", + label: "Forecast Category Name", + description: "The name of the forecast category.", + optional: true, + options: [ + "Omitted", + "Pipeline", + "Best Case", + "Commit", + "Closed", + ], + }, + IsExcludedFromTerritory2Filter: { + type: "boolean", + label: "Excluded from Filter", + description: + "Used for Filter-Based Opportunity Territory Assignment. Indicates whether the opportunity is excluded (`true`) or included (`false`) each time the APEX filter is executed.", + optional: true, + }, + LeadSource: { + type: "string", + label: "Lead Source", + description: + "Source of this opportunity, such as Advertisement or Trade Show.", + optional: true, + options: [ + "Web", + "Phone Inquiry", + "Partner Referral", + "Purchased List", + "Other", + ], + }, + NextStep: { + type: "string", + label: "Next Step", + description: + "Description of next task in closing opportunity. Limit: 255 characters.", + optional: true, + }, + OwnerId: { + ...commonProps.UserId, + description: + "ID of the User who has been assigned to work this opportunity.", + optional: true, + }, + Pricebook2Id: { + ...commonProps.Pricebook2Id, + description: "ID of a related Pricebook2 object.", + optional: true, + }, + Probability: { + type: "string", + label: "Probability (%)", + description: + "Percentage of estimated confidence in closing the opportunity.", + optional: true, + }, + RecordTypeId: { + ...commonProps.RecordTypeId, + optional: true, + }, + TotalOpportunityQuantity: { + type: "integer", + label: "Quantity", + description: "Number of items included in this opportunity.", + optional: true, + }, + Type: { + type: "string", + label: "Opportunity Type", + description: "Type of opportunity.", + optional: true, + options: [ + "Existing Customer - Upgrade", + "Existing Customer - Replacement", + "Existing Customer - Downgrade", + "New Customer", + ], + }, }, }; From ab79d550cd0c425d09dfc24b06b921bb51e2f058 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Tue, 16 Jul 2024 18:10:46 -0300 Subject: [PATCH 045/106] Task props + reusing and organization --- .../common/constants-props.mjs | 496 +++++++++++++++++ .../{props.mjs => props-async-options.mjs} | 0 .../common/sobjects/event.mjs | 509 +----------------- .../common/sobjects/task.mjs | 259 ++++++++- 4 files changed, 745 insertions(+), 519 deletions(-) create mode 100644 components/salesforce_rest_api/common/constants-props.mjs rename components/salesforce_rest_api/common/{props.mjs => props-async-options.mjs} (100%) diff --git a/components/salesforce_rest_api/common/constants-props.mjs b/components/salesforce_rest_api/common/constants-props.mjs new file mode 100644 index 0000000000000..ea6cd561e1061 --- /dev/null +++ b/components/salesforce_rest_api/common/constants-props.mjs @@ -0,0 +1,496 @@ +export const WEEKDAY_MASK_OPTIONS = [ + { + label: "Sunday", + value: 1, + }, + { + label: "Monday", + value: 2, + }, + { + label: "Tuesday", + value: 4, + }, + { + label: "Wednesday", + value: 8, + }, + { + label: "Thursday", + value: 16, + }, + { + label: "Friday", + value: 32, + }, + { + label: "Saturday", + value: 64, + }, +]; + +export const RECURRENCE_INSTANCE_OPTIONS = [ + { + label: "1st", + value: "First", + }, + { + label: "2nd", + value: "Second", + }, + { + label: "3rd", + value: "Third", + }, + { + label: "4th", + value: "Fourth", + }, + { + label: "last", + value: "Last", + }, +]; + +export const RECURRENCE_MONTH_OPTIONS = [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December", +]; + +export const RECURRENCE_TIMEZONE_OPTIONS = [ + { + label: "(GMT+14:00) Line Islands Time (Pacific/Kiritimati)", + value: "Pacific/Kiritimati", + }, + { + label: "(GMT+13:00) Phoenix Islands Time (Pacific/Enderbury)", + value: "Pacific/Enderbury", + }, + { + label: "(GMT+13:00) Tonga Standard Time (Pacific/Tongatapu)", + value: "Pacific/Tongatapu", + }, + { + label: "(GMT+12:45) Chatham Standard Time (Pacific/Chatham)", + value: "Pacific/Chatham", + }, + { + label: + "(GMT+12:00) Petropavlovsk-Kamchatski Standard Time (Asia/Kamchatka)", + value: "Asia/Kamchatka", + }, + { + label: "(GMT+12:00) New Zealand Standard Time (Pacific/Auckland)", + value: "Pacific/Auckland", + }, + { + label: "(GMT+12:00) Fiji Standard Time (Pacific/Fiji)", + value: "Pacific/Fiji", + }, + { + label: "(GMT+11:00) Solomon Islands Time (Pacific/Guadalcanal)", + value: "Pacific/Guadalcanal", + }, + { + label: "(GMT+11:00) Norfolk Island Standard Time (Pacific/Norfolk)", + value: "Pacific/Norfolk", + }, + { + label: "(GMT+10:30) Lord Howe Standard Time (Australia/Lord_Howe)", + value: "Australia/Lord_Howe", + }, + { + label: "(GMT+10:00) Australian Eastern Standard Time (Australia/Brisbane)", + value: "Australia/Brisbane", + }, + { + label: "(GMT+10:00) Australian Eastern Standard Time (Australia/Sydney)", + value: "Australia/Sydney", + }, + { + label: "(GMT+09:30) Australian Central Standard Time (Australia/Adelaide)", + value: "Australia/Adelaide", + }, + { + label: "(GMT+09:30) Australian Central Standard Time (Australia/Darwin)", + value: "Australia/Darwin", + }, + { + label: "(GMT+09:00) Korean Standard Time (Asia/Seoul)", + value: "Asia/Seoul", + }, + { + label: "(GMT+09:00) Japan Standard Time (Asia/Tokyo)", + value: "Asia/Tokyo", + }, + { + label: "(GMT+08:00) Hong Kong Standard Time (Asia/Hong_Kong)", + value: "Asia/Hong_Kong", + }, + { + label: "(GMT+08:00) Malaysia Time (Asia/Kuala_Lumpur)", + value: "Asia/Kuala_Lumpur", + }, + { + label: "(GMT+08:00) Philippine Standard Time (Asia/Manila)", + value: "Asia/Manila", + }, + { + label: "(GMT+08:00) China Standard Time (Asia/Shanghai)", + value: "Asia/Shanghai", + }, + { + label: "(GMT+08:00) Singapore Standard Time (Asia/Singapore)", + value: "Asia/Singapore", + }, + { + label: "(GMT+08:00) Taipei Standard Time (Asia/Taipei)", + value: "Asia/Taipei", + }, + { + label: "(GMT+08:00) Australian Western Standard Time (Australia/Perth)", + value: "Australia/Perth", + }, + { + label: "(GMT+07:00) Indochina Time (Asia/Bangkok)", + value: "Asia/Bangkok", + }, + { + label: "(GMT+07:00) Indochina Time (Asia/Ho_Chi_Minh)", + value: "Asia/Ho_Chi_Minh", + }, + { + label: "(GMT+07:00) Western Indonesia Time (Asia/Jakarta)", + value: "Asia/Jakarta", + }, + { + label: "(GMT+06:30) Myanmar Time (Asia/Rangoon)", + value: "Asia/Rangoon", + }, + { + label: "(GMT+06:00) Bangladesh Standard Time (Asia/Dhaka)", + value: "Asia/Dhaka", + }, + { + label: "(GMT+05:45) Nepal Time (Asia/Kathmandu)", + value: "Asia/Kathmandu", + }, + { + label: "(GMT+05:30) India Standard Time (Asia/Colombo)", + value: "Asia/Colombo", + }, + { + label: "(GMT+05:30) India Standard Time (Asia/Kolkata)", + value: "Asia/Kolkata", + }, + { + label: "(GMT+05:00) Pakistan Standard Time (Asia/Karachi)", + value: "Asia/Karachi", + }, + { + label: "(GMT+05:00) Uzbekistan Standard Time (Asia/Tashkent)", + value: "Asia/Tashkent", + }, + { + label: "(GMT+05:00) Yekaterinburg Standard Time (Asia/Yekaterinburg)", + value: "Asia/Yekaterinburg", + }, + { + label: "(GMT+04:30) Afghanistan Time (Asia/Kabul)", + value: "Asia/Kabul", + }, + { + label: "(GMT+04:00) Azerbaijan Standard Time (Asia/Baku)", + value: "Asia/Baku", + }, + { + label: "(GMT+04:00) Gulf Standard Time (Asia/Dubai)", + value: "Asia/Dubai", + }, + { + label: "(GMT+04:00) Georgia Standard Time (Asia/Tbilisi)", + value: "Asia/Tbilisi", + }, + { + label: "(GMT+04:00) Armenia Standard Time (Asia/Yerevan)", + value: "Asia/Yerevan", + }, + { + label: "(GMT+03:00) Eastern European Standard Time (Africa/Cairo)", + value: "Africa/Cairo", + }, + { + label: "(GMT+03:00) East Africa Time (Africa/Nairobi)", + value: "Africa/Nairobi", + }, + { + label: "(GMT+03:00) Arabian Standard Time (Asia/Baghdad)", + value: "Asia/Baghdad", + }, + { + label: "(GMT+03:00) Eastern European Summer Time (Asia/Beirut)", + value: "Asia/Beirut", + }, + { + label: "(GMT+03:00) Israel Daylight Time (Asia/Jerusalem)", + value: "Asia/Jerusalem", + }, + { + label: "(GMT+03:00) Arabian Standard Time (Asia/Kuwait)", + value: "Asia/Kuwait", + }, + { + label: "(GMT+03:00) Arabian Standard Time (Asia/Riyadh)", + value: "Asia/Riyadh", + }, + { + label: "(GMT+03:00) Eastern European Summer Time (Europe/Athens)", + value: "Europe/Athens", + }, + { + label: "(GMT+03:00) Eastern European Summer Time (Europe/Bucharest)", + value: "Europe/Bucharest", + }, + { + label: "(GMT+03:00) Eastern European Summer Time (Europe/Helsinki)", + value: "Europe/Helsinki", + }, + { + label: "(GMT+03:00) Eastern European Standard Time (Europe/Istanbul)", + value: "Europe/Istanbul", + }, + { + label: "(GMT+03:00) Moscow Standard Time (Europe/Minsk)", + value: "Europe/Minsk", + }, + { + label: "(GMT+03:00) Moscow Standard Time (Europe/Moscow)", + value: "Europe/Moscow", + }, + { + label: "(GMT+02:00) South Africa Standard Time (Africa/Johannesburg)", + value: "Africa/Johannesburg", + }, + { + label: "(GMT+02:00) Central European Summer Time (Europe/Amsterdam)", + value: "Europe/Amsterdam", + }, + { + label: "(GMT+02:00) Central European Summer Time (Europe/Berlin)", + value: "Europe/Berlin", + }, + { + label: "(GMT+02:00) Central European Summer Time (Europe/Brussels)", + value: "Europe/Brussels", + }, + { + label: "(GMT+02:00) Central European Summer Time (Europe/Paris)", + value: "Europe/Paris", + }, + { + label: "(GMT+02:00) Central European Summer Time (Europe/Prague)", + value: "Europe/Prague", + }, + { + label: "(GMT+02:00) Central European Summer Time (Europe/Rome)", + value: "Europe/Rome", + }, + { + label: "(GMT+01:00) Central European Standard Time (Africa/Algiers)", + value: "Africa/Algiers", + }, + { + label: "(GMT+01:00) Western European Summer Time (Africa/Casablanca)", + value: "Africa/Casablanca", + }, + { + label: "(GMT+01:00) Irish Standard Time (Europe/Dublin)", + value: "Europe/Dublin", + }, + { + label: "(GMT+01:00) Western European Summer Time (Europe/Lisbon)", + value: "Europe/Lisbon", + }, + { + label: "(GMT+01:00) British Summer Time (Europe/London)", + value: "Europe/London", + }, + { + label: "(GMT+00:00) Azores Summer Time (Atlantic/Azores)", + value: "Atlantic/Azores", + }, + { + label: "(GMT+00:00) Greenwich Mean Time (GMT)", + value: "GMT", + }, + { + label: "(GMT-01:00) East Greenland Summer Time (America/Scoresbysund)", + value: "America/Scoresbysund", + }, + { + label: "(GMT-01:00) Cape Verde Standard Time (Atlantic/Cape_Verde)", + value: "Atlantic/Cape_Verde", + }, + { + label: "(GMT-02:00) South Georgia Time (Atlantic/South_Georgia)", + value: "Atlantic/South_Georgia", + }, + { + label: "(GMT-02:30) Newfoundland Daylight Time (America/St_Johns)", + value: "America/St_Johns", + }, + { + label: + "(GMT-03:00) Argentina Standard Time (America/Argentina/Buenos_Aires)", + value: "America/Argentina/Buenos_Aires", + }, + { + label: "(GMT-03:00) Atlantic Daylight Time (America/Halifax)", + value: "America/Halifax", + }, + { + label: "(GMT-03:00) Brasilia Standard Time (America/Sao_Paulo)", + value: "America/Sao_Paulo", + }, + { + label: "(GMT-03:00) Atlantic Daylight Time (Atlantic/Bermuda)", + value: "Atlantic/Bermuda", + }, + { + label: "(GMT-04:00) Venezuela Time (America/Caracas)", + value: "America/Caracas", + }, + { + label: "(GMT-04:00) Eastern Daylight Time (America/Indiana/Indianapolis)", + value: "America/Indiana/Indianapolis", + }, + { + label: "(GMT-04:00) Eastern Daylight Time (America/New_York)", + value: "America/New_York", + }, + { + label: "(GMT-04:00) Atlantic Standard Time (America/Puerto_Rico)", + value: "America/Puerto_Rico", + }, + { + label: "(GMT-04:00) Chile Standard Time (America/Santiago)", + value: "America/Santiago", + }, + { + label: "(GMT-05:00) Colombia Standard Time (America/Bogota)", + value: "America/Bogota", + }, + { + label: "(GMT-05:00) Central Daylight Time (America/Chicago)", + value: "America/Chicago", + }, + { + label: "(GMT-05:00) Peru Standard Time (America/Lima)", + value: "America/Lima", + }, + { + label: "(GMT-05:00) Eastern Standard Time (America/Panama)", + value: "America/Panama", + }, + { + label: "(GMT-06:00) Mountain Daylight Time (America/Denver)", + value: "America/Denver", + }, + { + label: "(GMT-06:00) Central Standard Time (America/El_Salvador)", + value: "America/El_Salvador", + }, + { + label: "(GMT-06:00) Central Standard Time (America/Mexico_City)", + value: "America/Mexico_City", + }, + { + label: "(GMT-07:00) Pacific Daylight Time (America/Los_Angeles)", + value: "America/Los_Angeles", + }, + { + label: "(GMT-07:00) Mexican Pacific Standard Time (America/Mazatlan)", + value: "America/Mazatlan", + }, + { + label: "(GMT-07:00) Mountain Standard Time (America/Phoenix)", + value: "America/Phoenix", + }, + { + label: "(GMT-07:00) Pacific Daylight Time (America/Tijuana)", + value: "America/Tijuana", + }, + { + label: "(GMT-08:00) Alaska Daylight Time (America/Anchorage)", + value: "America/Anchorage", + }, + { + label: "(GMT-08:00) Pitcairn Time (Pacific/Pitcairn)", + value: "Pacific/Pitcairn", + }, + { + label: "(GMT-09:00) Hawaii-Aleutian Daylight Time (America/Adak)", + value: "America/Adak", + }, + { + label: "(GMT-09:00) Gambier Time (Pacific/Gambier)", + value: "Pacific/Gambier", + }, + { + label: "(GMT-09:30) Marquesas Time (Pacific/Marquesas)", + value: "Pacific/Marquesas", + }, + { + label: "(GMT-10:00) Hawaii-Aleutian Standard Time (Pacific/Honolulu)", + value: "Pacific/Honolulu", + }, + { + label: "(GMT-11:00) Niue Time (Pacific/Niue)", + value: "Pacific/Niue", + }, + { + label: "(GMT-11:00) Samoa Standard Time (Pacific/Pago_Pago)", + value: "Pacific/Pago_Pago", + }, +]; + +export const RECURRENCE_TYPE_OPTIONS = [ + { + label: "Recurs Daily", + value: "RecursDaily", + }, + { + label: "Recurs Every Weekday", + value: "RecursEveryWeekday", + }, + { + label: "Recurs Monthly", + value: "RecursMonthly", + }, + { + label: "Recurs Monthly Nth", + value: "RecursMonthlyNth", + }, + { + label: "Recurs Weekly", + value: "RecursWeekly", + }, + { + label: "Recurs Yearly", + value: "RecursYearly", + }, + { + label: "Recurs Yearly Nth", + value: "RecursYearlyNth", + }, +]; diff --git a/components/salesforce_rest_api/common/props.mjs b/components/salesforce_rest_api/common/props-async-options.mjs similarity index 100% rename from components/salesforce_rest_api/common/props.mjs rename to components/salesforce_rest_api/common/props-async-options.mjs diff --git a/components/salesforce_rest_api/common/sobjects/event.mjs b/components/salesforce_rest_api/common/sobjects/event.mjs index 60bd124b7a622..db9f09b611162 100644 --- a/components/salesforce_rest_api/common/sobjects/event.mjs +++ b/components/salesforce_rest_api/common/sobjects/event.mjs @@ -1,4 +1,7 @@ -import commonProps from "../props.mjs"; +import { // eslint-disable-next-line max-len + RECURRENCE_INSTANCE_OPTIONS, RECURRENCE_MONTH_OPTIONS, RECURRENCE_TIMEZONE_OPTIONS, RECURRENCE_TYPE_OPTIONS, WEEKDAY_MASK_OPTIONS, +} from "../constants-props.mjs"; +import commonProps from "../props-async-options.mjs"; export default { initialProps: { @@ -96,36 +99,7 @@ export default { label: "Recurrence Day of Week", description: "The day(s) of the week on which the event repeats.", optional: true, - options: [ - { - label: "Sunday", - value: 1, - }, - { - label: "Monday", - value: 2, - }, - { - label: "Tuesday", - value: 4, - }, - { - label: "Wednesday", - value: 8, - }, - { - label: "Thursday", - value: 16, - }, - { - label: "Friday", - value: 32, - }, - { - label: "Saturday", - value: 64, - }, - ], + options: WEEKDAY_MASK_OPTIONS, }, RecurrenceEndDateOnly: { type: "string", @@ -139,28 +113,7 @@ export default { description: "Indicates the frequency of the Salesforce Classic event's recurrence.", optional: true, - options: [ - { - label: "1st", - value: "First", - }, - { - label: "2nd", - value: "Second", - }, - { - label: "3rd", - value: "Third", - }, - { - label: "4th", - value: "Fourth", - }, - { - label: "last", - value: "Last", - }, - ], + options: RECURRENCE_INSTANCE_OPTIONS, }, RecurrenceInterval: { type: "integer", @@ -175,20 +128,7 @@ export default { description: "Indicates the month in which the Salesforce Classic recurring event repeats.", optional: true, - options: [ - "January", - "February", - "March", - "April", - "May", - "June", - "July", - "August", - "September", - "October", - "November", - "December", - ], + options: RECURRENCE_MONTH_OPTIONS, }, RecurrenceStartDateTime: { type: "string", @@ -203,445 +143,14 @@ export default { description: "Indicates the time zone associated with a Salesforce Classic recurring event.", optional: true, - options: [ - { - label: "(GMT+14:00) Line Islands Time (Pacific/Kiritimati)", - value: "Pacific/Kiritimati", - }, - { - label: "(GMT+13:00) Phoenix Islands Time (Pacific/Enderbury)", - value: "Pacific/Enderbury", - }, - { - label: "(GMT+13:00) Tonga Standard Time (Pacific/Tongatapu)", - value: "Pacific/Tongatapu", - }, - { - label: "(GMT+12:45) Chatham Standard Time (Pacific/Chatham)", - value: "Pacific/Chatham", - }, - { - label: - "(GMT+12:00) Petropavlovsk-Kamchatski Standard Time (Asia/Kamchatka)", - value: "Asia/Kamchatka", - }, - { - label: "(GMT+12:00) New Zealand Standard Time (Pacific/Auckland)", - value: "Pacific/Auckland", - }, - { - label: "(GMT+12:00) Fiji Standard Time (Pacific/Fiji)", - value: "Pacific/Fiji", - }, - { - label: "(GMT+11:00) Solomon Islands Time (Pacific/Guadalcanal)", - value: "Pacific/Guadalcanal", - }, - { - label: "(GMT+11:00) Norfolk Island Standard Time (Pacific/Norfolk)", - value: "Pacific/Norfolk", - }, - { - label: "(GMT+10:30) Lord Howe Standard Time (Australia/Lord_Howe)", - value: "Australia/Lord_Howe", - }, - { - label: - "(GMT+10:00) Australian Eastern Standard Time (Australia/Brisbane)", - value: "Australia/Brisbane", - }, - { - label: - "(GMT+10:00) Australian Eastern Standard Time (Australia/Sydney)", - value: "Australia/Sydney", - }, - { - label: - "(GMT+09:30) Australian Central Standard Time (Australia/Adelaide)", - value: "Australia/Adelaide", - }, - { - label: - "(GMT+09:30) Australian Central Standard Time (Australia/Darwin)", - value: "Australia/Darwin", - }, - { - label: "(GMT+09:00) Korean Standard Time (Asia/Seoul)", - value: "Asia/Seoul", - }, - { - label: "(GMT+09:00) Japan Standard Time (Asia/Tokyo)", - value: "Asia/Tokyo", - }, - { - label: "(GMT+08:00) Hong Kong Standard Time (Asia/Hong_Kong)", - value: "Asia/Hong_Kong", - }, - { - label: "(GMT+08:00) Malaysia Time (Asia/Kuala_Lumpur)", - value: "Asia/Kuala_Lumpur", - }, - { - label: "(GMT+08:00) Philippine Standard Time (Asia/Manila)", - value: "Asia/Manila", - }, - { - label: "(GMT+08:00) China Standard Time (Asia/Shanghai)", - value: "Asia/Shanghai", - }, - { - label: "(GMT+08:00) Singapore Standard Time (Asia/Singapore)", - value: "Asia/Singapore", - }, - { - label: "(GMT+08:00) Taipei Standard Time (Asia/Taipei)", - value: "Asia/Taipei", - }, - { - label: - "(GMT+08:00) Australian Western Standard Time (Australia/Perth)", - value: "Australia/Perth", - }, - { - label: "(GMT+07:00) Indochina Time (Asia/Bangkok)", - value: "Asia/Bangkok", - }, - { - label: "(GMT+07:00) Indochina Time (Asia/Ho_Chi_Minh)", - value: "Asia/Ho_Chi_Minh", - }, - { - label: "(GMT+07:00) Western Indonesia Time (Asia/Jakarta)", - value: "Asia/Jakarta", - }, - { - label: "(GMT+06:30) Myanmar Time (Asia/Rangoon)", - value: "Asia/Rangoon", - }, - { - label: "(GMT+06:00) Bangladesh Standard Time (Asia/Dhaka)", - value: "Asia/Dhaka", - }, - { - label: "(GMT+05:45) Nepal Time (Asia/Kathmandu)", - value: "Asia/Kathmandu", - }, - { - label: "(GMT+05:30) India Standard Time (Asia/Colombo)", - value: "Asia/Colombo", - }, - { - label: "(GMT+05:30) India Standard Time (Asia/Kolkata)", - value: "Asia/Kolkata", - }, - { - label: "(GMT+05:00) Pakistan Standard Time (Asia/Karachi)", - value: "Asia/Karachi", - }, - { - label: "(GMT+05:00) Uzbekistan Standard Time (Asia/Tashkent)", - value: "Asia/Tashkent", - }, - { - label: "(GMT+05:00) Yekaterinburg Standard Time (Asia/Yekaterinburg)", - value: "Asia/Yekaterinburg", - }, - { - label: "(GMT+04:30) Afghanistan Time (Asia/Kabul)", - value: "Asia/Kabul", - }, - { - label: "(GMT+04:00) Azerbaijan Standard Time (Asia/Baku)", - value: "Asia/Baku", - }, - { - label: "(GMT+04:00) Gulf Standard Time (Asia/Dubai)", - value: "Asia/Dubai", - }, - { - label: "(GMT+04:00) Georgia Standard Time (Asia/Tbilisi)", - value: "Asia/Tbilisi", - }, - { - label: "(GMT+04:00) Armenia Standard Time (Asia/Yerevan)", - value: "Asia/Yerevan", - }, - { - label: "(GMT+03:00) Eastern European Standard Time (Africa/Cairo)", - value: "Africa/Cairo", - }, - { - label: "(GMT+03:00) East Africa Time (Africa/Nairobi)", - value: "Africa/Nairobi", - }, - { - label: "(GMT+03:00) Arabian Standard Time (Asia/Baghdad)", - value: "Asia/Baghdad", - }, - { - label: "(GMT+03:00) Eastern European Summer Time (Asia/Beirut)", - value: "Asia/Beirut", - }, - { - label: "(GMT+03:00) Israel Daylight Time (Asia/Jerusalem)", - value: "Asia/Jerusalem", - }, - { - label: "(GMT+03:00) Arabian Standard Time (Asia/Kuwait)", - value: "Asia/Kuwait", - }, - { - label: "(GMT+03:00) Arabian Standard Time (Asia/Riyadh)", - value: "Asia/Riyadh", - }, - { - label: "(GMT+03:00) Eastern European Summer Time (Europe/Athens)", - value: "Europe/Athens", - }, - { - label: "(GMT+03:00) Eastern European Summer Time (Europe/Bucharest)", - value: "Europe/Bucharest", - }, - { - label: "(GMT+03:00) Eastern European Summer Time (Europe/Helsinki)", - value: "Europe/Helsinki", - }, - { - label: "(GMT+03:00) Eastern European Standard Time (Europe/Istanbul)", - value: "Europe/Istanbul", - }, - { - label: "(GMT+03:00) Moscow Standard Time (Europe/Minsk)", - value: "Europe/Minsk", - }, - { - label: "(GMT+03:00) Moscow Standard Time (Europe/Moscow)", - value: "Europe/Moscow", - }, - { - label: "(GMT+02:00) South Africa Standard Time (Africa/Johannesburg)", - value: "Africa/Johannesburg", - }, - { - label: "(GMT+02:00) Central European Summer Time (Europe/Amsterdam)", - value: "Europe/Amsterdam", - }, - { - label: "(GMT+02:00) Central European Summer Time (Europe/Berlin)", - value: "Europe/Berlin", - }, - { - label: "(GMT+02:00) Central European Summer Time (Europe/Brussels)", - value: "Europe/Brussels", - }, - { - label: "(GMT+02:00) Central European Summer Time (Europe/Paris)", - value: "Europe/Paris", - }, - { - label: "(GMT+02:00) Central European Summer Time (Europe/Prague)", - value: "Europe/Prague", - }, - { - label: "(GMT+02:00) Central European Summer Time (Europe/Rome)", - value: "Europe/Rome", - }, - { - label: "(GMT+01:00) Central European Standard Time (Africa/Algiers)", - value: "Africa/Algiers", - }, - { - label: "(GMT+01:00) Western European Summer Time (Africa/Casablanca)", - value: "Africa/Casablanca", - }, - { - label: "(GMT+01:00) Irish Standard Time (Europe/Dublin)", - value: "Europe/Dublin", - }, - { - label: "(GMT+01:00) Western European Summer Time (Europe/Lisbon)", - value: "Europe/Lisbon", - }, - { - label: "(GMT+01:00) British Summer Time (Europe/London)", - value: "Europe/London", - }, - { - label: "(GMT+00:00) Azores Summer Time (Atlantic/Azores)", - value: "Atlantic/Azores", - }, - { - label: "(GMT+00:00) Greenwich Mean Time (GMT)", - value: "GMT", - }, - { - label: - "(GMT-01:00) East Greenland Summer Time (America/Scoresbysund)", - value: "America/Scoresbysund", - }, - { - label: "(GMT-01:00) Cape Verde Standard Time (Atlantic/Cape_Verde)", - value: "Atlantic/Cape_Verde", - }, - { - label: "(GMT-02:00) South Georgia Time (Atlantic/South_Georgia)", - value: "Atlantic/South_Georgia", - }, - { - label: "(GMT-02:30) Newfoundland Daylight Time (America/St_Johns)", - value: "America/St_Johns", - }, - { - label: - "(GMT-03:00) Argentina Standard Time (America/Argentina/Buenos_Aires)", - value: "America/Argentina/Buenos_Aires", - }, - { - label: "(GMT-03:00) Atlantic Daylight Time (America/Halifax)", - value: "America/Halifax", - }, - { - label: "(GMT-03:00) Brasilia Standard Time (America/Sao_Paulo)", - value: "America/Sao_Paulo", - }, - { - label: "(GMT-03:00) Atlantic Daylight Time (Atlantic/Bermuda)", - value: "Atlantic/Bermuda", - }, - { - label: "(GMT-04:00) Venezuela Time (America/Caracas)", - value: "America/Caracas", - }, - { - label: - "(GMT-04:00) Eastern Daylight Time (America/Indiana/Indianapolis)", - value: "America/Indiana/Indianapolis", - }, - { - label: "(GMT-04:00) Eastern Daylight Time (America/New_York)", - value: "America/New_York", - }, - { - label: "(GMT-04:00) Atlantic Standard Time (America/Puerto_Rico)", - value: "America/Puerto_Rico", - }, - { - label: "(GMT-04:00) Chile Standard Time (America/Santiago)", - value: "America/Santiago", - }, - { - label: "(GMT-05:00) Colombia Standard Time (America/Bogota)", - value: "America/Bogota", - }, - { - label: "(GMT-05:00) Central Daylight Time (America/Chicago)", - value: "America/Chicago", - }, - { - label: "(GMT-05:00) Peru Standard Time (America/Lima)", - value: "America/Lima", - }, - { - label: "(GMT-05:00) Eastern Standard Time (America/Panama)", - value: "America/Panama", - }, - { - label: "(GMT-06:00) Mountain Daylight Time (America/Denver)", - value: "America/Denver", - }, - { - label: "(GMT-06:00) Central Standard Time (America/El_Salvador)", - value: "America/El_Salvador", - }, - { - label: "(GMT-06:00) Central Standard Time (America/Mexico_City)", - value: "America/Mexico_City", - }, - { - label: "(GMT-07:00) Pacific Daylight Time (America/Los_Angeles)", - value: "America/Los_Angeles", - }, - { - label: "(GMT-07:00) Mexican Pacific Standard Time (America/Mazatlan)", - value: "America/Mazatlan", - }, - { - label: "(GMT-07:00) Mountain Standard Time (America/Phoenix)", - value: "America/Phoenix", - }, - { - label: "(GMT-07:00) Pacific Daylight Time (America/Tijuana)", - value: "America/Tijuana", - }, - { - label: "(GMT-08:00) Alaska Daylight Time (America/Anchorage)", - value: "America/Anchorage", - }, - { - label: "(GMT-08:00) Pitcairn Time (Pacific/Pitcairn)", - value: "Pacific/Pitcairn", - }, - { - label: "(GMT-09:00) Hawaii-Aleutian Daylight Time (America/Adak)", - value: "America/Adak", - }, - { - label: "(GMT-09:00) Gambier Time (Pacific/Gambier)", - value: "Pacific/Gambier", - }, - { - label: "(GMT-09:30) Marquesas Time (Pacific/Marquesas)", - value: "Pacific/Marquesas", - }, - { - label: "(GMT-10:00) Hawaii-Aleutian Standard Time (Pacific/Honolulu)", - value: "Pacific/Honolulu", - }, - { - label: "(GMT-11:00) Niue Time (Pacific/Niue)", - value: "Pacific/Niue", - }, - { - label: "(GMT-11:00) Samoa Standard Time (Pacific/Pago_Pago)", - value: "Pacific/Pago_Pago", - }, - ], + options: RECURRENCE_TIMEZONE_OPTIONS, }, RecurrenceType: { type: "string", label: "Recurrence Type", description: "Indicates how often the Salesforce Classic event repeats.", optional: true, - options: [ - { - label: "Recurs Daily", - value: "RecursDaily", - }, - { - label: "Recurs Every Weekday", - value: "RecursEveryWeekday", - }, - { - label: "Recurs Monthly", - value: "RecursMonthly", - }, - { - label: "Recurs Monthly Nth", - value: "RecursMonthlyNth", - }, - { - label: "Recurs Weekly", - value: "RecursWeekly", - }, - { - label: "Recurs Yearly", - value: "RecursYearly", - }, - { - label: "Recurs Yearly Nth", - value: "RecursYearlyNth", - }, - ], + options: RECURRENCE_TYPE_OPTIONS, }, ReminderDateTime: { type: "string", diff --git a/components/salesforce_rest_api/common/sobjects/task.mjs b/components/salesforce_rest_api/common/sobjects/task.mjs index 931692972e552..2282d4cf6ab3b 100644 --- a/components/salesforce_rest_api/common/sobjects/task.mjs +++ b/components/salesforce_rest_api/common/sobjects/task.mjs @@ -1,25 +1,246 @@ -import constants from "../constants.mjs"; +import { + RECURRENCE_INSTANCE_OPTIONS, + RECURRENCE_MONTH_OPTIONS, + RECURRENCE_TIMEZONE_OPTIONS, + RECURRENCE_TYPE_OPTIONS, + WEEKDAY_MASK_OPTIONS, +} from "../constants-props.mjs"; +import commonProps from "../props-async-options.mjs"; export default { - ActivityDate: { - type: "string", - label: "Activity date", - description: "Represents the due date of the task. This field has a timestamp that is always set to midnight in the Coordinated Universal Time (UTC) time zone. The timestamp is not relevant; do not attempt to alter it to accommodate time zone differences. Note This field can't be set or updated for a recurring task (IsRecurrence is true).", + createProps: { + IsRecurrence: { + type: "boolean", + label: "Recurring", + description: + "Indicates whether the task is scheduled to repeat itself (`true`) or only occurs once (`false`).", + optional: true, + }, + TaskSubtype: { + type: "string", + label: "Task Subtype", + description: "The subtype of the task.", + optional: true, + options: [ + { + label: "Task", + value: "Task", + }, + { + label: "Email", + value: "Email", + }, + { + label: "List Email", + value: "ListEmail", + }, + { + label: "Cadence", + value: "Cadence", + }, + { + label: "Call", + value: "Call", + }, + { + label: "LinkedIn", + value: "LinkedIn", + }, + ], + }, }, - Description: { - type: "string", - label: "Description", - description: "Contains a text description of the task.", + initialProps: { + ActivityDate: { + type: "string", + label: "Due Date", + description: "Represents the due date of the task.", + optional: true, + }, + Description: { + type: "string", + label: "Description", + description: "A text description of the task.", + optional: true, + }, + Priority: { + type: "string", + label: "Priority", + description: + "Indicates the importance or urgency of a task, such as high or low.", + options: [ + "High", + "Normal", + "Low", + ], + }, }, - Subject: { - type: "string", - label: "Subject", - description: "The subject line of the task, such as “Call” or “Send Quote.” Limit: 255 characters.", - }, - TaskSubtype: { - type: "string", - label: "Task sub-type", - description: "Provides standard subtypes to facilitate creating and searching for specific task subtypes. This field isn't updateable. TaskSubtype values: Task Email List Email Cadence Call Note The Cadence subtype is an internal value used by High Velocity Sales, and can't be set manually.", - options: constants.TASK_SUB_TYPES, + extraProps: { + CallDisposition: { + type: "string", + label: "Call Result", + description: + "Represents the result of a given call, for example, “we'll call back,” or “call unsuccessful.” Limit is 255 characters.", + optional: true, + }, + CallDurationInSeconds: { + type: "integer", + label: "Call Duration", + description: "Duration of the call in seconds.", + optional: true, + }, + CallObject: { + type: "string", + label: "Call Object Identifier", + description: "Name of a call center. Limit is 255 characters.", + optional: true, + }, + CallType: { + type: "string", + label: "Call Type", + description: "The type of call being answered.", + optional: true, + options: [ + "Internal", + "Inbound", + "Outbound", + ], + }, + IsReminderSet: { + type: "boolean", + label: "Reminder Set", + description: + "Indicates whether a popup reminder has been set for the task.", + optional: true, + }, + IsVisibleInSelfService: { + type: "boolean", + label: "Visible in Self-Service", + description: + "Indicates whether a task associated with an object can be viewed in the Customer Portal.", + optional: true, + }, + OwnerId: { + ...commonProps.UserId, + label: "Owner ID", + description: "ID of the User or Group who owns the record.", + optional: true, + }, + RecurrenceDayOfMonth: { + type: "integer", + label: "Recurrence Day of Month", + description: "The day of the month in which the task repeats.", + optional: true, + }, + RecurrenceDayOfWeekMask: { + type: "integer[]", + label: "Recurrence Day of Week Mask", + description: "The day(s) of the week on which the task repeats.", + optional: true, + options: WEEKDAY_MASK_OPTIONS, + }, + RecurrenceEndDateOnly: { + type: "string", + label: "Recurrence End Date", + description: "The last date on which the task repeats.", + optional: true, + }, + RecurrenceInstance: { + type: "string", + label: "Recurrence Instance", + description: "The frequency of the recurring task.", + optional: true, + options: RECURRENCE_INSTANCE_OPTIONS, + }, + RecurrenceInterval: { + type: "integer", + label: "Recurrence Interval", + description: "The interval between recurring tasks.", + optional: true, + }, + RecurrenceMonthOfYear: { + type: "string", + label: "Recurrence Month of Year", + description: "The month of the year in which the task repeats.", + optional: true, + options: RECURRENCE_MONTH_OPTIONS, + }, + RecurrenceRegeneratedType: { + type: "string", + label: "Recurrence Regenerated Type", + description: "Represents what triggers a repeating task to repeat.", + optional: true, + options: [ + { + label: "After due date", + value: "RecurrenceRegenerateAfterDueDate", + }, + { + label: "After date completed", + value: "RecurrenceRegenerateAfterToday", + }, + { + label: "(Task Closed)", + value: "RecurrenceRegenerated", + }, + ], + }, + RecurrenceStartDateOnly: { + type: "string", + label: "Recurrence Start Date", + description: "The date when the recurring task begins.", + optional: true, + }, + RecurrenceTimeZoneSidKey: { + type: "string", + label: "Recurrence Time Zone", + description: "The time zone associated with the recurring task.", + optional: true, + options: RECURRENCE_TIMEZONE_OPTIONS, + }, + RecurrenceType: { + type: "string", + label: "Recurrence Type", + description: "Indicates how often the task repeats.", + optional: true, + options: RECURRENCE_TYPE_OPTIONS, + }, + ReminderDateTime: { + type: "string", + label: "Reminder Date / Time", + description: "Represents the time when the reminder is scheduled to fire", + optional: true, + }, + Status: { + type: "string", + label: "Status", + description: "The status of the task.", + optional: true, + options: [ + "Not Started", + "In Progress", + "Completed", + "Waiting on someone else", + "Deferred", + ], + }, + Subject: { + type: "string", + label: "Subject", + description: "The subject line of the task. Limit: 255 characters.", + optional: true, + options: [ + "Call", + "Email", + "Send Letter", + "Send Quote", + "Other", + ], + }, + TaskWhoIds: { + ...commonProps.ContactOrLeadIds, + label: "Related IDs", + description: "One or more Contact or Lead IDs related to this task.", + optional: true, + }, }, }; From 73f1220a0694fd6b38091b75843219eebb6f1e40 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Tue, 16 Jul 2024 23:00:40 -0300 Subject: [PATCH 046/106] Adjustments --- .../actions/common/base.mjs | 61 +++++++++++++------ .../actions/create-account/create-account.mjs | 28 +++------ .../common/sobjects/account.mjs | 2 +- .../common/sobjects/attachment.mjs | 2 +- .../common/sobjects/campaign.mjs | 2 +- .../common/sobjects/case.mjs | 2 +- .../common/sobjects/caseComment.mjs | 2 +- .../common/sobjects/contact.mjs | 2 +- .../common/sobjects/lead.mjs | 2 +- .../common/sobjects/note.mjs | 2 +- .../common/sobjects/opportunity.mjs | 2 +- 11 files changed, 59 insertions(+), 48 deletions(-) diff --git a/components/salesforce_rest_api/actions/common/base.mjs b/components/salesforce_rest_api/actions/common/base.mjs index 95ecc3df6238c..60e3f7a9064f9 100644 --- a/components/salesforce_rest_api/actions/common/base.mjs +++ b/components/salesforce_rest_api/actions/common/base.mjs @@ -1,30 +1,53 @@ import salesforce from "../../salesforce_rest_api.app.mjs"; -export default { - props: { +export function getProps({ + objType, createOrUpdate = "create", docsLink = "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_concepts.htm", +}) { + return { salesforce, - }, + ...objType[createOrUpdate === "create" + ? "createProps" + : "updateProps"], + ...objType.initialProps, + docsInfo: { + type: "alert", + alertType: "info", + content: + `[See the documentation](${docsLink}) for more information on available fields.`, + }, + useAdvancedProps: { + propDefinition: [ + salesforce, + "useAdvancedProps", + ], + }, + }; +} + +export default { methods: { getAdvancedProps() { return {}; }, getAdditionalFields() { - return Object.fromEntries(Object.entries(this.additionalFields ?? {}).map(([ - key, - value, - ]) => { - try { - return [ - key, - JSON.parse(value), - ]; - } catch (err) { - return [ - key, - value, - ]; - } - })); + return Object.fromEntries( + Object.entries(this.additionalFields ?? {}).map(([ + key, + value, + ]) => { + try { + return [ + key, + JSON.parse(value), + ]; + } catch (err) { + return [ + key, + value, + ]; + } + }), + ); }, }, additionalProps() { diff --git a/components/salesforce_rest_api/actions/create-account/create-account.mjs b/components/salesforce_rest_api/actions/create-account/create-account.mjs index 6adf8b4f7949c..652541189641b 100644 --- a/components/salesforce_rest_api/actions/create-account/create-account.mjs +++ b/components/salesforce_rest_api/actions/create-account/create-account.mjs @@ -1,16 +1,16 @@ -import common from "../common/base.mjs"; +import common, { getProps } from "../common/base.mjs"; import account from "../../common/sobjects/account.mjs"; import { toSingleLineString } from "../../common/utils.mjs"; -const { salesforce } = common.props; +const docsLink = "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_account.htm"; export default { ...common, key: "salesforce_rest_api-create-account", name: "Create Account", description: toSingleLineString(` - Creates a Salesforce account, representing an individual account, - which is an organization or person involved with your business (such as customers, competitors, and partners). + Creates a Salesforce account + which is an organization or person involved with your business. [See the documentation](${docsLink}) `), version: "0.3.{{ts}}", type: "action", @@ -20,22 +20,10 @@ export default { return account.extraProps; }, }, - props: { - salesforce, - ...account.createProps, - ...account.initialProps, - docsInfo: { - type: "alert", - alertType: "info", - content: "[See the documentation](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_account.htm) for more information on Account fields.", - }, - useAdvancedProps: { - propDefinition: [ - salesforce, - "useAdvancedProps", - ], - }, - }, + props: getProps({ + objType: account, + docsLink, + }), async run({ $ }) { const { // eslint-disable-next-line no-unused-vars salesforce, useAdvancedProps, docsInfo, additionalFields, ...data diff --git a/components/salesforce_rest_api/common/sobjects/account.mjs b/components/salesforce_rest_api/common/sobjects/account.mjs index b0257a46d1153..c68dba0853127 100644 --- a/components/salesforce_rest_api/common/sobjects/account.mjs +++ b/components/salesforce_rest_api/common/sobjects/account.mjs @@ -1,4 +1,4 @@ -import commonProps from "../props.mjs"; +import commonProps from "../props-async-options.mjs"; export default { createProps: { diff --git a/components/salesforce_rest_api/common/sobjects/attachment.mjs b/components/salesforce_rest_api/common/sobjects/attachment.mjs index 04d08e64f78a0..a7b997c84f329 100644 --- a/components/salesforce_rest_api/common/sobjects/attachment.mjs +++ b/components/salesforce_rest_api/common/sobjects/attachment.mjs @@ -1,4 +1,4 @@ -import commonProps from "../props.mjs"; +import commonProps from "../props-async-options.mjs"; export default { createProps: { diff --git a/components/salesforce_rest_api/common/sobjects/campaign.mjs b/components/salesforce_rest_api/common/sobjects/campaign.mjs index 993946677ad8f..6d0b7de8d0f8c 100644 --- a/components/salesforce_rest_api/common/sobjects/campaign.mjs +++ b/components/salesforce_rest_api/common/sobjects/campaign.mjs @@ -1,4 +1,4 @@ -import commonProps from "../props.mjs"; +import commonProps from "../props-async-options.mjs"; export default { initialProps: { diff --git a/components/salesforce_rest_api/common/sobjects/case.mjs b/components/salesforce_rest_api/common/sobjects/case.mjs index 02a9380f4b7e9..73c1e4077c850 100644 --- a/components/salesforce_rest_api/common/sobjects/case.mjs +++ b/components/salesforce_rest_api/common/sobjects/case.mjs @@ -1,4 +1,4 @@ -import commonProps from "../props.mjs"; +import commonProps from "../props-async-options.mjs"; export default { createProps: {}, diff --git a/components/salesforce_rest_api/common/sobjects/caseComment.mjs b/components/salesforce_rest_api/common/sobjects/caseComment.mjs index dabf5c2e66730..f2e757fcc707c 100644 --- a/components/salesforce_rest_api/common/sobjects/caseComment.mjs +++ b/components/salesforce_rest_api/common/sobjects/caseComment.mjs @@ -1,4 +1,4 @@ -import commonProps from "../props.mjs"; +import commonProps from "../props-async-options.mjs"; export default { initialProps: { diff --git a/components/salesforce_rest_api/common/sobjects/contact.mjs b/components/salesforce_rest_api/common/sobjects/contact.mjs index 5ed9cb4b23218..a9f80ca9e12e2 100644 --- a/components/salesforce_rest_api/common/sobjects/contact.mjs +++ b/components/salesforce_rest_api/common/sobjects/contact.mjs @@ -1,4 +1,4 @@ -import commonProps from "../props.mjs"; +import commonProps from "../props-async-options.mjs"; export default { initialProps: { diff --git a/components/salesforce_rest_api/common/sobjects/lead.mjs b/components/salesforce_rest_api/common/sobjects/lead.mjs index 7074ffb84a233..b9007a0dc1c7e 100644 --- a/components/salesforce_rest_api/common/sobjects/lead.mjs +++ b/components/salesforce_rest_api/common/sobjects/lead.mjs @@ -1,4 +1,4 @@ -import commonProps from "../props.mjs"; +import commonProps from "../props-async-options.mjs"; export default { createProps: { diff --git a/components/salesforce_rest_api/common/sobjects/note.mjs b/components/salesforce_rest_api/common/sobjects/note.mjs index 23f5869e822e4..9c82b03f702d7 100644 --- a/components/salesforce_rest_api/common/sobjects/note.mjs +++ b/components/salesforce_rest_api/common/sobjects/note.mjs @@ -1,4 +1,4 @@ -import commonProps from "../props.mjs"; +import commonProps from "../props-async-options.mjs"; export default { initialProps: { diff --git a/components/salesforce_rest_api/common/sobjects/opportunity.mjs b/components/salesforce_rest_api/common/sobjects/opportunity.mjs index 21ebe9e006dba..52380ab9bdc1a 100644 --- a/components/salesforce_rest_api/common/sobjects/opportunity.mjs +++ b/components/salesforce_rest_api/common/sobjects/opportunity.mjs @@ -1,4 +1,4 @@ -import commonProps from "../props.mjs"; +import commonProps from "../props-async-options.mjs"; export default { createProps: { From 9aeb0115408ae105c11250e66ee2451b2907b8a8 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 17 Jul 2024 00:05:40 -0300 Subject: [PATCH 047/106] Fixing record querying --- .../common/props-async-options.mjs | 100 +++++++++--------- .../salesforce_rest_api.app.mjs | 17 +++ 2 files changed, 66 insertions(+), 51 deletions(-) diff --git a/components/salesforce_rest_api/common/props-async-options.mjs b/components/salesforce_rest_api/common/props-async-options.mjs index 81c2e09064ef8..bafd9d1c8a420 100644 --- a/components/salesforce_rest_api/common/props-async-options.mjs +++ b/components/salesforce_rest_api/common/props-async-options.mjs @@ -3,198 +3,196 @@ export default { type: "string", label: "Account ID", description: "The ID of an Account.", - async options() { - const items = await this.salesforce.listSObjectTypeIds("Account"); - return items?.map((item) => ({ - label: item.Name, - value: item.Id, - })); + options: async () => { + return this.salesforce.listRecordOptions({ + objType: "Account", + }); }, }, BusinessHoursId: { type: "string", label: "Business Hours ID", description: "The ID of a Business Hours object.", - async options() { + options: async () => { const items = await this.salesforce.listSObjectTypeIds("BusinessHours"); - return items?.map((item) => ({ + return items?.map?.((item) => ({ label: item.Name, value: item.Id, - })); + })) ?? []; }, }, CaseId: { type: "string", label: "Case ID", description: "The ID of a Case object.", - async options() { + options: async () => { const items = await this.salesforce.listSObjectTypeIds("Case"); - return items?.map((item) => ({ + return items?.map?.((item) => ({ label: item.Name, value: item.Id, - })); + })) ?? []; }, }, CampaignId: { type: "string", label: "Campaign ID", description: "The ID of a Campaign object.", - async options() { + options: async () => { const items = await this.salesforce.listSObjectTypeIds("Campaign"); - return items?.map((item) => ({ + return items?.map?.((item) => ({ label: item.Name, value: item.Id, - })); + })) ?? []; }, }, CommunityId: { type: "string", label: "Community ID", description: "The ID of a Community (Zone) object.", - async options() { + options: async () => { const items = await this.salesforce.listSObjectTypeIds("Community"); - return items?.map((item) => ({ + return items?.map?.((item) => ({ label: item.Name, value: item.Id, - })); + })) ?? []; }, }, ContactId: { type: "string", label: "Account ID", description: "The ID of a Contact.", - async options() { + options: async () => { const items = await this.salesforce.listSObjectTypeIds("Contact"); - return items?.map((item) => ({ + return items?.map?.((item) => ({ label: item.Name, value: item.Id, - })); + })) ?? []; }, }, ContractId: { type: "string", label: "Contract ID", description: "The ID of a Contract.", - async options() { + options: async () => { const items = await this.salesforce.listSObjectTypeIds("Contract"); - return items?.map((item) => ({ + return items?.map?.((item) => ({ label: item.ContractNumber + (item.Description ? ` - ${item.Description}` : ""), value: item.Id, - })); + })) ?? []; }, }, ContactOrLeadIds: { type: "string[]", label: "Contact or Lead IDs", description: "The IDs of Contact or Lead objects.", - async options() { + options: async () => { const contacts = await this.salesforce.listSObjectTypeIds("Contact"); const leads = await this.salesforce.listSObjectTypeIds("Lead"); return [ ...(contacts ?? []), ...(leads ?? []), - ]?.map((item) => ({ + ]?.map?.((item) => ({ label: item.Name, value: item.Id, - })); + })) ?? []; }, }, IndividualId: { type: "string", label: "Individual ID", description: "The ID of an Individual object.", - async options() { + options: async () => { const items = await this.salesforce.listSObjectTypeIds("Individual"); - return items?.map((item) => ({ + return items?.map?.((item) => ({ label: item.Name, value: item.Id, - })); + })) ?? []; }, }, OperatingHoursId: { type: "string", label: "Operating Hours ID", description: "The ID of an Operating Hours object.", - async options() { + options: async () => { const items = await this.salesforce.listSObjectTypeIds("OperatingHours"); - return items?.map((item) => ({ + return items?.map?.((item) => ({ label: item.Name, value: item.Id, - })); + })) ?? []; }, }, OpportunityId: { type: "string", label: "Opportunity ID", description: "The ID of an Opportunity object.", - async options() { + options: async () => { const items = await this.salesforce.listSObjectTypeIds("Opportunity"); - return items?.map((item) => ({ + return items?.map?.((item) => ({ label: item.Name, value: item.Id, - })); + })) ?? []; }, }, PartnerNetworkConnectionId: { type: "string", label: "Partner Network Connection ID", description: "The ID of a connection between Salesforce organizations.", - async options() { + options: async () => { const items = await this.salesforce.listSObjectTypeIds("PartnerNetworkConnection"); - return items?.map((item) => ({ + return items?.map?.((item) => ({ label: item.ConnectionName, value: item.Id, - })); + })) ?? []; }, }, Pricebook2Id: { type: "string", label: "Pricebook2 ID", description: "The ID of a Pricebook2 object.", - async options() { + options: async () => { const items = await this.salesforce.listSObjectTypeIds("Pricebook2"); - return items?.map((item) => ({ + return items?.map?.((item) => ({ label: item.Name, value: item.Id, - })); + })) ?? []; }, }, UserId: { type: "string", label: "User ID", description: "The ID of a user in your organization.", - async options() { + options: async () => { const items = await this.salesforce.listSObjectTypeIds("User"); - return items?.map((item) => ({ + return items?.map?.((item) => ({ label: item.Name, value: item.Id, - })); + })) ?? []; }, }, QuestionId: { type: "string", label: "Question ID", description: "The ID of a Question object.", - async options() { + options: async () => { const items = await this.salesforce.listSObjectTypeIds("Question"); - return items?.map((item) => ({ + return items?.map?.((item) => ({ label: item.Title, value: item.Id, - })); + })) ?? []; }, }, RecordTypeId: { type: "string", label: "Record Type ID", description: "ID of the record type assigned to this object.", - async options() { + options: async () => { const items = await this.salesforce.listSObjectTypeIds("RecordType"); - return items?.map((item) => ({ + return items?.map?.((item) => ({ label: item.Title, value: item.Id, - })); + })) ?? []; }, }, }; diff --git a/components/salesforce_rest_api/salesforce_rest_api.app.mjs b/components/salesforce_rest_api/salesforce_rest_api.app.mjs index dd205c4c7a083..8d2c6193bd4b1 100644 --- a/components/salesforce_rest_api/salesforce_rest_api.app.mjs +++ b/components/salesforce_rest_api/salesforce_rest_api.app.mjs @@ -512,6 +512,23 @@ export default { url, }); }, + async listRecordOptions({ + objType, + fields = [ + "Id", + "Name", + ], + getLabel = (item) => item[fields[1]], + getValue = (item) => item[fields[0]], + }) { + const { records } = await this.query({ + query: `SELECT ${fields.join(", ")} FROM ${objType}`, + }); + return records?.map?.((item) => ({ + label: getLabel(item), + value: getValue(item), + })) ?? []; + }, async search({ $, search, }) { From 4a0b48088ecc0f9cfdd48f27560f3a47e661fb70 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 17 Jul 2024 00:20:50 -0300 Subject: [PATCH 048/106] Adjusting queries for all object types --- .../common/props-async-options.mjs | 166 ++++++++---------- .../common/sobjects/case.mjs | 7 - 2 files changed, 71 insertions(+), 102 deletions(-) diff --git a/components/salesforce_rest_api/common/props-async-options.mjs b/components/salesforce_rest_api/common/props-async-options.mjs index bafd9d1c8a420..12a3b06907b0a 100644 --- a/components/salesforce_rest_api/common/props-async-options.mjs +++ b/components/salesforce_rest_api/common/props-async-options.mjs @@ -12,49 +12,48 @@ export default { BusinessHoursId: { type: "string", label: "Business Hours ID", - description: "The ID of a Business Hours object.", + description: "The ID of a Business Hours record.", options: async () => { - const items = await this.salesforce.listSObjectTypeIds("BusinessHours"); - return items?.map?.((item) => ({ - label: item.Name, - value: item.Id, - })) ?? []; + return this.salesforce.listRecordOptions({ + objType: "BusinessHours", + }); }, }, CaseId: { type: "string", label: "Case ID", - description: "The ID of a Case object.", + description: "The ID of a Case.", options: async () => { - const items = await this.salesforce.listSObjectTypeIds("Case"); - return items?.map?.((item) => ({ - label: item.Name, - value: item.Id, - })) ?? []; + return this.salesforce.listRecordOptions({ + objType: "Case", + fields: [ + "Id", + "CaseNumber", + "Subject", + "SuppliedName", + ], + getLabel: (item) => item.SuppliedName ?? item.Subject ?? item.CaseNumber, + }); }, }, CampaignId: { type: "string", label: "Campaign ID", - description: "The ID of a Campaign object.", + description: "The ID of a Campaign.", options: async () => { - const items = await this.salesforce.listSObjectTypeIds("Campaign"); - return items?.map?.((item) => ({ - label: item.Name, - value: item.Id, - })) ?? []; + return this.salesforce.listRecordOptions({ + objType: "Campaign", + }); }, }, CommunityId: { type: "string", label: "Community ID", - description: "The ID of a Community (Zone) object.", + description: "The ID of a Community (Zone) record.", options: async () => { - const items = await this.salesforce.listSObjectTypeIds("Community"); - return items?.map?.((item) => ({ - label: item.Name, - value: item.Id, - })) ?? []; + return this.salesforce.listRecordOptions({ + objType: "Community", + }); }, }, ContactId: { @@ -62,11 +61,9 @@ export default { label: "Account ID", description: "The ID of a Contact.", options: async () => { - const items = await this.salesforce.listSObjectTypeIds("Contact"); - return items?.map?.((item) => ({ - label: item.Name, - value: item.Id, - })) ?? []; + return this.salesforce.listRecordOptions({ + objType: "Contact", + }); }, }, ContractId: { @@ -74,125 +71,104 @@ export default { label: "Contract ID", description: "The ID of a Contract.", options: async () => { - const items = await this.salesforce.listSObjectTypeIds("Contract"); - return items?.map?.((item) => ({ - label: item.ContractNumber + (item.Description + return this.salesforce.listRecordOptions({ + objType: "Contract", + fields: [ + "Id", + "ContractNumber", + "Description", + ], + getLabel: (item) => item.ContractNumber + (item.Description ? ` - ${item.Description}` : ""), - value: item.Id, - })) ?? []; + }); }, }, ContactOrLeadIds: { type: "string[]", label: "Contact or Lead IDs", - description: "The IDs of Contact or Lead objects.", + description: "The IDs of Contacts or Leads.", options: async () => { - const contacts = await this.salesforce.listSObjectTypeIds("Contact"); - const leads = await this.salesforce.listSObjectTypeIds("Lead"); + const contacts = await this.salesforce.listRecordOptions({ + objType: "Contact", + }); + const leads = await this.salesforce.listRecordOptions({ + objType: "Lead", + }); return [ ...(contacts ?? []), ...(leads ?? []), - ]?.map?.((item) => ({ - label: item.Name, - value: item.Id, - })) ?? []; + ]; }, }, IndividualId: { type: "string", label: "Individual ID", - description: "The ID of an Individual object.", + description: "The ID of an Individual.", options: async () => { - const items = await this.salesforce.listSObjectTypeIds("Individual"); - return items?.map?.((item) => ({ - label: item.Name, - value: item.Id, - })) ?? []; + return this.salesforce.listRecordOptions({ + objType: "Individual", + }); }, }, OperatingHoursId: { type: "string", label: "Operating Hours ID", - description: "The ID of an Operating Hours object.", + description: "The ID of an Operating Hours record.", options: async () => { - const items = await this.salesforce.listSObjectTypeIds("OperatingHours"); - return items?.map?.((item) => ({ - label: item.Name, - value: item.Id, - })) ?? []; + return this.salesforce.listRecordOptions({ + objType: "OperatingHours", + }); }, }, OpportunityId: { type: "string", label: "Opportunity ID", - description: "The ID of an Opportunity object.", - options: async () => { - const items = await this.salesforce.listSObjectTypeIds("Opportunity"); - return items?.map?.((item) => ({ - label: item.Name, - value: item.Id, - })) ?? []; - }, - }, - PartnerNetworkConnectionId: { - type: "string", - label: "Partner Network Connection ID", - description: "The ID of a connection between Salesforce organizations.", + description: "The ID of an Opportunity.", options: async () => { - const items = await this.salesforce.listSObjectTypeIds("PartnerNetworkConnection"); - return items?.map?.((item) => ({ - label: item.ConnectionName, - value: item.Id, - })) ?? []; + return this.salesforce.listRecordOptions({ + objType: "Opportunity", + }); }, }, Pricebook2Id: { type: "string", label: "Pricebook2 ID", - description: "The ID of a Pricebook2 object.", + description: "The ID of a Pricebook2 record.", options: async () => { - const items = await this.salesforce.listSObjectTypeIds("Pricebook2"); - return items?.map?.((item) => ({ - label: item.Name, - value: item.Id, - })) ?? []; + return this.salesforce.listRecordOptions({ + objType: "Pricebook2", + }); }, }, UserId: { type: "string", label: "User ID", - description: "The ID of a user in your organization.", + description: "The ID of a User in your organization.", options: async () => { - const items = await this.salesforce.listSObjectTypeIds("User"); - return items?.map?.((item) => ({ - label: item.Name, - value: item.Id, - })) ?? []; + return this.salesforce.listRecordOptions({ + objType: "User", + }); }, }, QuestionId: { type: "string", label: "Question ID", - description: "The ID of a Question object.", + description: "The ID of a Question.", options: async () => { - const items = await this.salesforce.listSObjectTypeIds("Question"); - return items?.map?.((item) => ({ - label: item.Title, - value: item.Id, - })) ?? []; + return this.salesforce.listRecordOptions({ + objType: "Question", + }); }, }, RecordTypeId: { type: "string", label: "Record Type ID", - description: "ID of the record type assigned to this object.", + description: "ID of the record type assigned to this record.", options: async () => { - const items = await this.salesforce.listSObjectTypeIds("RecordType"); - return items?.map?.((item) => ({ - label: item.Title, - value: item.Id, - })) ?? []; + return this.salesforce.listRecordOptions({ + objType: "RecordType", + }); }, }, }; diff --git a/components/salesforce_rest_api/common/sobjects/case.mjs b/components/salesforce_rest_api/common/sobjects/case.mjs index 73c1e4077c850..b5a053a0f074d 100644 --- a/components/salesforce_rest_api/common/sobjects/case.mjs +++ b/components/salesforce_rest_api/common/sobjects/case.mjs @@ -45,13 +45,6 @@ export default { "ID of the [Community (Zone)](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_community.htm) associated with this case.", optional: true, }, - ConnectionReceivedId: { - ...commonProps.PartnerNetworkConnectionId, - label: "Connection Received ID", - description: - "ID of the `PartnerNetworkConnection` that shared this record with your organization.", - optional: true, - }, ContactId: { ...commonProps.ContactId, description: "ID of the Contact associated with this case.", From 0ee85817ca7a0e6c50ba4eca2fcbc54bc2820f91 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 17 Jul 2024 01:24:11 -0300 Subject: [PATCH 049/106] Prop reusing --- .../common/constants-props.mjs | 90 ++++++++++++++++++ .../common/sobjects/account.mjs | 93 ++----------------- .../common/sobjects/contact.mjs | 93 ++----------------- .../common/sobjects/lead.mjs | 93 ++----------------- .../common/sobjects/opportunity.mjs | 11 +-- 5 files changed, 111 insertions(+), 269 deletions(-) diff --git a/components/salesforce_rest_api/common/constants-props.mjs b/components/salesforce_rest_api/common/constants-props.mjs index ea6cd561e1061..264bbfa92983e 100644 --- a/components/salesforce_rest_api/common/constants-props.mjs +++ b/components/salesforce_rest_api/common/constants-props.mjs @@ -494,3 +494,93 @@ export const RECURRENCE_TYPE_OPTIONS = [ value: "RecursYearlyNth", }, ]; + +export const GEOCODE_ACCURACY_OPTIONS = [ + { + label: "Address", + value: "Address", + }, + { + label: "Near Address", + value: "NearAddress", + }, + { + label: "Block", + value: "Block", + }, + { + label: "Street", + value: "Street", + }, + { + label: "Extended Zip", + value: "ExtendedZip", + }, + { + label: "Zip", + value: "Zip", + }, + { + label: "Neighborhood", + value: "Neighborhood", + }, + { + label: "City", + value: "City", + }, + { + label: "County", + value: "County", + }, + { + label: "State", + value: "State", + }, + { + label: "Unknown", + value: "Unknown", + }, +]; + +export const CLEAN_STATUS_OPTIONS = [ + { + label: "In Sync", + value: "Matched", + }, + { + label: "Different", + value: "Different", + }, + { + label: "Reviewed", + value: "Acknowledged", + }, + { + label: "Not Found", + value: "NotFound", + }, + { + label: "Inactive", + value: "Inactive", + }, + { + label: "Not Compared", + value: "Pending", + }, + { + label: "Select Match", + value: "SelectMatch", + }, + { + label: "Skipped", + value: "Skipped", + }, +]; + +export const RECORD_SOURCE_OPTIONS = [ + "Web", + "Phone Inquiry", + "Partner Referral", + "Purchased List", + "Other", +]; diff --git a/components/salesforce_rest_api/common/sobjects/account.mjs b/components/salesforce_rest_api/common/sobjects/account.mjs index c68dba0853127..0fa67b08ba108 100644 --- a/components/salesforce_rest_api/common/sobjects/account.mjs +++ b/components/salesforce_rest_api/common/sobjects/account.mjs @@ -1,3 +1,6 @@ +import { + CLEAN_STATUS_OPTIONS, GEOCODE_ACCURACY_OPTIONS, RECORD_SOURCE_OPTIONS, +} from "../constants-props.mjs"; import commonProps from "../props-async-options.mjs"; export default { @@ -58,13 +61,7 @@ export default { description: "The source of the account record. Available values are set by an administrator.", optional: true, - options: [ - "Web", - "Phone Inquiry", - "Partner Referral", - "Purchased List", - "Other", - ], + options: RECORD_SOURCE_OPTIONS, }, AnnualRevenue: { type: "string", @@ -89,52 +86,7 @@ export default { label: "Billing Geocode Accuracy", description: "Accuracy level of the geocode for the billing address.", optional: true, - options: [ - { - label: "Address", - value: "Address", - }, - { - label: "Near Address", - value: "NearAddress", - }, - { - label: "Block", - value: "Block", - }, - { - label: "Street", - value: "Street", - }, - { - label: "Extended Zip", - value: "ExtendedZip", - }, - { - label: "Zip", - value: "Zip", - }, - { - label: "Neighborhood", - value: "Neighborhood", - }, - { - label: "City", - value: "City", - }, - { - label: "County", - value: "County", - }, - { - label: "State", - value: "State", - }, - { - label: "Unknown", - value: "Unknown", - }, - ], + options: GEOCODE_ACCURACY_OPTIONS, }, BillingLatitude: { type: "string", @@ -174,40 +126,7 @@ export default { description: "Indicates the record's clean status as compared with Data.com.", optional: true, - options: [ - { - value: "Acknowledged", - label: "The label on the account record detail page is Reviewed.", - }, - { - value: "Different", - label: "Different", - }, - { - value: "Inactive", - label: "Inactive", - }, - { - value: "Matched", - label: "The label on the account record detail page is In Sync.", - }, - { - value: "NotFound", - label: "NotFound", - }, - { - value: "Pending", - label: "The label on the account record detail page is Not Compared.", - }, - { - value: "SelectMatch", - label: "SelectMatch", - }, - { - value: "Skipped", - label: "Skipped", - }, - ], + options: CLEAN_STATUS_OPTIONS, }, DunsNumber: { type: "string", diff --git a/components/salesforce_rest_api/common/sobjects/contact.mjs b/components/salesforce_rest_api/common/sobjects/contact.mjs index a9f80ca9e12e2..4d10801587895 100644 --- a/components/salesforce_rest_api/common/sobjects/contact.mjs +++ b/components/salesforce_rest_api/common/sobjects/contact.mjs @@ -1,3 +1,6 @@ +import { + CLEAN_STATUS_OPTIONS, GEOCODE_ACCURACY_OPTIONS, RECORD_SOURCE_OPTIONS, +} from "../constants-props.mjs"; import commonProps from "../props-async-options.mjs"; export default { @@ -62,40 +65,7 @@ export default { description: "Indicates the record's clean status as compared with Data.com.", optional: true, - options: [ - { - label: "In Sync", - value: "Matched", - }, - { - label: "Different", - value: "Different", - }, - { - label: "Reviewed", - value: "Acknowledged", - }, - { - label: "Not Found", - value: "NotFound", - }, - { - label: "Inactive", - value: "Inactive", - }, - { - label: "Not Compared", - value: "Pending", - }, - { - label: "Select Match", - value: "SelectMatch", - }, - { - label: "Skipped", - value: "Skipped", - }, - ], + options: CLEAN_STATUS_OPTIONS, }, Department: { type: "string", @@ -143,13 +113,7 @@ export default { label: "Lead Source", description: "The source of the lead that was converted to this contact.", optional: true, - options: [ - "Web", - "Phone Inquiry", - "Partner Referral", - "Purchased List", - "Other", - ], + options: RECORD_SOURCE_OPTIONS, }, MailingCity: { type: "string", @@ -168,52 +132,7 @@ export default { label: "Mailing Geocode Accuracy", description: "Accuracy level of the geocode for the mailing address.", optional: true, - options: [ - { - label: "Address", - value: "Address", - }, - { - label: "Near Address", - value: "NearAddress", - }, - { - label: "Block", - value: "Block", - }, - { - label: "Street", - value: "Street", - }, - { - label: "Extended Zip", - value: "ExtendedZip", - }, - { - label: "Zip", - value: "Zip", - }, - { - label: "Neighborhood", - value: "Neighborhood", - }, - { - label: "City", - value: "City", - }, - { - label: "County", - value: "County", - }, - { - label: "State", - value: "State", - }, - { - label: "Unknown", - value: "Unknown", - }, - ], + options: GEOCODE_ACCURACY_OPTIONS, }, MailingLatitude: { type: "string", diff --git a/components/salesforce_rest_api/common/sobjects/lead.mjs b/components/salesforce_rest_api/common/sobjects/lead.mjs index b9007a0dc1c7e..44a7abb463a12 100644 --- a/components/salesforce_rest_api/common/sobjects/lead.mjs +++ b/components/salesforce_rest_api/common/sobjects/lead.mjs @@ -1,3 +1,6 @@ +import { + CLEAN_STATUS_OPTIONS, GEOCODE_ACCURACY_OPTIONS, RECORD_SOURCE_OPTIONS, +} from "../constants-props.mjs"; import commonProps from "../props-async-options.mjs"; export default { @@ -64,40 +67,7 @@ export default { label: "Clean Status", description: "Indicates the record's clean status compared with Data.com.", - options: [ - { - label: "In Sync", - value: "Matched", - }, - { - label: "Different", - value: "Different", - }, - { - label: "Reviewed", - value: "Acknowledged", - }, - { - label: "Not Found", - value: "NotFound", - }, - { - label: "Inactive", - value: "Inactive", - }, - { - label: "Not Compared", - value: "Pending", - }, - { - label: "Select Match", - value: "SelectMatch", - }, - { - label: "Skipped", - value: "Skipped", - }, - ], + options: CLEAN_STATUS_OPTIONS, }, CompanyDunsNumber: { type: "string", @@ -155,52 +125,7 @@ export default { label: "Geocode Accuracy", description: "Accuracy level of the geocode for the address.", optional: true, - options: [ - { - label: "Address", - value: "Address", - }, - { - label: "Near Address", - value: "NearAddress", - }, - { - label: "Block", - value: "Block", - }, - { - label: "Street", - value: "Street", - }, - { - label: "Extended Zip", - value: "ExtendedZip", - }, - { - label: "Zip", - value: "Zip", - }, - { - label: "Neighborhood", - value: "Neighborhood", - }, - { - label: "City", - value: "City", - }, - { - label: "County", - value: "County", - }, - { - label: "State", - value: "State", - }, - { - label: "Unknown", - value: "Unknown", - }, - ], + options: GEOCODE_ACCURACY_OPTIONS, }, IndividualId: { ...commonProps.IndividualId, @@ -239,13 +164,7 @@ export default { label: "Lead Source", description: "The lead's source.", optional: true, - options: [ - "Web", - "Phone Inquiry", - "Partner Referral", - "Purchased List", - "Other", - ], + options: RECORD_SOURCE_OPTIONS, }, MiddleName: { type: "string", diff --git a/components/salesforce_rest_api/common/sobjects/opportunity.mjs b/components/salesforce_rest_api/common/sobjects/opportunity.mjs index 52380ab9bdc1a..25ec214a271f1 100644 --- a/components/salesforce_rest_api/common/sobjects/opportunity.mjs +++ b/components/salesforce_rest_api/common/sobjects/opportunity.mjs @@ -1,3 +1,4 @@ +import { RECORD_SOURCE_OPTIONS } from "../constants-props.mjs"; import commonProps from "../props-async-options.mjs"; export default { @@ -95,15 +96,9 @@ export default { type: "string", label: "Lead Source", description: - "Source of this opportunity, such as Advertisement or Trade Show.", + "Source of this opportunity.", optional: true, - options: [ - "Web", - "Phone Inquiry", - "Partner Referral", - "Purchased List", - "Other", - ], + options: RECORD_SOURCE_OPTIONS, }, NextStep: { type: "string", From 1075494f8a9415b6f43a997ea0fef40dde93935a Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 17 Jul 2024 02:02:01 -0300 Subject: [PATCH 050/106] Update Account and other adjustments --- .../actions/common/base.mjs | 25 +++++- .../actions/create-account/create-account.mjs | 8 +- .../actions/update-account/update-account.mjs | 90 ++++++++++--------- .../common/sobjects/account.mjs | 6 +- 4 files changed, 72 insertions(+), 57 deletions(-) diff --git a/components/salesforce_rest_api/actions/common/base.mjs b/components/salesforce_rest_api/actions/common/base.mjs index 60e3f7a9064f9..cde1e76211f80 100644 --- a/components/salesforce_rest_api/actions/common/base.mjs +++ b/components/salesforce_rest_api/actions/common/base.mjs @@ -1,19 +1,36 @@ import salesforce from "../../salesforce_rest_api.app.mjs"; export function getProps({ - objType, createOrUpdate = "create", docsLink = "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_concepts.htm", + objType, + createOrUpdate = "create", + docsLink = "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_concepts.htm", }) { + let { initialProps } = objType; + if (initialProps && createOrUpdate === "update") { + initialProps = Object.fromEntries( + Object.entries(initialProps).map(([ + key, + value, + ]) => [ + key, + { + ...value, + optional: true, + }, + ]), + ); + } + return { salesforce, ...objType[createOrUpdate === "create" ? "createProps" : "updateProps"], - ...objType.initialProps, + ...initialProps, docsInfo: { type: "alert", alertType: "info", - content: - `[See the documentation](${docsLink}) for more information on available fields.`, + content: `[See the documentation](${docsLink}) for more information on available fields.`, }, useAdvancedProps: { propDefinition: [ diff --git a/components/salesforce_rest_api/actions/create-account/create-account.mjs b/components/salesforce_rest_api/actions/create-account/create-account.mjs index 652541189641b..4cde741347963 100644 --- a/components/salesforce_rest_api/actions/create-account/create-account.mjs +++ b/components/salesforce_rest_api/actions/create-account/create-account.mjs @@ -1,17 +1,13 @@ import common, { getProps } from "../common/base.mjs"; import account from "../../common/sobjects/account.mjs"; -import { toSingleLineString } from "../../common/utils.mjs"; -const docsLink = "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_account.htm"; +export const docsLink = "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_account.htm"; export default { ...common, key: "salesforce_rest_api-create-account", name: "Create Account", - description: toSingleLineString(` - Creates a Salesforce account - which is an organization or person involved with your business. [See the documentation](${docsLink}) - `), + description: `Creates a Salesforce account. [See the documentation](${docsLink})`, version: "0.3.{{ts}}", type: "action", methods: { diff --git a/components/salesforce_rest_api/actions/update-account/update-account.mjs b/components/salesforce_rest_api/actions/update-account/update-account.mjs index c07ae5017ba43..baf7f6557d2f4 100644 --- a/components/salesforce_rest_api/actions/update-account/update-account.mjs +++ b/components/salesforce_rest_api/actions/update-account/update-account.mjs @@ -1,62 +1,64 @@ -import common from "../common/base.mjs"; +import common, { getProps } from "../common/base.mjs"; import account from "../../common/sobjects/account.mjs"; -import { - pickBy, pick, -} from "lodash-es"; -import { toSingleLineString } from "../../common/utils.mjs"; +import { docsLink } from "../create-account/create-account.mjs"; +import propsAsyncOptions from "../../common/props-async-options.mjs"; -const { salesforce } = common.props; +const { + salesforce, ...props +} = getProps({ + createOrUpdate: "update", + objType: account, + docsLink, +}); export default { ...common, key: "salesforce_rest_api-update-account", name: "Update Account", - description: toSingleLineString(` - Updates a Salesforce account, representing an individual account, - which is an organization or person involved with your business (such as customers, competitors, and partners). - See [Account SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_account.htm) - and [Update Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_update_fields.htm) - `), - version: "0.3.0", + description: `Updates a Salesforce account. [See the documentation](${docsLink})`, + version: "0.3.{{ts}}", type: "action", + methods: { + ...common.methods, + getAdvancedProps() { + return account.extraProps; + }, + }, props: { salesforce, - AccountId: { - type: "string", - label: "Account ID", - description: "ID of the Account to modify.", - }, - Name: { - type: "string", - label: "Name", - description: "Name of the account. Maximum size is 255 characters. If the account has a record type of Person Account:\nThis value is the concatenation of the FirstName, MiddleName, LastName, and Suffix of the associated person contact.", - optional: true, + accountId: { + ...propsAsyncOptions.AccountId, + async options() { + return this.salesforce.listRecordOptions({ + objType: "Account", + }); + }, }, - selector: { - propDefinition: [ - salesforce, - "fieldSelector", - ], - description: `${salesforce.propDefinitions.fieldSelector.description} Account`, - options: () => Object.keys(account), - reloadProps: true, - }, - }, - additionalProps() { - return this.additionalProps(this.selector, account); + ...props, }, async run({ $ }) { - const data = pickBy(pick(this, [ - "AccountId", - "Name", - ...this.selector, - ])); - const response = await this.salesforce.updateAccount({ + /* eslint-disable no-unused-vars */ + const { + salesforce, + accountId, + useAdvancedProps, + docsInfo, + additionalFields, + ...data + } = this; + /* eslint-enable no-unused-vars */ + const response = await salesforce.updateAccount({ $, - id: this.AccountId, - data, + id: accountId, + data: { + ...data, + ...this.getAdditionalFields(), + }, }); - $.export("$summary", `Successfully updated account (ID: ${this.AccountId})`); + $.export( + "$summary", + `Successfully updated account (ID: ${this.accountId})`, + ); return response; }, }; diff --git a/components/salesforce_rest_api/common/sobjects/account.mjs b/components/salesforce_rest_api/common/sobjects/account.mjs index 0fa67b08ba108..746504f7b370d 100644 --- a/components/salesforce_rest_api/common/sobjects/account.mjs +++ b/components/salesforce_rest_api/common/sobjects/account.mjs @@ -37,13 +37,13 @@ export default { }, Description: { type: "string", - label: "Account Description", + label: "Description", description: "Text description of the account. Limited to 32,000 KB.", optional: true, }, Phone: { type: "string", - label: "Account Phone", + label: "Phone", description: "Phone number for this account. Max 40 characters.", optional: true, }, @@ -363,7 +363,7 @@ export default { type: "string", label: "Year Started", description: - "The date when an org was legally established. Max 4 characters", + "The year when an org was legally established. Max 4 characters", optional: true, }, }, From a4fcd311e9bf1cabace085a6385921c7be4061ba Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 17 Jul 2024 18:43:19 -0300 Subject: [PATCH 051/106] Create Campaign + date prop parsing --- .../actions/common/base.mjs | 20 ++++++ .../create-campaign/create-campaign.mjs | 63 ++++++++----------- 2 files changed, 46 insertions(+), 37 deletions(-) diff --git a/components/salesforce_rest_api/actions/common/base.mjs b/components/salesforce_rest_api/actions/common/base.mjs index cde1e76211f80..4c469b0547b9b 100644 --- a/components/salesforce_rest_api/actions/common/base.mjs +++ b/components/salesforce_rest_api/actions/common/base.mjs @@ -1,3 +1,4 @@ +import { ConfigurationError } from "@pipedream/platform"; import salesforce from "../../salesforce_rest_api.app.mjs"; export function getProps({ @@ -66,6 +67,25 @@ export default { }), ); }, + formatDateTimeProps(props = {}) { + // https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_valid_date_formats.htm + return Object.fromEntries(Object.entries(props).map(([ + key, + value, + ]) => { + const numValue = Number(value); + const date = new Date(isNaN(numValue) + ? value + : numValue); + if (isNaN(date.valueOf())) { + throw new ConfigurationError(`Invalid date format for prop \`${key}\`. Please provide a [valid date string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#date_time_string_format).`); + } + return [ + key, + date.toISOString(), + ]; + })); + }, }, additionalProps() { return this.useAdvancedProps diff --git a/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs b/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs index b28735e44a0a7..12913949c281b 100644 --- a/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs +++ b/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs @@ -1,52 +1,41 @@ -import common from "../common/base.mjs"; +import common, { getProps } from "../common/base.mjs"; import campaign from "../../common/sobjects/campaign.mjs"; -import { - pickBy, pick, -} from "lodash-es"; -import { toSingleLineString } from "../../common/utils.mjs"; -const { salesforce } = common.props; +const docsLink = "https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_campaign.htm"; export default { ...common, key: "salesforce_rest_api-create-campaign", name: "Create Campaign", - description: toSingleLineString(` - Creates a marketing campaign, such as a direct mail promotion, webinar, or trade show. - See [Campaign SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_campaign.htm) - and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm) - `), - version: "0.3.0", + description: `Creates a marketing campaign. [See the documentation](${docsLink})`, + version: "0.3.{{ts}}", type: "action", - props: { - salesforce, - Name: { - type: "string", - label: "Name", - description: "Required. Name of the campaign. Limit: is 80 characters.", + methods: { + ...common.methods, + getAdvancedProps() { + return campaign.extraProps; }, - selector: { - propDefinition: [ - salesforce, - "fieldSelector", - ], - description: `${salesforce.propDefinitions.fieldSelector.description} Campaign`, - options: () => Object.keys(campaign), - reloadProps: true, - optional: true, - }, - }, - additionalProps() { - return this.additionalProps(this.selector, campaign); }, + props: getProps({ + objType: campaign, + docsLink, + }), async run({ $ }) { - const data = pickBy(pick(this, [ - "Name", - ...this.selector, - ])); - const response = await this.salesforce.createCampaign({ + /* eslint-disable no-unused-vars */ + const { + salesforce, useAdvancedProps, docsInfo, additionalFields, StartDate, EndDate, ...data + } = this; + /* eslint-enable no-unused-vars */ + const response = await salesforce.createCampaign({ $, - data, + data: { + ...data, + ...this.formatDateTimeProps({ + StartDate, + EndDate, + }), + ...this.getAdditionalFields(), + }, }); $.export("$summary", `Successfully created campaign "${this.Name}"`); return response; From 825c1a3b4eb6ac756b8cfa6d6ddfcb238f3d3852 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 17 Jul 2024 18:55:24 -0300 Subject: [PATCH 052/106] Create Case + adjustments --- .../create-campaign/create-campaign.mjs | 2 +- .../actions/create-case/create-case.mjs | 62 ++++++++----------- .../common/props-async-options.mjs | 10 +++ .../common/sobjects/case.mjs | 35 ++++++----- 4 files changed, 56 insertions(+), 53 deletions(-) diff --git a/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs b/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs index 12913949c281b..41daa90660a5c 100644 --- a/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs +++ b/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs @@ -1,7 +1,7 @@ import common, { getProps } from "../common/base.mjs"; import campaign from "../../common/sobjects/campaign.mjs"; -const docsLink = "https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_campaign.htm"; +const docsLink = "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_campaign.htm"; export default { ...common, diff --git a/components/salesforce_rest_api/actions/create-case/create-case.mjs b/components/salesforce_rest_api/actions/create-case/create-case.mjs index c32aaa0d35f09..a5ee4b71c9071 100644 --- a/components/salesforce_rest_api/actions/create-case/create-case.mjs +++ b/components/salesforce_rest_api/actions/create-case/create-case.mjs @@ -1,53 +1,43 @@ -import common from "../common/base.mjs"; -import salesforceCase from "../../common/sobjects/case.mjs"; -import { - pickBy, pick, -} from "lodash-es"; -import { toSingleLineString } from "../../common/utils.mjs"; +import common, { getProps } from "../common/base.mjs"; +import caseObj from "../../common/sobjects/case.mjs"; -const { salesforce } = common.props; +const docsLink = "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_case.htm"; export default { ...common, key: "salesforce_rest_api-create-case", name: "Create Case", - description: toSingleLineString(` - Creates a Salesforce case, which represents a customer issue or problem. - See [Case SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_case.htm) - and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm) - `), + description: `Creates a Case, which represents a customer issue or problem. [See the documentation](${docsLink})`, version: "0.3.0", type: "action", - props: { - salesforce, - SuppliedEmail: { - type: "string", - label: "Supplied email", - description: "The email address that was entered when the case was created. Label is Email.If your organization has an active auto-response rule, SuppliedEmail is required when creating a case via the API. Auto-response rules use the email in the contact specified by ContactId. If no email address is in the contact record, the email specified here is used.", + methods: { + ...common.methods, + getAdvancedProps() { + return caseObj.extraProps; }, - selector: { - propDefinition: [ - salesforce, - "fieldSelector", - ], - description: `${salesforce.propDefinitions.fieldSelector.description} Case`, - options: () => Object.keys(salesforceCase), - reloadProps: true, - }, - }, - additionalProps() { - return this.additionalProps(this.selector, salesforceCase); }, + props: getProps({ + objType: caseObj, + docsLink, + }), async run({ $ }) { - const data = pickBy(pick(this, [ - "SuppliedEmail", - ...this.selector, - ])); + /* eslint-disable no-unused-vars */ + const { + salesforce, useAdvancedProps, docsInfo, additionalFields, SlaStartDate, ...data + } = this; + /* eslint-enable no-unused-vars */ const response = await this.salesforce.createCase({ $, - data, + data: { + ...data, + ...this.formatDateTimeProps({ + SlaStartDate, + }), + ...this.getAdditionalFields(), + }, }); - $.export("$summary", `Successfully created case for ${this.SuppliedEmail}`); + const summary = (this.SuppliedName && ` "${this.SuppliedName}"`) ?? (this.SuppliedEmail && ` with email ${this.SuppliedEmail}`) ?? ""; + $.export("$summary", `Successfully created case${summary}`); return response; }, }; diff --git a/components/salesforce_rest_api/common/props-async-options.mjs b/components/salesforce_rest_api/common/props-async-options.mjs index 12a3b06907b0a..54427938dd608 100644 --- a/components/salesforce_rest_api/common/props-async-options.mjs +++ b/components/salesforce_rest_api/common/props-async-options.mjs @@ -141,6 +141,16 @@ export default { }); }, }, + ServiceContractId: { + type: "string", + label: "ServiceContract ID", + description: "The ID of a Service Contract record.", + options: async () => { + return this.salesforce.listRecordOptions({ + objType: "ServiceContract", + }); + }, + }, UserId: { type: "string", label: "User ID", diff --git a/components/salesforce_rest_api/common/sobjects/case.mjs b/components/salesforce_rest_api/common/sobjects/case.mjs index b5a053a0f074d..e98be99614b1e 100644 --- a/components/salesforce_rest_api/common/sobjects/case.mjs +++ b/components/salesforce_rest_api/common/sobjects/case.mjs @@ -1,8 +1,11 @@ import commonProps from "../props-async-options.mjs"; export default { - createProps: {}, initialProps: { + ServiceContractId: { + ...commonProps.ServiceContractId, + description: "ID of the ServiceContract associated with the entitlement.", + }, Description: { type: "string", label: "Description", @@ -21,10 +24,16 @@ export default { "Closed", ], }, - Subject: { + SuppliedEmail: { type: "string", - label: "Subject", - description: "The subject of the case. Max 255 characters.", + label: "Email", + description: "The email address associated with the case.", + optional: true, + }, + SuppliedName: { + type: "string", + label: "Name", + description: "The name of the case.", optional: true, }, }, @@ -144,22 +153,16 @@ export default { description: "The ID of the social post source.", optional: true, }, - SuppliedCompany: { - type: "string", - label: "Company", - description: "The company name that was entered when the case was created.", - optional: true, - }, - SuppliedEmail: { + Subject: { type: "string", - label: "Email", - description: "The email address that was entered when the case was created.", + label: "Subject", + description: "The subject of the case. Max 255 characters.", optional: true, }, - SuppliedName: { + SuppliedCompany: { type: "string", - label: "Name", - description: "The name that was entered when the case was created.", + label: "Company", + description: "The company name that was entered when the case was created.", optional: true, }, SuppliedPhone: { From 2f498cc97fd9a18fe60ec77c355943071710106a Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 17 Jul 2024 19:11:07 -0300 Subject: [PATCH 053/106] Create Case and CaseComment --- .../actions/create-case/create-case.mjs | 2 +- .../create-casecomment/create-casecomment.mjs | 57 +++++++------------ 2 files changed, 21 insertions(+), 38 deletions(-) diff --git a/components/salesforce_rest_api/actions/create-case/create-case.mjs b/components/salesforce_rest_api/actions/create-case/create-case.mjs index a5ee4b71c9071..85ad6de0b89f2 100644 --- a/components/salesforce_rest_api/actions/create-case/create-case.mjs +++ b/components/salesforce_rest_api/actions/create-case/create-case.mjs @@ -26,7 +26,7 @@ export default { salesforce, useAdvancedProps, docsInfo, additionalFields, SlaStartDate, ...data } = this; /* eslint-enable no-unused-vars */ - const response = await this.salesforce.createCase({ + const response = await salesforce.createCase({ $, data: { ...data, diff --git a/components/salesforce_rest_api/actions/create-casecomment/create-casecomment.mjs b/components/salesforce_rest_api/actions/create-casecomment/create-casecomment.mjs index 5d7533ba7c528..01bc033cd2a22 100644 --- a/components/salesforce_rest_api/actions/create-casecomment/create-casecomment.mjs +++ b/components/salesforce_rest_api/actions/create-casecomment/create-casecomment.mjs @@ -1,49 +1,32 @@ -import common from "../common/base.mjs"; +import common, { getProps } from "../common/base.mjs"; import caseComment from "../../common/sobjects/caseComment.mjs"; -import { - pickBy, pick, -} from "lodash-es"; -import { toSingleLineString } from "../../common/utils.mjs"; -const { salesforce } = common.props; +const docsLink = "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_casecomment.htm"; + +/* eslint-disable no-unused-vars */ +const { + useAdvancedProps, ...props +} = getProps({ + objType: caseComment, + docsLink, +}); +/* eslint-enable no-unused-vars */ export default { ...common, key: "salesforce_rest_api-create-casecomment", name: "Create CaseComment", - description: toSingleLineString(` - Creates a Case Comment that provides additional information about the associated Case. - See [CaseComment SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_casecomment.htm) - and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm) - `), - version: "0.3.0", + description: `Creates a Case Comment on a selected Case. [See the documentation](${docsLink})`, + version: "0.3.{{ts}}", type: "action", - props: { - salesforce, - ParentId: { - type: "string", - label: "Parent ID", - description: "Required. ID of the parent Case of the CaseComment.", - }, - selector: { - propDefinition: [ - salesforce, - "fieldSelector", - ], - description: `${salesforce.propDefinitions.fieldSelector.description} CaseComment`, - options: () => Object.keys(caseComment), - reloadProps: true, - }, - }, - additionalProps() { - return this.additionalProps(this.selector, caseComment); - }, + props, async run({ $ }) { - const data = pickBy(pick(this, [ - "ParentId", - ...this.selector, - ])); - const response = await this.salesforce.createCaseComment({ + /* eslint-disable no-unused-vars */ + const { + salesforce, docsInfo, ...data + } = this; + /* eslint-enable no-unused-vars */ + const response = await salesforce.createCaseComment({ $, data, }); From a0fd476c8511d298b994b3000dea0bf7022d80ca Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 17 Jul 2024 19:41:49 -0300 Subject: [PATCH 054/106] Create Contact --- .../actions/create-contact/create-contact.mjs | 58 ++++++++----------- 1 file changed, 25 insertions(+), 33 deletions(-) diff --git a/components/salesforce_rest_api/actions/create-contact/create-contact.mjs b/components/salesforce_rest_api/actions/create-contact/create-contact.mjs index 2d67e7f8801f4..dd1eb4e2143e7 100644 --- a/components/salesforce_rest_api/actions/create-contact/create-contact.mjs +++ b/components/salesforce_rest_api/actions/create-contact/create-contact.mjs @@ -1,51 +1,43 @@ -import common from "../common/base.mjs"; +import common, { getProps } from "../common/base.mjs"; import contact from "../../common/sobjects/contact.mjs"; -import { - pickBy, pick, -} from "lodash-es"; -import { toSingleLineString } from "../../common/utils.mjs"; -const { salesforce } = common.props; +const docsLink = "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_contact.htm"; export default { ...common, key: "salesforce_rest_api-create-contact", name: "Create Contact", - description: toSingleLineString(` - Creates a Contact, which is a person associated with an account. - See [Contact SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_contact.htm) - and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm) - `), - version: "0.3.0", + description: `Creates a contact. [See the documentation](${docsLink})`, + version: "0.3.{{ts}}", type: "action", - props: { - salesforce, - LastName: { - type: "string", - label: "Last name", - description: "Last name of the contact up to 80 characters.", - }, - selector: { - propDefinition: [ - salesforce, - "fieldSelector", - ], - description: `${salesforce.propDefinitions.fieldSelector.description} Contact`, - options: () => Object.keys(contact), - reloadProps: true, + methods: { + ...common.methods, + getAdvancedProps() { + return contact.extraProps; }, }, + props: getProps({ + objType: contact, + docsLink, + }), additionalProps() { return this.additionalProps(this.selector, contact); }, async run({ $ }) { - const data = pickBy(pick(this, [ - "LastName", - ...this.selector, - ])); - const response = await this.salesforce.createContact({ + /* eslint-disable no-unused-vars */ + const { + salesforce, useAdvancedProps, docsInfo, additionalFields, Birthdate, ...data + } = this; + /* eslint-enable no-unused-vars */ + const response = await salesforce.createContact({ $, - data, + data: { + ...data, + ...this.formatDateTimeProps({ + Birthdate, + }), + ...this.getAdditionalFields(), + }, }); $.export("$summary", `Successfully created contact "${this.LastName}"`); return response; From 77af6c6215c643f3c3af8c56e31eb015e4ac7486 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 17 Jul 2024 19:49:15 -0300 Subject: [PATCH 055/106] Update Contact + adjustments to async props --- .../actions/create-contact/create-contact.mjs | 2 +- .../actions/update-contact/update-contact.mjs | 89 ++++++++++--------- .../common/props-async-options.mjs | 4 + .../common/sobjects/case.mjs | 5 ++ .../common/sobjects/caseComment.mjs | 19 +++- 5 files changed, 73 insertions(+), 46 deletions(-) diff --git a/components/salesforce_rest_api/actions/create-contact/create-contact.mjs b/components/salesforce_rest_api/actions/create-contact/create-contact.mjs index dd1eb4e2143e7..b2c01928c599b 100644 --- a/components/salesforce_rest_api/actions/create-contact/create-contact.mjs +++ b/components/salesforce_rest_api/actions/create-contact/create-contact.mjs @@ -1,7 +1,7 @@ import common, { getProps } from "../common/base.mjs"; import contact from "../../common/sobjects/contact.mjs"; -const docsLink = "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_contact.htm"; +export const docsLink = "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_contact.htm"; export default { ...common, diff --git a/components/salesforce_rest_api/actions/update-contact/update-contact.mjs b/components/salesforce_rest_api/actions/update-contact/update-contact.mjs index 710478a2aad21..48cde469be0d2 100644 --- a/components/salesforce_rest_api/actions/update-contact/update-contact.mjs +++ b/components/salesforce_rest_api/actions/update-contact/update-contact.mjs @@ -1,61 +1,64 @@ -import common from "../common/base.mjs"; +import common, { getProps } from "../common/base.mjs"; import contact from "../../common/sobjects/contact.mjs"; -import { - pickBy, pick, -} from "lodash-es"; -import { toSingleLineString } from "../../common/utils.mjs"; +import { docsLink } from "../create-contact/create-contact.mjs"; +import propsAsyncOptions from "../../common/props-async-options.mjs"; -const { salesforce } = common.props; +const { + salesforce, ...props +} = getProps({ + createOrUpdate: "update", + objType: contact, + docsLink, +}); export default { ...common, key: "salesforce_rest_api-update-contact", name: "Update Contact", - description: toSingleLineString(` - Updates a Contact, which is a person associated with an account. - See [Contact SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_contact.htm) - and [Update Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_update_fields.htm) - `), - version: "0.3.0", + description: `Updates a contact. [See the documentation](${docsLink})`, + version: "0.3.{{ts}}", type: "action", + methods: { + ...common.methods, + getAdvancedProps() { + return contact.extraProps; + }, + }, props: { salesforce, - ContactId: { - type: "string", - label: "Contact ID", - description: "ID of the Contact to update.", - }, - LastName: { - type: "string", - label: "Last Name", - description: "Last name of the contact up to 80 characters.", - optional: true, + contactId: { + ...propsAsyncOptions.ContactId, + async options() { + return this.salesforce.listRecordOptions({ + objType: "Contact", + }); + }, }, - selector: { - propDefinition: [ - salesforce, - "fieldSelector", - ], - description: `${salesforce.propDefinitions.fieldSelector.description} Contact`, - options: () => Object.keys(contact), - reloadProps: true, - }, - }, - additionalProps() { - return this.additionalProps(this.selector, contact); + ...props, }, async run({ $ }) { - const data = pickBy(pick(this, [ - "ContactId", - "LastName", - ...this.selector, - ])); - const response = await this.salesforce.updateContact({ + /* eslint-disable no-unused-vars */ + const { + salesforce, + contactId, + useAdvancedProps, + docsInfo, + additionalFields, + ...data + } = this; + /* eslint-enable no-unused-vars */ + const response = await salesforce.updateContact({ $, - id: this.ContactId, - data, + id: contactId, + data: { + ...data, + ...this.getAdditionalFields(), + }, }); - $.export("$summary", `Successfully updated contact (ID: ${this.ContactId})`); + $.export( + "$summary", + `Successfully updated contact (ID: ${this.contactId})`, + ); return response; }, }; diff --git a/components/salesforce_rest_api/common/props-async-options.mjs b/components/salesforce_rest_api/common/props-async-options.mjs index 54427938dd608..42ec8a02186d6 100644 --- a/components/salesforce_rest_api/common/props-async-options.mjs +++ b/components/salesforce_rest_api/common/props-async-options.mjs @@ -1,3 +1,7 @@ +// Note: the arrow function syntax is required when calling from within additionalProps, +// whereas when using regular props, the standard method syntax is needed instead. +// These props are more commonly used in additionalProps, so all are defined as such, +// and the options method needs to be redefined if used in regular props. export default { AccountId: { type: "string", diff --git a/components/salesforce_rest_api/common/sobjects/case.mjs b/components/salesforce_rest_api/common/sobjects/case.mjs index e98be99614b1e..7fb7b957b8e7a 100644 --- a/components/salesforce_rest_api/common/sobjects/case.mjs +++ b/components/salesforce_rest_api/common/sobjects/case.mjs @@ -5,6 +5,11 @@ export default { ServiceContractId: { ...commonProps.ServiceContractId, description: "ID of the ServiceContract associated with the entitlement.", + async options () { + return this.salesforce.listRecordOptions({ + objType: "ServiceContract", + }); + }, }, Description: { type: "string", diff --git a/components/salesforce_rest_api/common/sobjects/caseComment.mjs b/components/salesforce_rest_api/common/sobjects/caseComment.mjs index f2e757fcc707c..458183e07a086 100644 --- a/components/salesforce_rest_api/common/sobjects/caseComment.mjs +++ b/components/salesforce_rest_api/common/sobjects/caseComment.mjs @@ -12,17 +12,32 @@ export default { ...commonProps.CaseId, label: "Parent Case ID", description: "ID of the parent Case.", + async options() { + return this.salesforce.listRecordOptions({ + objType: "Case", + fields: [ + "Id", + "CaseNumber", + "Subject", + "SuppliedName", + ], + getLabel: (item) => + item.SuppliedName ?? item.Subject ?? item.CaseNumber, + }); + }, }, IsNotificationSelected: { type: "boolean", label: "Is Notification Selected", - description: "Indicates whether an email notification is sent to the case contact when a CaseComment is created or updated.", + description: + "Indicates whether an email notification is sent to the case contact when a CaseComment is created or updated.", optional: true, }, IsPublished: { type: "boolean", label: "Is Published", - description: "Indicates whether the CaseComment is visible to customers in the Self-Service portal.", + description: + "Indicates whether the CaseComment is visible to customers in the Self-Service portal.", optional: true, }, }, From 9099313d729fb2f82282ec605cdbc720d64402c5 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 17 Jul 2024 20:14:10 -0300 Subject: [PATCH 056/106] Create Event + adjustments --- .../actions/create-contact/create-contact.mjs | 3 - .../actions/create-event/create-event.mjs | 109 +++++++----------- .../common/props-async-options.mjs | 2 +- .../common/sobjects/event.mjs | 12 ++ 4 files changed, 57 insertions(+), 69 deletions(-) diff --git a/components/salesforce_rest_api/actions/create-contact/create-contact.mjs b/components/salesforce_rest_api/actions/create-contact/create-contact.mjs index b2c01928c599b..a73c2eb740e0e 100644 --- a/components/salesforce_rest_api/actions/create-contact/create-contact.mjs +++ b/components/salesforce_rest_api/actions/create-contact/create-contact.mjs @@ -20,9 +20,6 @@ export default { objType: contact, docsLink, }), - additionalProps() { - return this.additionalProps(this.selector, contact); - }, async run({ $ }) { /* eslint-disable no-unused-vars */ const { diff --git a/components/salesforce_rest_api/actions/create-event/create-event.mjs b/components/salesforce_rest_api/actions/create-event/create-event.mjs index 2ee5a72584753..54b1f0815bdb1 100644 --- a/components/salesforce_rest_api/actions/create-event/create-event.mjs +++ b/components/salesforce_rest_api/actions/create-event/create-event.mjs @@ -1,78 +1,57 @@ -import salesforce from "../../salesforce_rest_api.app.mjs"; -import { - removeNullEntries, toSingleLineString, -} from "../../common/utils.mjs"; +import common, { getProps } from "../common/base.mjs"; +import event from "../../common/sobjects/event.mjs"; + +export const docsLink = + "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_event.htm"; export default { key: "salesforce_rest_api-create-event", name: "Create Event", - description: toSingleLineString(` - Creates an event, which represents an event in the calendar. - See [Event SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_event.htm) - and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm) - `), - version: "0.3.0", + description: `Creates an event. [See the documentation](${docsLink})`, + version: "0.3.{{ts}}", type: "action", - props: { - salesforce, - IsAllDayEvent: { - type: "boolean", - label: "All-Day Event", - description: "Indicates whether the ActivityDate field (true) or the ActivityDateTime field (false) is used to define the date or time of the event.", - reloadProps: true, - }, - AcceptedEventInviteeIds: { - propDefinition: [ - salesforce, - "AcceptedEventInviteeIds", - ], - }, - Description: { - type: "string", - label: "Description", - description: "Contains a text description of the event. Limit: 32,000 characters.", + methods: { + ...common.methods, + getAdvancedProps() { + return event.extraProps; }, - Subject: { - type: "string", - label: "Subject", - description: "The subject line of the event, such as Call, Email, or Meeting. Limit: 255 characters.", - }, - }, - async additionalProps() { - const props = {}; - if (this.IsAllDayEvent) { - props.ActivityDate = { - type: "string", - label: "Due Date Only (YYYY/MM/DD)", - description: "Contains the event's due date if the IsAllDayEvent flag is set to true.", - }; - } else { - props.ActivityDateTime = { - type: "string", - label: "Due Date Time", - description: "Contains the event's due date if the IsAllDayEvent flag is set to false. The time portion of this field is always transferred in the Coordinated Universal Time (UTC) time zone. Translate the time portion to or from a local time zone for the user or the application, as appropriate.", - }; - props.DurationInMinutes = { - type: "integer", - label: "Duration in minutes", - description: "Contains the event length, in minutes.", - }; - } - return props; }, + props: getProps({ + objType: event, + docsLink, + }), async run({ $ }) { - const data = removeNullEntries({ - IsAllDayEvent: this.IsAllDayEvent, - AcceptedEventInviteeIds: this.AcceptedEventInviteeIds, - Description: this.Description, - Subject: this.Subject, - ActivityDate: this.ActivityDate && new Date(this.ActivityDate).toUTCString(), - ActivityDateTime: this.ActivityDateTime, - DurationInMinutes: this.DurationInMinutes, - }); + /* eslint-disable no-unused-vars */ + const { + salesforce, + useAdvancedProps, + docsInfo, + additionalFields, + ActivityDate, + EndDateTime, + RecurrenceEndDateOnly, + RecurrenceStartDateTime, + ReminderDateTime, + StartDateTime, + RecurrenceDayOfWeekMask, + ...data + } = this; + /* eslint-enable no-unused-vars */ const response = await this.salesforce.createEvent({ $, - data, + data: { + ...data, + ...this.formatDateTimeProps({ + ActivityDate, + EndDateTime, + RecurrenceEndDateOnly, + RecurrenceStartDateTime, + ReminderDateTime, + StartDateTime, + }), + RecurrenceDayOfWeekMask: RecurrenceDayOfWeekMask?.reduce?.((acc, val) => acc + val, 0), + ...this.getAdditionalFields(), + }, }); $.export("$summary", `Succcessfully created event "${this.Subject}"`); return response; diff --git a/components/salesforce_rest_api/common/props-async-options.mjs b/components/salesforce_rest_api/common/props-async-options.mjs index 42ec8a02186d6..7a111b624c553 100644 --- a/components/salesforce_rest_api/common/props-async-options.mjs +++ b/components/salesforce_rest_api/common/props-async-options.mjs @@ -62,7 +62,7 @@ export default { }, ContactId: { type: "string", - label: "Account ID", + label: "Contact ID", description: "The ID of a Contact.", options: async () => { return this.salesforce.listRecordOptions({ diff --git a/components/salesforce_rest_api/common/sobjects/event.mjs b/components/salesforce_rest_api/common/sobjects/event.mjs index db9f09b611162..2d3b1b76acf66 100644 --- a/components/salesforce_rest_api/common/sobjects/event.mjs +++ b/components/salesforce_rest_api/common/sobjects/event.mjs @@ -10,6 +10,18 @@ export default { label: "Accepted Event Invitee IDs", description: "One or more Contact or Lead IDs who accepted this event.", optional: true, + async options() { + const contacts = await this.salesforce.listRecordOptions({ + objType: "Contact", + }); + const leads = await this.salesforce.listRecordOptions({ + objType: "Lead", + }); + return [ + ...(contacts ?? []), + ...(leads ?? []), + ]; + }, }, ActivityDate: { type: "string", From bb85db9ca325542c192f8fd46bd7118a77500d9b Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 17 Jul 2024 20:33:50 -0300 Subject: [PATCH 057/106] Adding date info alert prop --- components/salesforce_rest_api/actions/common/base.mjs | 10 +++++++++- .../actions/create-campaign/create-campaign.mjs | 1 + .../actions/create-case/create-case.mjs | 1 + .../actions/create-contact/create-contact.mjs | 1 + .../actions/create-event/create-event.mjs | 1 + 5 files changed, 13 insertions(+), 1 deletion(-) diff --git a/components/salesforce_rest_api/actions/common/base.mjs b/components/salesforce_rest_api/actions/common/base.mjs index 4c469b0547b9b..3b6bc0cd859ab 100644 --- a/components/salesforce_rest_api/actions/common/base.mjs +++ b/components/salesforce_rest_api/actions/common/base.mjs @@ -5,6 +5,7 @@ export function getProps({ objType, createOrUpdate = "create", docsLink = "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_concepts.htm", + showDateInfo = false, }) { let { initialProps } = objType; if (initialProps && createOrUpdate === "update") { @@ -24,6 +25,13 @@ export function getProps({ return { salesforce, + ...showDateInfo && { + dateInfo: { + type: "alert", + alertType: "info", + content: "Date fields should be a [valid date string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#date_time_string_format) or a Unix timestamp in milliseconds. Example values: `2022-01-15T18:30:00.000Z` or `1642271400000`.", + }, + }, ...objType[createOrUpdate === "create" ? "createProps" : "updateProps"], @@ -78,7 +86,7 @@ export default { ? value : numValue); if (isNaN(date.valueOf())) { - throw new ConfigurationError(`Invalid date format for prop \`${key}\`. Please provide a [valid date string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#date_time_string_format).`); + throw new ConfigurationError(`Invalid date format for prop \`${key}\`. Please provide a valid date format.`); } return [ key, diff --git a/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs b/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs index 41daa90660a5c..e608728706050 100644 --- a/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs +++ b/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs @@ -19,6 +19,7 @@ export default { props: getProps({ objType: campaign, docsLink, + showDateInfo: true, }), async run({ $ }) { /* eslint-disable no-unused-vars */ diff --git a/components/salesforce_rest_api/actions/create-case/create-case.mjs b/components/salesforce_rest_api/actions/create-case/create-case.mjs index 85ad6de0b89f2..6e803f5db9064 100644 --- a/components/salesforce_rest_api/actions/create-case/create-case.mjs +++ b/components/salesforce_rest_api/actions/create-case/create-case.mjs @@ -19,6 +19,7 @@ export default { props: getProps({ objType: caseObj, docsLink, + showDateInfo: true, }), async run({ $ }) { /* eslint-disable no-unused-vars */ diff --git a/components/salesforce_rest_api/actions/create-contact/create-contact.mjs b/components/salesforce_rest_api/actions/create-contact/create-contact.mjs index a73c2eb740e0e..73a4758144785 100644 --- a/components/salesforce_rest_api/actions/create-contact/create-contact.mjs +++ b/components/salesforce_rest_api/actions/create-contact/create-contact.mjs @@ -19,6 +19,7 @@ export default { props: getProps({ objType: contact, docsLink, + showDateInfo: true, }), async run({ $ }) { /* eslint-disable no-unused-vars */ diff --git a/components/salesforce_rest_api/actions/create-event/create-event.mjs b/components/salesforce_rest_api/actions/create-event/create-event.mjs index 54b1f0815bdb1..b824f2d30416d 100644 --- a/components/salesforce_rest_api/actions/create-event/create-event.mjs +++ b/components/salesforce_rest_api/actions/create-event/create-event.mjs @@ -19,6 +19,7 @@ export default { props: getProps({ objType: event, docsLink, + showDateInfo: true, }), async run({ $ }) { /* eslint-disable no-unused-vars */ From 64e4923326fd4babc2e33c5979ca26427a263994 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 17 Jul 2024 20:37:00 -0300 Subject: [PATCH 058/106] Create Lead --- .../actions/create-lead/create-lead.mjs | 66 +++++++------------ .../common/sobjects/lead.mjs | 1 - 2 files changed, 23 insertions(+), 44 deletions(-) diff --git a/components/salesforce_rest_api/actions/create-lead/create-lead.mjs b/components/salesforce_rest_api/actions/create-lead/create-lead.mjs index d6a627eae6628..e233e7ebd938a 100644 --- a/components/salesforce_rest_api/actions/create-lead/create-lead.mjs +++ b/components/salesforce_rest_api/actions/create-lead/create-lead.mjs @@ -1,59 +1,39 @@ -import common from "../common/base.mjs"; +import common, { getProps } from "../common/base.mjs"; import lead from "../../common/sobjects/lead.mjs"; -import { - pickBy, pick, -} from "lodash-es"; -import { toSingleLineString } from "../../common/utils.mjs"; -const { salesforce } = common.props; +export const docsLink = "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_lead.htm"; export default { ...common, key: "salesforce_rest_api-create-lead", name: "Create Lead", - description: toSingleLineString(` - Creates a lead, which represents a prospect or lead. - See [Lead SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_lead.htm) - and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm) - `), - version: "0.3.0", + description: `Creates a lead. [See the documentation](${docsLink})`, + version: "0.3.{{ts}}", type: "action", - props: { - salesforce, - Company: { - type: "string", - label: "Company", - description: "The lead's company. Note If person account record types have been enabled, and if the value of Company is null, the lead converts to a person account.", + methods: { + ...common.methods, + getAdvancedProps() { + return lead.extraProps; }, - LastName: { - type: "string", - label: "Last name", - description: "Required. Last name of the lead up to 80 characters.", - }, - selector: { - propDefinition: [ - salesforce, - "fieldSelector", - ], - description: `${salesforce.propDefinitions.fieldSelector.description} Lead`, - options: () => Object.keys(lead), - reloadProps: true, - }, - }, - additionalProps() { - return this.additionalProps(this.selector, lead); }, + props: getProps({ + objType: lead, + docsLink, + }), async run({ $ }) { - const data = pickBy(pick(this, [ - "Company", - "LastName", - ...this.selector, - ])); - const response = await this.salesforce.createLead({ + /* eslint-disable no-unused-vars */ + const { + salesforce, useAdvancedProps, docsInfo, additionalFields, ...data + } = this; + /* eslint-enable no-unused-vars */ + const response = await salesforce.createLead({ $, - data, + data: { + ...data, + ...this.getAdditionalFields(), + }, }); - $.export("$summary", `Successfully created lead for ${this.Company}`); + $.export("$summary", `Successfully created lead "${this.LastName}"`); return response; }, }; diff --git a/components/salesforce_rest_api/common/sobjects/lead.mjs b/components/salesforce_rest_api/common/sobjects/lead.mjs index 44a7abb463a12..b41c250d9179e 100644 --- a/components/salesforce_rest_api/common/sobjects/lead.mjs +++ b/components/salesforce_rest_api/common/sobjects/lead.mjs @@ -12,7 +12,6 @@ export default { optional: true, }, }, - updateProps: {}, initialProps: { Company: { type: "string", From 4d13e02508dccc78a8d738e3caabf2c4e0e2468f Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 17 Jul 2024 20:42:42 -0300 Subject: [PATCH 059/106] Adjusting to ignore dateInfo alert prop --- .../actions/create-account/create-account.mjs | 2 +- .../actions/create-campaign/create-campaign.mjs | 6 +++--- .../salesforce_rest_api/actions/create-case/create-case.mjs | 2 +- .../actions/create-contact/create-contact.mjs | 2 +- .../actions/create-event/create-event.mjs | 1 + .../salesforce_rest_api/actions/create-lead/create-lead.mjs | 2 +- .../actions/update-account/update-account.mjs | 1 + .../actions/update-contact/update-contact.mjs | 1 + 8 files changed, 10 insertions(+), 7 deletions(-) diff --git a/components/salesforce_rest_api/actions/create-account/create-account.mjs b/components/salesforce_rest_api/actions/create-account/create-account.mjs index 4cde741347963..d18fe493e10cf 100644 --- a/components/salesforce_rest_api/actions/create-account/create-account.mjs +++ b/components/salesforce_rest_api/actions/create-account/create-account.mjs @@ -22,7 +22,7 @@ export default { }), async run({ $ }) { const { // eslint-disable-next-line no-unused-vars - salesforce, useAdvancedProps, docsInfo, additionalFields, ...data + salesforce, useAdvancedProps, docsInfo, dateInfo, additionalFields, ...data } = this; const response = await salesforce.createAccount({ $, diff --git a/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs b/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs index e608728706050..4dd2b9f316815 100644 --- a/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs +++ b/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs @@ -22,11 +22,11 @@ export default { showDateInfo: true, }), async run({ $ }) { - /* eslint-disable no-unused-vars */ + /* eslint-disable no-unused-vars, max-len */ const { - salesforce, useAdvancedProps, docsInfo, additionalFields, StartDate, EndDate, ...data + salesforce, useAdvancedProps, docsInfo, dateInfo, additionalFields, StartDate, EndDate, ...data } = this; - /* eslint-enable no-unused-vars */ + /* eslint-enable no-unused-vars, max-len */ const response = await salesforce.createCampaign({ $, data: { diff --git a/components/salesforce_rest_api/actions/create-case/create-case.mjs b/components/salesforce_rest_api/actions/create-case/create-case.mjs index 6e803f5db9064..33d8387c785f5 100644 --- a/components/salesforce_rest_api/actions/create-case/create-case.mjs +++ b/components/salesforce_rest_api/actions/create-case/create-case.mjs @@ -24,7 +24,7 @@ export default { async run({ $ }) { /* eslint-disable no-unused-vars */ const { - salesforce, useAdvancedProps, docsInfo, additionalFields, SlaStartDate, ...data + salesforce, useAdvancedProps, docsInfo, dateInfo, additionalFields, SlaStartDate, ...data } = this; /* eslint-enable no-unused-vars */ const response = await salesforce.createCase({ diff --git a/components/salesforce_rest_api/actions/create-contact/create-contact.mjs b/components/salesforce_rest_api/actions/create-contact/create-contact.mjs index 73a4758144785..7a160fea2d1ea 100644 --- a/components/salesforce_rest_api/actions/create-contact/create-contact.mjs +++ b/components/salesforce_rest_api/actions/create-contact/create-contact.mjs @@ -24,7 +24,7 @@ export default { async run({ $ }) { /* eslint-disable no-unused-vars */ const { - salesforce, useAdvancedProps, docsInfo, additionalFields, Birthdate, ...data + salesforce, useAdvancedProps, docsInfo, dateInfo, additionalFields, Birthdate, ...data } = this; /* eslint-enable no-unused-vars */ const response = await salesforce.createContact({ diff --git a/components/salesforce_rest_api/actions/create-event/create-event.mjs b/components/salesforce_rest_api/actions/create-event/create-event.mjs index b824f2d30416d..387ad57d1cdb3 100644 --- a/components/salesforce_rest_api/actions/create-event/create-event.mjs +++ b/components/salesforce_rest_api/actions/create-event/create-event.mjs @@ -27,6 +27,7 @@ export default { salesforce, useAdvancedProps, docsInfo, + dateInfo, additionalFields, ActivityDate, EndDateTime, diff --git a/components/salesforce_rest_api/actions/create-lead/create-lead.mjs b/components/salesforce_rest_api/actions/create-lead/create-lead.mjs index e233e7ebd938a..115f956de47a4 100644 --- a/components/salesforce_rest_api/actions/create-lead/create-lead.mjs +++ b/components/salesforce_rest_api/actions/create-lead/create-lead.mjs @@ -23,7 +23,7 @@ export default { async run({ $ }) { /* eslint-disable no-unused-vars */ const { - salesforce, useAdvancedProps, docsInfo, additionalFields, ...data + salesforce, useAdvancedProps, docsInfo, dateInfo, additionalFields, ...data } = this; /* eslint-enable no-unused-vars */ const response = await salesforce.createLead({ diff --git a/components/salesforce_rest_api/actions/update-account/update-account.mjs b/components/salesforce_rest_api/actions/update-account/update-account.mjs index baf7f6557d2f4..5cc85d9b450ac 100644 --- a/components/salesforce_rest_api/actions/update-account/update-account.mjs +++ b/components/salesforce_rest_api/actions/update-account/update-account.mjs @@ -43,6 +43,7 @@ export default { accountId, useAdvancedProps, docsInfo, + dateInfo, additionalFields, ...data } = this; diff --git a/components/salesforce_rest_api/actions/update-contact/update-contact.mjs b/components/salesforce_rest_api/actions/update-contact/update-contact.mjs index 48cde469be0d2..6cdd3bb5bc4a6 100644 --- a/components/salesforce_rest_api/actions/update-contact/update-contact.mjs +++ b/components/salesforce_rest_api/actions/update-contact/update-contact.mjs @@ -43,6 +43,7 @@ export default { contactId, useAdvancedProps, docsInfo, + dateInfo, additionalFields, ...data } = this; From a8525af904b0fc9845ac731fcdaaea7da61e8d0b Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 17 Jul 2024 20:53:04 -0300 Subject: [PATCH 060/106] Create Note + adjustments --- .../create-casecomment/create-casecomment.mjs | 2 +- .../actions/create-event/create-event.mjs | 2 +- .../actions/create-lead/create-lead.mjs | 2 +- .../actions/create-note/create-note.mjs | 63 ++++++------------- .../common/sobjects/note.mjs | 7 ++- 5 files changed, 28 insertions(+), 48 deletions(-) diff --git a/components/salesforce_rest_api/actions/create-casecomment/create-casecomment.mjs b/components/salesforce_rest_api/actions/create-casecomment/create-casecomment.mjs index 01bc033cd2a22..d8cfc2de2be1a 100644 --- a/components/salesforce_rest_api/actions/create-casecomment/create-casecomment.mjs +++ b/components/salesforce_rest_api/actions/create-casecomment/create-casecomment.mjs @@ -15,7 +15,7 @@ const { export default { ...common, key: "salesforce_rest_api-create-casecomment", - name: "Create CaseComment", + name: "Create Case Comment", description: `Creates a Case Comment on a selected Case. [See the documentation](${docsLink})`, version: "0.3.{{ts}}", type: "action", diff --git a/components/salesforce_rest_api/actions/create-event/create-event.mjs b/components/salesforce_rest_api/actions/create-event/create-event.mjs index 387ad57d1cdb3..7ef169008c98f 100644 --- a/components/salesforce_rest_api/actions/create-event/create-event.mjs +++ b/components/salesforce_rest_api/actions/create-event/create-event.mjs @@ -1,7 +1,7 @@ import common, { getProps } from "../common/base.mjs"; import event from "../../common/sobjects/event.mjs"; -export const docsLink = +const docsLink = "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_event.htm"; export default { diff --git a/components/salesforce_rest_api/actions/create-lead/create-lead.mjs b/components/salesforce_rest_api/actions/create-lead/create-lead.mjs index 115f956de47a4..cc1c58224e671 100644 --- a/components/salesforce_rest_api/actions/create-lead/create-lead.mjs +++ b/components/salesforce_rest_api/actions/create-lead/create-lead.mjs @@ -1,7 +1,7 @@ import common, { getProps } from "../common/base.mjs"; import lead from "../../common/sobjects/lead.mjs"; -export const docsLink = "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_lead.htm"; +const docsLink = "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_lead.htm"; export default { ...common, diff --git a/components/salesforce_rest_api/actions/create-note/create-note.mjs b/components/salesforce_rest_api/actions/create-note/create-note.mjs index 3108bdf9451ad..96f0a1d921880 100644 --- a/components/salesforce_rest_api/actions/create-note/create-note.mjs +++ b/components/salesforce_rest_api/actions/create-note/create-note.mjs @@ -1,55 +1,32 @@ -import common from "../common/base.mjs"; +import common, { getProps } from "../common/base.mjs"; import note from "../../common/sobjects/note.mjs"; -import { - pickBy, pick, -} from "lodash-es"; -import { toSingleLineString } from "../../common/utils.mjs"; -const { salesforce } = common.props; +const docsLink = "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_note.htm"; + +/* eslint-disable no-unused-vars */ +const { + useAdvancedProps, ...props +} = getProps({ + objType: note, + docsLink, +}); +/* eslint-enable no-unused-vars */ export default { ...common, key: "salesforce_rest_api-create-note", name: "Create Note", - description: toSingleLineString(` - Creates a note, which is text associated with a custom object or a standard object, such as a Contact, Contract, or Opportunity. - See [Note SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_note.htm) - and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm) - `), - version: "0.3.0", + description: `Creates a note. [See the documentation](${docsLink})`, + version: "0.3.{{ts}}", type: "action", - props: { - salesforce, - ParentId: { - type: "string", - label: "Parent ID", - description: "ID of the object associated with the note.", - }, - Title: { - type: "string", - label: "Title", - description: "Title of the note.", - }, - selector: { - propDefinition: [ - salesforce, - "fieldSelector", - ], - description: `${salesforce.propDefinitions.fieldSelector.description} Note`, - options: () => Object.keys(note), - reloadProps: true, - }, - }, - additionalProps() { - return this.additionalProps(this.selector, note); - }, + props, async run({ $ }) { - const data = pickBy(pick(this, [ - "ParentId", - "Title", - ...this.selector, - ])); - const response = await this.salesforce.createNote({ + /* eslint-disable no-unused-vars */ + const { + salesforce, docsInfo, ...data + } = this; + /* eslint-enable no-unused-vars */ + const response = await salesforce.createNote({ $, data, }); diff --git a/components/salesforce_rest_api/common/sobjects/note.mjs b/components/salesforce_rest_api/common/sobjects/note.mjs index 9c82b03f702d7..2a60ed4ae78c3 100644 --- a/components/salesforce_rest_api/common/sobjects/note.mjs +++ b/components/salesforce_rest_api/common/sobjects/note.mjs @@ -18,18 +18,21 @@ export default { label: "Owner ID", description: "ID of the user who owns the note.", optional: true, + async options () { + return this.salesforce.listRecordOptions({ + objType: "User", + }); + }, }, ParentId: { type: "string", label: "Parent ID", description: "ID of the object associated with the note. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_note.htm) for which objects can be referenced.", - optional: true, }, Title: { type: "string", label: "Title", description: "Title of the note.", - optional: true, }, }, }; From 8645fb0da63b9022356a7fbd125d8b295163b2c8 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 17 Jul 2024 21:07:40 -0300 Subject: [PATCH 061/106] Create Task + summary adjustment --- .../actions/create-event/create-event.mjs | 4 +- .../actions/create-task/create-task.mjs | 85 ++++++++++--------- 2 files changed, 46 insertions(+), 43 deletions(-) diff --git a/components/salesforce_rest_api/actions/create-event/create-event.mjs b/components/salesforce_rest_api/actions/create-event/create-event.mjs index 7ef169008c98f..4511fa716987e 100644 --- a/components/salesforce_rest_api/actions/create-event/create-event.mjs +++ b/components/salesforce_rest_api/actions/create-event/create-event.mjs @@ -55,7 +55,9 @@ export default { ...this.getAdditionalFields(), }, }); - $.export("$summary", `Succcessfully created event "${this.Subject}"`); + $.export("$summary", `Succcessfully created event${this.Subject + ? ` "${this.Subject}"` + : ""}`); return response; }, }; diff --git a/components/salesforce_rest_api/actions/create-task/create-task.mjs b/components/salesforce_rest_api/actions/create-task/create-task.mjs index ab7709f2ebda7..dcf26c849ab32 100644 --- a/components/salesforce_rest_api/actions/create-task/create-task.mjs +++ b/components/salesforce_rest_api/actions/create-task/create-task.mjs @@ -1,59 +1,60 @@ -import common from "../common/base.mjs"; +import common, { getProps } from "../common/base.mjs"; import task from "../../common/sobjects/task.mjs"; -import { - pickBy, pick, -} from "lodash-es"; -import { toSingleLineString } from "../../common/utils.mjs"; -const { salesforce } = common.props; +const docsLink = + "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_task.htm"; export default { ...common, key: "salesforce_rest_api-create-task", name: "Create Task", - description: toSingleLineString(` - Creates a task, which represents a business activity such as making a phone call or other to-do items. - See [Task SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_task.htm) - and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm) - `), - version: "0.4.0", + description: `Creates a task. [See the documentation](${docsLink})`, + version: "0.4.{{ts}}", type: "action", - props: { - salesforce, - Priority: { - type: "string", - label: "Priority", - description: "Required. Indicates the importance or urgency of a task, such as high or low.", + methods: { + ...common.methods, + getAdvancedProps() { + return task.extraProps; }, - Status: { - type: "string", - label: "Status", - description: "Required. The status of the task, such as In Progress or Completed. Each predefined Status field implies a value for the IsClosed flag. To obtain picklist values, query the TaskStatus object. Note This field can't be updated for recurring tasks (IsRecurrence is true).", - }, - selector: { - propDefinition: [ - salesforce, - "fieldSelector", - ], - description: `${salesforce.propDefinitions.fieldSelector.description} Task`, - options: () => Object.keys(task), - reloadProps: true, - }, - }, - additionalProps() { - return this.additionalProps(this.selector, task); }, + props: getProps({ + objType: task, + docsLink, + showDateInfo: true, + }), async run({ $ }) { - const data = pickBy(pick(this, [ - "Priority", - "Status", - ...this.selector, - ])); + /* eslint-disable no-unused-vars */ + const { + salesforce, + useAdvancedProps, + docsInfo, + dateInfo, + additionalFields, + ActivityDate, + RecurrenceEndDateOnly, + RecurrenceStartDateOnly, + ReminderDateTime, + RecurrenceDayOfWeekMask, + ...data + } = this; + /* eslint-enable no-unused-vars */ const response = await this.salesforce.createTask({ $, - data, + data: { + ...data, + ...this.formatDateTimeProps({ + ActivityDate, + RecurrenceEndDateOnly, + RecurrenceStartDateOnly, + ReminderDateTime, + }), + RecurrenceDayOfWeekMask: RecurrenceDayOfWeekMask?.reduce?.((acc, val) => acc + val, 0), + ...this.getAdditionalFields(), + }, }); - $.export("$summary", "Successfully created task"); + $.export("$summary", `Succcessfully created task${this.Subject + ? ` "${this.Subject}"` + : ""}`); return response; }, }; From 252d5d1ba7450610cb1e2d2e29178933ac1f23a0 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 17 Jul 2024 21:11:50 -0300 Subject: [PATCH 062/106] Create Opportunity --- .../create-opportunity/create-opportunity.mjs | 72 +++++++------------ .../common/sobjects/opportunity.mjs | 6 +- 2 files changed, 30 insertions(+), 48 deletions(-) diff --git a/components/salesforce_rest_api/actions/create-opportunity/create-opportunity.mjs b/components/salesforce_rest_api/actions/create-opportunity/create-opportunity.mjs index d2d07c0723cf5..292f582f207d3 100644 --- a/components/salesforce_rest_api/actions/create-opportunity/create-opportunity.mjs +++ b/components/salesforce_rest_api/actions/create-opportunity/create-opportunity.mjs @@ -1,63 +1,41 @@ -import common from "../common/base.mjs"; +import common, { getProps } from "../common/base.mjs"; import opportunity from "../../common/sobjects/opportunity.mjs"; -import { - pickBy, pick, -} from "lodash-es"; -import { toSingleLineString } from "../../common/utils.mjs"; -const { salesforce } = common.props; +export const docsLink = "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_opportunity.htm"; export default { ...common, key: "salesforce_rest_api-create-opportunity", name: "Create Opportunity", - description: toSingleLineString(` - Creates an opportunity, which represents an opportunity, which is a sale or pending deal. - See [Opportunity SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_opportunity.htm) - and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm) - `), + description: `Creates an opportunity. [See the documentation](${docsLink})`, version: "0.3.0", type: "action", - props: { - salesforce, - CloseDate: { - type: "string", - label: "Close date", - description: "Date when the opportunity is expected to close.", + methods: { + ...common.methods, + getAdvancedProps() { + return opportunity.extraProps; }, - Name: { - type: "string", - label: "Name", - description: "A name for this opportunity. Limit: 120 characters.", - }, - StageName: { - type: "string", - label: "StageName", - description: "Current stage of this record. The StageName field controls several other fields on an opportunity. Each of the fields can be directly set or implied by changing the StageName field. In addition, the StageName field is a picklist, so it has additional members in the returned describeSObjectResult to indicate how it affects the other fields. To obtain the stage name values in the picklist, query the OpportunityStage object. If the StageName is updated, then the ForecastCategoryName, IsClosed, IsWon, and Probability are automatically updated based on the stage-category mapping.", - }, - selector: { - propDefinition: [ - salesforce, - "fieldSelector", - ], - description: `${salesforce.propDefinitions.fieldSelector.description} Opportunity`, - options: () => Object.keys(opportunity), - reloadProps: true, - }, - }, - additionalProps() { - return this.additionalProps(this.selector, opportunity); }, + props: getProps({ + objType: opportunity, + docsLink, + showDateInfo: true, + }), async run({ $ }) { - const data = pickBy(pick(this, [ - "CloseDate", - "Name", - "StageName", - ...this.selector, - ])); - const response = await this.salesforce.createOpportunity({ + /* eslint-disable no-unused-vars */ + const { + salesforce, useAdvancedProps, docsInfo, dateInfo, additionalFields, CloseDate, ...data + } = this; + /* eslint-enable no-unused-vars */ + const response = await salesforce.createOpportunity({ $, - data, + data: { + ...data, + ...this.formatDateTimeProps({ + CloseDate, + }), + ...this.getAdditionalFields(), + }, }); $.export("$summary", `Successfully created opportunity "${this.Name}"`); return response; diff --git a/components/salesforce_rest_api/common/sobjects/opportunity.mjs b/components/salesforce_rest_api/common/sobjects/opportunity.mjs index 25ec214a271f1..0444d47fbc860 100644 --- a/components/salesforce_rest_api/common/sobjects/opportunity.mjs +++ b/components/salesforce_rest_api/common/sobjects/opportunity.mjs @@ -8,9 +8,13 @@ export default { description: "ID of the contact associated with this opportunity, set as the primary contact.", optional: true, + async options() { + return this.salesforce.listRecordOptions({ + objType: "Contact", + }); + }, }, }, - updateProps: {}, initialProps: { CloseDate: { type: "string", From 652c840d22a004fb37472acae7aed5fd2be29e28 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 17 Jul 2024 23:57:03 -0300 Subject: [PATCH 063/106] Update Opportunity + adjustments --- .../create-opportunity/create-opportunity.mjs | 2 +- .../actions/update-contact/update-contact.mjs | 5 + .../update-opportunity/update-opportunity.mjs | 104 ++++++++---------- 3 files changed, 54 insertions(+), 57 deletions(-) diff --git a/components/salesforce_rest_api/actions/create-opportunity/create-opportunity.mjs b/components/salesforce_rest_api/actions/create-opportunity/create-opportunity.mjs index 292f582f207d3..25ea1f6e78dd9 100644 --- a/components/salesforce_rest_api/actions/create-opportunity/create-opportunity.mjs +++ b/components/salesforce_rest_api/actions/create-opportunity/create-opportunity.mjs @@ -8,7 +8,7 @@ export default { key: "salesforce_rest_api-create-opportunity", name: "Create Opportunity", description: `Creates an opportunity. [See the documentation](${docsLink})`, - version: "0.3.0", + version: "0.3.{{ts}}", type: "action", methods: { ...common.methods, diff --git a/components/salesforce_rest_api/actions/update-contact/update-contact.mjs b/components/salesforce_rest_api/actions/update-contact/update-contact.mjs index 6cdd3bb5bc4a6..c20d888fd4aba 100644 --- a/components/salesforce_rest_api/actions/update-contact/update-contact.mjs +++ b/components/salesforce_rest_api/actions/update-contact/update-contact.mjs @@ -9,6 +9,7 @@ const { createOrUpdate: "update", objType: contact, docsLink, + showDateInfo: true, }); export default { @@ -45,6 +46,7 @@ export default { docsInfo, dateInfo, additionalFields, + Birthdate, ...data } = this; /* eslint-enable no-unused-vars */ @@ -53,6 +55,9 @@ export default { id: contactId, data: { ...data, + ...this.formatDateTimeProps({ + Birthdate, + }), ...this.getAdditionalFields(), }, }); diff --git a/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs b/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs index 75f0b148f0492..f0226beb389f6 100644 --- a/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs +++ b/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs @@ -1,73 +1,65 @@ -import common from "../common/base.mjs"; +import common, { getProps } from "../common/base.mjs"; import opportunity from "../../common/sobjects/opportunity.mjs"; -import { - pickBy, pick, -} from "lodash-es"; -import { toSingleLineString } from "../../common/utils.mjs"; +import { docsLink } from "../create-opportunity/create-opportunity.mjs"; +import propsAsyncOptions from "../../common/props-async-options.mjs"; -const { salesforce } = common.props; +const { + salesforce, ...props +} = getProps({ + createOrUpdate: "update", + objType: opportunity, + docsLink, + showDateInfo: true, +}); export default { ...common, key: "salesforce_rest_api-update-opportunity", name: "Update Opportunity", - description: toSingleLineString(` - Updates an opportunity, which represents an opportunity, which is a sale or pending deal. - See [Opportunity SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_opportunity.htm) - and [Update Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_update_fields.htm) - `), - version: "0.3.0", + description: `Updates an opportunity. [See the documentation](${docsLink})`, + version: "0.3.{{ts}}", type: "action", + methods: { + ...common.methods, + getAdvancedProps() { + return opportunity.extraProps; + }, + }, props: { salesforce, - OpportunityId: { - type: "string", - label: "Opportunity ID", - description: "ID of the Opportunity to update.", - }, - CloseDate: { - type: "string", - label: "CloseDate", - description: "Date when the opportunity is expected to close.", - optional: true, - }, - Name: { - type: "string", - label: "Name", - description: "A name for this opportunity. Limit: 120 characters.", - optional: true, + opportunityId: { + ...propsAsyncOptions.OpportunityId, + async options() { + return this.salesforce.listRecordOptions({ + objType: "Opportunity", + }); + }, }, - StageName: { - type: "string", - label: "StageName", - description: "Current stage of this record. The StageName field controls several other fields on an opportunity. Each of the fields can be directly set or implied by changing the StageName field. In addition, the StageName field is a picklist, so it has additional members in the returned describeSObjectResult to indicate how it affects the other fields. To obtain the stage name values in the picklist, query the OpportunityStage object. If the StageName is updated, then the ForecastCategoryName, IsClosed, IsWon, and Probability are automatically updated based on the stage-category mapping.", - optional: true, - }, - selector: { - propDefinition: [ - salesforce, - "fieldSelector", - ], - description: `${salesforce.propDefinitions.fieldSelector.description} Opportunity`, - options: () => Object.keys(opportunity), - reloadProps: true, - }, - }, - additionalProps() { - return this.additionalProps(this.selector, opportunity); + ...props, }, async run({ $ }) { - const data = pickBy(pick(this, [ - "OpportunityId", - "CloseDate", - "Name", - "StageName", - ...this.selector, - ])); - const response = await this.salesforce.updateOpportunity({ + /* eslint-disable no-unused-vars */ + const { + salesforce, + opportunityId, + useAdvancedProps, + docsInfo, + dateInfo, + additionalFields, + CloseDate, + ...data + } = this; + /* eslint-enable no-unused-vars */ + const response = await salesforce.updateOpportunity({ $, - id: this.OpportunityId, - data, + id: opportunityId, + data: { + ...data, + ...this.formatDateTimeProps({ + CloseDate, + }), + ...this.getAdditionalFields(), + }, }); $.export("$summary", `Successfully updated opportunity (ID: ${this.OpportunityId})`); return response; From b086e3f1e8d56a0619f2a4978443abb7851f6e6e Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Thu, 18 Jul 2024 02:24:53 -0300 Subject: [PATCH 064/106] Adjustments --- .../actions/create-account/create-account.mjs | 16 +- .../create-campaign/create-campaign.mjs | 16 +- .../actions/create-case/create-case.mjs | 15 +- .../create-casecomment/create-casecomment.mjs | 7 +- .../actions/create-contact/create-contact.mjs | 15 +- .../actions/create-event/create-event.mjs | 9 +- .../actions/create-lead/create-lead.mjs | 12 +- .../actions/create-note/create-note.mjs | 6 +- .../create-opportunity/create-opportunity.mjs | 15 +- .../actions/create-task/create-task.mjs | 9 +- .../actions/create-user/create-user.mjs | 200 ++---------------- .../actions/update-account/update-account.mjs | 5 +- .../actions/update-contact/update-contact.mjs | 7 +- .../update-opportunity/update-opportunity.mjs | 7 +- 14 files changed, 124 insertions(+), 215 deletions(-) diff --git a/components/salesforce_rest_api/actions/create-account/create-account.mjs b/components/salesforce_rest_api/actions/create-account/create-account.mjs index d18fe493e10cf..63b9a3107e03b 100644 --- a/components/salesforce_rest_api/actions/create-account/create-account.mjs +++ b/components/salesforce_rest_api/actions/create-account/create-account.mjs @@ -21,14 +21,24 @@ export default { docsLink, }), async run({ $ }) { - const { // eslint-disable-next-line no-unused-vars - salesforce, useAdvancedProps, docsInfo, dateInfo, additionalFields, ...data + /* eslint-disable no-unused-vars */ + const { + salesforce, + getAdvancedProps, + getAdditionalFields, + formatDateTimeProps, + useAdvancedProps, + docsInfo, + dateInfo, + additionalFields, + ...data } = this; + /* eslint-enable no-unused-vars */ const response = await salesforce.createAccount({ $, data: { ...data, - ...this.getAdditionalFields(), + ...getAdditionalFields(), }, }); $.export("$summary", `Successfully created account "${this.Name}"`); diff --git a/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs b/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs index 4dd2b9f316815..e06df98840798 100644 --- a/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs +++ b/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs @@ -24,18 +24,28 @@ export default { async run({ $ }) { /* eslint-disable no-unused-vars, max-len */ const { - salesforce, useAdvancedProps, docsInfo, dateInfo, additionalFields, StartDate, EndDate, ...data + salesforce, + getAdvancedProps, + getAdditionalFields, + formatDateTimeProps, + useAdvancedProps, + docsInfo, + dateInfo, + additionalFields, + StartDate, + EndDate, + ...data } = this; /* eslint-enable no-unused-vars, max-len */ const response = await salesforce.createCampaign({ $, data: { ...data, - ...this.formatDateTimeProps({ + ...formatDateTimeProps({ StartDate, EndDate, }), - ...this.getAdditionalFields(), + ...getAdditionalFields(), }, }); $.export("$summary", `Successfully created campaign "${this.Name}"`); diff --git a/components/salesforce_rest_api/actions/create-case/create-case.mjs b/components/salesforce_rest_api/actions/create-case/create-case.mjs index 33d8387c785f5..e2e0ba91191cb 100644 --- a/components/salesforce_rest_api/actions/create-case/create-case.mjs +++ b/components/salesforce_rest_api/actions/create-case/create-case.mjs @@ -24,17 +24,26 @@ export default { async run({ $ }) { /* eslint-disable no-unused-vars */ const { - salesforce, useAdvancedProps, docsInfo, dateInfo, additionalFields, SlaStartDate, ...data + salesforce, + getAdvancedProps, + getAdditionalFields, + formatDateTimeProps, + useAdvancedProps, + docsInfo, + dateInfo, + additionalFields, + SlaStartDate, + ...data } = this; /* eslint-enable no-unused-vars */ const response = await salesforce.createCase({ $, data: { ...data, - ...this.formatDateTimeProps({ + ...formatDateTimeProps({ SlaStartDate, }), - ...this.getAdditionalFields(), + ...getAdditionalFields(), }, }); const summary = (this.SuppliedName && ` "${this.SuppliedName}"`) ?? (this.SuppliedEmail && ` with email ${this.SuppliedEmail}`) ?? ""; diff --git a/components/salesforce_rest_api/actions/create-casecomment/create-casecomment.mjs b/components/salesforce_rest_api/actions/create-casecomment/create-casecomment.mjs index d8cfc2de2be1a..d6419136c1281 100644 --- a/components/salesforce_rest_api/actions/create-casecomment/create-casecomment.mjs +++ b/components/salesforce_rest_api/actions/create-casecomment/create-casecomment.mjs @@ -23,7 +23,12 @@ export default { async run({ $ }) { /* eslint-disable no-unused-vars */ const { - salesforce, docsInfo, ...data + salesforce, + getAdvancedProps, + getAdditionalFields, + formatDateTimeProps, + docsInfo, + ...data } = this; /* eslint-enable no-unused-vars */ const response = await salesforce.createCaseComment({ diff --git a/components/salesforce_rest_api/actions/create-contact/create-contact.mjs b/components/salesforce_rest_api/actions/create-contact/create-contact.mjs index 7a160fea2d1ea..c71e565f88b4e 100644 --- a/components/salesforce_rest_api/actions/create-contact/create-contact.mjs +++ b/components/salesforce_rest_api/actions/create-contact/create-contact.mjs @@ -24,17 +24,26 @@ export default { async run({ $ }) { /* eslint-disable no-unused-vars */ const { - salesforce, useAdvancedProps, docsInfo, dateInfo, additionalFields, Birthdate, ...data + salesforce, + getAdvancedProps, + getAdditionalFields, + formatDateTimeProps, + useAdvancedProps, + docsInfo, + dateInfo, + additionalFields, + Birthdate, + ...data } = this; /* eslint-enable no-unused-vars */ const response = await salesforce.createContact({ $, data: { ...data, - ...this.formatDateTimeProps({ + ...formatDateTimeProps({ Birthdate, }), - ...this.getAdditionalFields(), + ...getAdditionalFields(), }, }); $.export("$summary", `Successfully created contact "${this.LastName}"`); diff --git a/components/salesforce_rest_api/actions/create-event/create-event.mjs b/components/salesforce_rest_api/actions/create-event/create-event.mjs index 4511fa716987e..a3d0c335d4f9c 100644 --- a/components/salesforce_rest_api/actions/create-event/create-event.mjs +++ b/components/salesforce_rest_api/actions/create-event/create-event.mjs @@ -25,6 +25,9 @@ export default { /* eslint-disable no-unused-vars */ const { salesforce, + getAdvancedProps, + getAdditionalFields, + formatDateTimeProps, useAdvancedProps, docsInfo, dateInfo, @@ -39,11 +42,11 @@ export default { ...data } = this; /* eslint-enable no-unused-vars */ - const response = await this.salesforce.createEvent({ + const response = await salesforce.createEvent({ $, data: { ...data, - ...this.formatDateTimeProps({ + ...formatDateTimeProps({ ActivityDate, EndDateTime, RecurrenceEndDateOnly, @@ -52,7 +55,7 @@ export default { StartDateTime, }), RecurrenceDayOfWeekMask: RecurrenceDayOfWeekMask?.reduce?.((acc, val) => acc + val, 0), - ...this.getAdditionalFields(), + ...getAdditionalFields(), }, }); $.export("$summary", `Succcessfully created event${this.Subject diff --git a/components/salesforce_rest_api/actions/create-lead/create-lead.mjs b/components/salesforce_rest_api/actions/create-lead/create-lead.mjs index cc1c58224e671..40723991fe8fb 100644 --- a/components/salesforce_rest_api/actions/create-lead/create-lead.mjs +++ b/components/salesforce_rest_api/actions/create-lead/create-lead.mjs @@ -23,14 +23,22 @@ export default { async run({ $ }) { /* eslint-disable no-unused-vars */ const { - salesforce, useAdvancedProps, docsInfo, dateInfo, additionalFields, ...data + salesforce, + getAdvancedProps, + getAdditionalFields, + formatDateTimeProps, + useAdvancedProps, + docsInfo, + dateInfo, + additionalFields, + ...data } = this; /* eslint-enable no-unused-vars */ const response = await salesforce.createLead({ $, data: { ...data, - ...this.getAdditionalFields(), + ...getAdditionalFields(), }, }); $.export("$summary", `Successfully created lead "${this.LastName}"`); diff --git a/components/salesforce_rest_api/actions/create-note/create-note.mjs b/components/salesforce_rest_api/actions/create-note/create-note.mjs index 96f0a1d921880..8bd3fff443d11 100644 --- a/components/salesforce_rest_api/actions/create-note/create-note.mjs +++ b/components/salesforce_rest_api/actions/create-note/create-note.mjs @@ -23,7 +23,11 @@ export default { async run({ $ }) { /* eslint-disable no-unused-vars */ const { - salesforce, docsInfo, ...data + salesforce, + getAdvancedProps, + getAdditionalFields, + formatDateTimeProps, + docsInfo, ...data } = this; /* eslint-enable no-unused-vars */ const response = await salesforce.createNote({ diff --git a/components/salesforce_rest_api/actions/create-opportunity/create-opportunity.mjs b/components/salesforce_rest_api/actions/create-opportunity/create-opportunity.mjs index 25ea1f6e78dd9..6405219a89b55 100644 --- a/components/salesforce_rest_api/actions/create-opportunity/create-opportunity.mjs +++ b/components/salesforce_rest_api/actions/create-opportunity/create-opportunity.mjs @@ -24,17 +24,26 @@ export default { async run({ $ }) { /* eslint-disable no-unused-vars */ const { - salesforce, useAdvancedProps, docsInfo, dateInfo, additionalFields, CloseDate, ...data + salesforce, + getAdvancedProps, + getAdditionalFields, + formatDateTimeProps, + useAdvancedProps, + docsInfo, + dateInfo, + additionalFields, + CloseDate, + ...data } = this; /* eslint-enable no-unused-vars */ const response = await salesforce.createOpportunity({ $, data: { ...data, - ...this.formatDateTimeProps({ + ...formatDateTimeProps({ CloseDate, }), - ...this.getAdditionalFields(), + ...getAdditionalFields(), }, }); $.export("$summary", `Successfully created opportunity "${this.Name}"`); diff --git a/components/salesforce_rest_api/actions/create-task/create-task.mjs b/components/salesforce_rest_api/actions/create-task/create-task.mjs index dcf26c849ab32..b85e5d6c70710 100644 --- a/components/salesforce_rest_api/actions/create-task/create-task.mjs +++ b/components/salesforce_rest_api/actions/create-task/create-task.mjs @@ -26,6 +26,9 @@ export default { /* eslint-disable no-unused-vars */ const { salesforce, + getAdvancedProps, + getAdditionalFields, + formatDateTimeProps, useAdvancedProps, docsInfo, dateInfo, @@ -38,18 +41,18 @@ export default { ...data } = this; /* eslint-enable no-unused-vars */ - const response = await this.salesforce.createTask({ + const response = await salesforce.createTask({ $, data: { ...data, - ...this.formatDateTimeProps({ + ...formatDateTimeProps({ ActivityDate, RecurrenceEndDateOnly, RecurrenceStartDateOnly, ReminderDateTime, }), RecurrenceDayOfWeekMask: RecurrenceDayOfWeekMask?.reduce?.((acc, val) => acc + val, 0), - ...this.getAdditionalFields(), + ...getAdditionalFields(), }, }); $.export("$summary", `Succcessfully created task${this.Subject diff --git a/components/salesforce_rest_api/actions/create-user/create-user.mjs b/components/salesforce_rest_api/actions/create-user/create-user.mjs index 4bd7af207a9c9..c9543e683e0b9 100644 --- a/components/salesforce_rest_api/actions/create-user/create-user.mjs +++ b/components/salesforce_rest_api/actions/create-user/create-user.mjs @@ -1,196 +1,21 @@ -import common from "../common/base.mjs"; -import utils from "../../common/props-utils.mjs"; -import { toSingleLineString } from "../../common/utils.mjs"; +import common, { getProps } from "../common/base.mjs"; +import user from "../../common/sobjects/user.mjs"; -const { salesforce } = common.props; +const docsLink = + "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_user.htm"; export default { ...common, key: "salesforce_rest_api-create-user", name: "Create User", - description: toSingleLineString(` - Creates a Salesforce user. - See [User SObject](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_user.htm) - and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_create.htm) - `), + description: `Creates a Salesforce user. [See the documentation](${docsLink})`, version: "0.1.0", type: "action", - props: { - salesforce, - alias: { - type: "string", - label: "Alias", - description: "Alias of the user. The alias can contain only underscores and alphanumeric characters. It must be unique in your org, not include spaces, not end with a hyphen, and not contain two consecutive hyphens.", - }, - email: { - type: "string", - label: "Email", - description: "The email address of the user.", - }, - emailEncodingKey: { - type: "string", - label: "Email Encoding Key", - description: "The key used to encode the user's email.", - options: [ - "ISO-8859-1", - "UTF-8", - "Shift_JIS", - "EUC-JP", - "ISO-2022-JP", - ], - default: "UTF-8", - }, - languageLocaleKey: { - type: "string", - label: "Language Locale Key", - description: "The user's language locale key.", - async options() { - const fields = await this.salesforce.getFieldsForObjectType("User"); - const { picklistValues } = fields.find(({ name }) => name === "LanguageLocaleKey"); - return picklistValues.map(({ - value, label, - }) => ({ - label, - value, - })); - }, - }, - firstName: { - type: "string", - label: "First Name", - description: "The user's first name.", - optional: true, - }, - lastName: { - type: "string", - label: "Last Name", - description: "The user's last name.", - }, - localeSidKey: { - type: "string", - label: "Locale Sid Key", - description: "The user's locale sid key.", - async options() { - const fields = await this.salesforce.getFieldsForObjectType("User"); - const { picklistValues } = fields.find(({ name }) => name === "LocaleSidKey"); - return picklistValues.map(({ - value, label, - }) => ({ - label, - value, - })); - }, - }, - profileId: { - type: "string", - label: "Profile ID", - description: "The ID of the user's profile.", - async options() { - const { records } = await this.salesforce.query({ - query: "SELECT Id, Name FROM Profile", - }); - return records.map(({ - Id: value, Name: label, - }) => ({ - label, - value, - })); - }, - }, - timeZoneSidKey: { - type: "string", - label: "Time Zone Sid Key", - description: "The user's time zone sid key.", - async options() { - const fields = await this.salesforce.getFieldsForObjectType("User"); - const { picklistValues } = fields.find(({ name }) => name === "TimeZoneSidKey"); - return picklistValues.map(({ - value, label, - }) => ({ - label, - value, - })); - }, - }, - userName: { - type: "string", - label: "User Name", - description: "The user's username. It should be in email format. Eg. `john@acme.com`.", - }, - title: { - type: "string", - label: "Title", - description: "The user's title.", - optional: true, - }, - department: { - type: "string", - label: "Department", - description: "The department the user belongs to.", - optional: true, - }, - division: { - type: "string", - label: "Division", - description: "The division the user belongs to.", - optional: true, - }, - phone: { - type: "string", - label: "Phone", - description: "The user's phone number.", - optional: true, - }, - mobilePhone: { - type: "string", - label: "Mobile Phone", - description: "The user's mobile phone number.", - optional: true, - }, - street: { - type: "string", - label: "Street", - description: "The user's street address.", - optional: true, - }, - city: { - type: "string", - label: "City", - description: "The user's city.", - optional: true, - }, - state: { - type: "string", - label: "State", - description: "The user's state.", - optional: true, - }, - postalCode: { - type: "string", - label: "Postal Code", - description: "The user's postal code.", - optional: true, - }, - country: { - type: "string", - label: "Country", - description: "The user's country.", - optional: true, - }, - userRoleId: { - type: "string", - label: "User Role ID", - description: "The ID of the user's role.", - optional: true, - }, - isActive: { - type: "boolean", - label: "Is Active", - description: "Whether the user is active.", - optional: true, - }, - }, methods: { + ...common.methods, + getAdvancedProps() { + return user.extraProps; + }, createUser(args = {}) { return this.salesforce._makeRequest({ method: "POST", @@ -199,6 +24,11 @@ export default { }); }, }, + props: getProps({ + objType: user, + docsLink, + showDateInfo: true, + }), async run({ $ }) { const { createUser, @@ -207,7 +37,7 @@ export default { const response = await createUser({ $, - data: utils.keysToCapitalCase(data), + data, }); $.export("$summary", `Successfully created user (ID: ${response.id})`); return response; diff --git a/components/salesforce_rest_api/actions/update-account/update-account.mjs b/components/salesforce_rest_api/actions/update-account/update-account.mjs index 5cc85d9b450ac..db46adeb95406 100644 --- a/components/salesforce_rest_api/actions/update-account/update-account.mjs +++ b/components/salesforce_rest_api/actions/update-account/update-account.mjs @@ -40,6 +40,9 @@ export default { /* eslint-disable no-unused-vars */ const { salesforce, + getAdvancedProps, + getAdditionalFields, + formatDateTimeProps, accountId, useAdvancedProps, docsInfo, @@ -53,7 +56,7 @@ export default { id: accountId, data: { ...data, - ...this.getAdditionalFields(), + ...getAdditionalFields(), }, }); $.export( diff --git a/components/salesforce_rest_api/actions/update-contact/update-contact.mjs b/components/salesforce_rest_api/actions/update-contact/update-contact.mjs index c20d888fd4aba..ae02b040a642d 100644 --- a/components/salesforce_rest_api/actions/update-contact/update-contact.mjs +++ b/components/salesforce_rest_api/actions/update-contact/update-contact.mjs @@ -41,6 +41,9 @@ export default { /* eslint-disable no-unused-vars */ const { salesforce, + getAdvancedProps, + getAdditionalFields, + formatDateTimeProps, contactId, useAdvancedProps, docsInfo, @@ -55,10 +58,10 @@ export default { id: contactId, data: { ...data, - ...this.formatDateTimeProps({ + ...formatDateTimeProps({ Birthdate, }), - ...this.getAdditionalFields(), + ...getAdditionalFields(), }, }); $.export( diff --git a/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs b/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs index f0226beb389f6..7e159bd79d5f6 100644 --- a/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs +++ b/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs @@ -41,6 +41,9 @@ export default { /* eslint-disable no-unused-vars */ const { salesforce, + getAdvancedProps, + getAdditionalFields, + formatDateTimeProps, opportunityId, useAdvancedProps, docsInfo, @@ -55,10 +58,10 @@ export default { id: opportunityId, data: { ...data, - ...this.formatDateTimeProps({ + ...formatDateTimeProps({ CloseDate, }), - ...this.getAdditionalFields(), + ...getAdditionalFields(), }, }); $.export("$summary", `Successfully updated opportunity (ID: ${this.OpportunityId})`); From 1c556df9f2549b78b84886d95a7f3e48da52b6f9 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sat, 20 Jul 2024 18:08:54 -0300 Subject: [PATCH 065/106] User entity mapping (big!) + adjustments --- .../common/constants-props.mjs | 957 ++++++++++++++++- .../common/props-async-options.mjs | 50 +- .../common/sobjects/event.mjs | 4 +- .../common/sobjects/lead.mjs | 2 +- .../common/sobjects/task.mjs | 4 +- .../common/sobjects/user.mjs | 967 ++++++++++++++++++ 6 files changed, 1968 insertions(+), 16 deletions(-) create mode 100644 components/salesforce_rest_api/common/sobjects/user.mjs diff --git a/components/salesforce_rest_api/common/constants-props.mjs b/components/salesforce_rest_api/common/constants-props.mjs index 264bbfa92983e..36a151ce7e89e 100644 --- a/components/salesforce_rest_api/common/constants-props.mjs +++ b/components/salesforce_rest_api/common/constants-props.mjs @@ -67,7 +67,7 @@ export const RECURRENCE_MONTH_OPTIONS = [ "December", ]; -export const RECURRENCE_TIMEZONE_OPTIONS = [ +export const TIMEZONE_OPTIONS = [ { label: "(GMT+14:00) Line Islands Time (Pacific/Kiritimati)", value: "Pacific/Kiritimati", @@ -584,3 +584,958 @@ export const RECORD_SOURCE_OPTIONS = [ "Purchased List", "Other", ]; + +export const EMAIL_ENCODING_OPTIONS = [ + { + label: "Unicode (UTF-8)", + value: "UTF-8", + }, + { + label: "General US & Western Europe (ISO-8859-1, ISO-LATIN-1)", + value: "ISO-8859-1", + }, + { + label: "Japanese (Shift-JIS)", + value: "Shift_JIS", + }, + { + label: "Japanese (JIS)", + value: "ISO-2022-JP", + }, + { + label: "Japanese (EUC)", + value: "EUC-JP", + }, + { + label: "Korean (ks_c_5601-1987)", + value: "ks_c_5601-1987", + }, + { + label: "Traditional Chinese (Big5)", + value: "Big5", + }, + { + label: "Simplified Chinese (GB2312)", + value: "GB2312", + }, + { + label: "Traditional Chinese Hong Kong (Big5-HKSCS)", + value: "Big5-HKSCS", + }, + { + label: "Japanese (Shift-JIS_2004)", + value: "x-SJIS_0213", + }, +]; + +export const LANGUAGE_OPTIONS = [ + [ + { + label: "English", + value: "en_US", + }, + { + label: "German", + value: "de", + }, + { + label: "Spanish", + value: "es", + }, + { + label: "French", + value: "fr", + }, + { + label: "Italian", + value: "it", + }, + { + label: "Japanese", + value: "ja", + }, + { + label: "Swedish", + value: "sv", + }, + { + label: "Korean", + value: "ko", + }, + { + label: "Chinese (Traditional)", + value: "zh_TW", + }, + { + label: "Chinese (Simplified)", + value: "zh_CN", + }, + { + label: "Portuguese (Brazil)", + value: "pt_BR", + }, + { + label: "Dutch", + value: "nl_NL", + }, + { + label: "Danish", + value: "da", + }, + { + label: "Thai", + value: "th", + }, + { + label: "Finnish", + value: "fi", + }, + { + label: "Russian", + value: "ru", + }, + { + label: "Spanish (Mexico)", + value: "es_MX", + }, + { + label: "Norwegian", + value: "no", + }, + ], +]; + +export const LOCALE_OPTIONS = [ + { + label: "Afrikaans (South Africa)", + value: "af_ZA", + }, + { + label: "Albanian (Albania)", + value: "sq_AL", + }, + { + label: "Arabic (Algeria)", + value: "ar_DZ", + }, + { + label: "Arabic (Bahrain)", + value: "ar_BH", + }, + { + label: "Arabic (Egypt)", + value: "ar_EG", + }, + { + label: "Arabic (Iraq)", + value: "ar_IQ", + }, + { + label: "Arabic (Jordan)", + value: "ar_JO", + }, + { + label: "Arabic (Kuwait)", + value: "ar_KW", + }, + { + label: "Arabic (Lebanon)", + value: "ar_LB", + }, + { + label: "Arabic (Libya)", + value: "ar_LY", + }, + { + label: "Arabic (Morocco)", + value: "ar_MA", + }, + { + label: "Arabic (Oman)", + value: "ar_OM", + }, + { + label: "Arabic (Qatar)", + value: "ar_QA", + }, + { + label: "Arabic (Saudi Arabia)", + value: "ar_SA", + }, + { + label: "Arabic (Sudan)", + value: "ar_SD", + }, + { + label: "Arabic (Tunisia)", + value: "ar_TN", + }, + { + label: "Arabic (United Arab Emirates)", + value: "ar_AE", + }, + { + label: "Arabic (Yemen)", + value: "ar_YE", + }, + { + label: "Armenian (Armenia)", + value: "hy_AM", + }, + { + label: "Azerbaijani (Azerbaijan)", + value: "az_AZ", + }, + { + label: "Bangla (Bangladesh)", + value: "bn_BD", + }, + { + label: "Bangla (India)", + value: "bn_IN", + }, + { + label: "Basque (Spain)", + value: "eu_ES", + }, + { + label: "Belarusian (Belarus)", + value: "be_BY", + }, + { + label: "Bosnian (Bosnia & Herzegovina)", + value: "bs_BA", + }, + { + label: "Bulgarian (Bulgaria)", + value: "bg_BG", + }, + { + label: "Burmese (Myanmar [Burma])", + value: "my_MM", + }, + { + label: "Catalan (Spain)", + value: "ca_ES", + }, + { + label: "Chinese (China, Pinyin Ordering)", + value: "zh_CN_PINYIN", + }, + { + label: "Chinese (China, Stroke Ordering)", + value: "zh_CN_STROKE", + }, + { + label: "Chinese (China)", + value: "zh_CN", + }, + { + label: "Chinese (Hong Kong SAR China, Stroke Ordering)", + value: "zh_HK_STROKE", + }, + { + label: "Chinese (Hong Kong SAR China)", + value: "zh_HK", + }, + { + label: "Chinese (Macao SAR China)", + value: "zh_MO", + }, + { + label: "Chinese (Singapore)", + value: "zh_SG", + }, + { + label: "Chinese (Taiwan, Stroke Ordering)", + value: "zh_TW_STROKE", + }, + { + label: "Chinese (Taiwan)", + value: "zh_TW", + }, + { + label: "Croatian (Croatia)", + value: "hr_HR", + }, + { + label: "Czech (Czechia)", + value: "cs_CZ", + }, + { + label: "Danish (Denmark)", + value: "da_DK", + }, + { + label: "Dutch (Aruba)", + value: "nl_AW", + }, + { + label: "Dutch (Belgium)", + value: "nl_BE", + }, + { + label: "Dutch (Netherlands)", + value: "nl_NL", + }, + { + label: "Dutch (Suriname)", + value: "nl_SR", + }, + { + label: "Dzongkha (Bhutan)", + value: "dz_BT", + }, + { + label: "English (Antigua & Barbuda)", + value: "en_AG", + }, + { + label: "English (Australia)", + value: "en_AU", + }, + { + label: "English (Bahamas)", + value: "en_BS", + }, + { + label: "English (Barbados)", + value: "en_BB", + }, + { + label: "English (Belize)", + value: "en_BZ", + }, + { + label: "English (Bermuda)", + value: "en_BM", + }, + { + label: "English (Botswana)", + value: "en_BW", + }, + { + label: "English (Cameroon)", + value: "en_CM", + }, + { + label: "English (Canada)", + value: "en_CA", + }, + { + label: "English (Cayman Islands)", + value: "en_KY", + }, + { + label: "English (Eritrea)", + value: "en_ER", + }, + { + label: "English (Eswatini)", + value: "en_SZ", + }, + { + label: "English (Falkland Islands)", + value: "en_FK", + }, + { + label: "English (Fiji)", + value: "en_FJ", + }, + { + label: "English (Gambia)", + value: "en_GM", + }, + { + label: "English (Ghana)", + value: "en_GH", + }, + { + label: "English (Gibraltar)", + value: "en_GI", + }, + { + label: "English (Guyana)", + value: "en_GY", + }, + { + label: "English (Hong Kong SAR China)", + value: "en_HK", + }, + { + label: "English (India)", + value: "en_IN", + }, + { + label: "English (Indonesia)", + value: "en_ID", + }, + { + label: "English (Ireland)", + value: "en_IE", + }, + { + label: "English (Jamaica)", + value: "en_JM", + }, + { + label: "English (Kenya)", + value: "en_KE", + }, + { + label: "English (Liberia)", + value: "en_LR", + }, + { + label: "English (Madagascar)", + value: "en_MG", + }, + { + label: "English (Malawi)", + value: "en_MW", + }, + { + label: "English (Malaysia)", + value: "en_MY", + }, + { + label: "English (Mauritius)", + value: "en_MU", + }, + { + label: "English (Namibia)", + value: "en_NA", + }, + { + label: "English (New Zealand)", + value: "en_NZ", + }, + { + label: "English (Nigeria)", + value: "en_NG", + }, + { + label: "English (Pakistan)", + value: "en_PK", + }, + { + label: "English (Papua New Guinea)", + value: "en_PG", + }, + { + label: "English (Philippines)", + value: "en_PH", + }, + { + label: "English (Rwanda)", + value: "en_RW", + }, + { + label: "English (Samoa)", + value: "en_WS", + }, + { + label: "English (Seychelles)", + value: "en_SC", + }, + { + label: "English (Sierra Leone)", + value: "en_SL", + }, + { + label: "English (Singapore)", + value: "en_SG", + }, + { + label: "English (Sint Maarten)", + value: "en_SX", + }, + { + label: "English (Solomon Islands)", + value: "en_SB", + }, + { + label: "English (South Africa)", + value: "en_ZA", + }, + { + label: "English (St. Helena)", + value: "en_SH", + }, + { + label: "English (Tanzania)", + value: "en_TZ", + }, + { + label: "English (Tonga)", + value: "en_TO", + }, + { + label: "English (Trinidad & Tobago)", + value: "en_TT", + }, + { + label: "English (Uganda)", + value: "en_UG", + }, + { + label: "English (United Kingdom)", + value: "en_GB", + }, + { + label: "English (United States)", + value: "en_US", + }, + { + label: "English (Vanuatu)", + value: "en_VU", + }, + { + label: "Estonian (Estonia)", + value: "et_EE", + }, + { + label: "Finnish (Finland)", + value: "fi_FI", + }, + { + label: "French (Belgium)", + value: "fr_BE", + }, + { + label: "French (Canada)", + value: "fr_CA", + }, + { + label: "French (Comoros)", + value: "fr_KM", + }, + { + label: "French (France)", + value: "fr_FR", + }, + { + label: "French (Guinea)", + value: "fr_GN", + }, + { + label: "French (Haiti)", + value: "fr_HT", + }, + { + label: "French (Luxembourg)", + value: "fr_LU", + }, + { + label: "French (Mauritania)", + value: "fr_MR", + }, + { + label: "French (Monaco)", + value: "fr_MC", + }, + { + label: "French (Switzerland)", + value: "fr_CH", + }, + { + label: "French (Wallis & Futuna)", + value: "fr_WF", + }, + { + label: "Georgian (Georgia)", + value: "ka_GE", + }, + { + label: "German (Austria)", + value: "de_AT", + }, + { + label: "German (Belgium)", + value: "de_BE", + }, + { + label: "German (Germany)", + value: "de_DE", + }, + { + label: "German (Luxembourg)", + value: "de_LU", + }, + { + label: "German (Switzerland)", + value: "de_CH", + }, + { + label: "Greek (Greece)", + value: "el_GR", + }, + { + label: "Gujarati (India)", + value: "gu_IN", + }, + { + label: "Hebrew (Israel)", + value: "iw_IL", + }, + { + label: "Hindi (India)", + value: "hi_IN", + }, + { + label: "Hungarian (Hungary)", + value: "hu_HU", + }, + { + label: "Icelandic (Iceland)", + value: "is_IS", + }, + { + label: "Indonesian (Indonesia)", + value: "in_ID", + }, + { + label: "Irish (Ireland)", + value: "ga_IE", + }, + { + label: "Italian (Italy)", + value: "it_IT", + }, + { + label: "Italian (Switzerland)", + value: "it_CH", + }, + { + label: "Japanese (Japan)", + value: "ja_JP", + }, + { + label: "Kannada (India)", + value: "kn_IN", + }, + { + label: "Kazakh (Kazakhstan)", + value: "kk_KZ", + }, + { + label: "Khmer (Cambodia)", + value: "km_KH", + }, + { + label: "Korean (South Korea)", + value: "ko_KR", + }, + { + label: "Kyrgyz (Kyrgyzstan)", + value: "ky_KG", + }, + { + label: "Lao (Laos)", + value: "lo_LA", + }, + { + label: "Latvian (Latvia)", + value: "lv_LV", + }, + { + label: "Lithuanian (Lithuania)", + value: "lt_LT", + }, + { + label: "Luba-Katanga (Congo - Kinshasa)", + value: "lu_CD", + }, + { + label: "Luxembourgish (Luxembourg)", + value: "lb_LU", + }, + { + label: "Macedonian (North Macedonia)", + value: "mk_MK", + }, + { + label: "Malay (Brunei)", + value: "ms_BN", + }, + { + label: "Malay (Malaysia)", + value: "ms_MY", + }, + { + label: "Malayalam (India)", + value: "ml_IN", + }, + { + label: "Maltese (Malta)", + value: "mt_MT", + }, + { + label: "Marathi (India)", + value: "mr_IN", + }, + { + label: "Montenegrin (Montenegro, USD)", + value: "sh_ME_USD", + }, + { + label: "Montenegrin (Montenegro)", + value: "sh_ME", + }, + { + label: "Nepali (Nepal)", + value: "ne_NP", + }, + { + label: "Norwegian (Norway)", + value: "no_NO", + }, + { + label: "Pashto (Afghanistan)", + value: "ps_AF", + }, + { + label: "Polish (Poland)", + value: "pl_PL", + }, + { + label: "Portuguese (Angola)", + value: "pt_AO", + }, + { + label: "Portuguese (Brazil)", + value: "pt_BR", + }, + { + label: "Portuguese (Cape Verde)", + value: "pt_CV", + }, + { + label: "Portuguese (Mozambique)", + value: "pt_MZ", + }, + { + label: "Portuguese (Portugal)", + value: "pt_PT", + }, + { + label: "Portuguese (São Tomé & Príncipe)", + value: "pt_ST", + }, + { + label: "Romanian (Moldova)", + value: "ro_MD", + }, + { + label: "Romanian (Romania)", + value: "ro_RO", + }, + { + label: "Romansh (Switzerland)", + value: "rm_CH", + }, + { + label: "Rundi (Burundi)", + value: "rn_BI", + }, + { + label: "Russian (Kazakhstan)", + value: "ru_KZ", + }, + { + label: "Russian (Russia)", + value: "ru_RU", + }, + { + label: "Serbian (Cyrillic) (Bosnia and Herzegovina)", + value: "sr_BA", + }, + { + label: "Serbian (Cyrillic) (Serbia)", + value: "sr_CS", + }, + { + label: "Serbian (Latin) (Bosnia and Herzegovina)", + value: "sh_BA", + }, + { + label: "Serbian (Latin) (Serbia)", + value: "sh_CS", + }, + { + label: "Serbian (Serbia)", + value: "sr_RS", + }, + { + label: "Slovak (Slovakia)", + value: "sk_SK", + }, + { + label: "Slovenian (Slovenia)", + value: "sl_SI", + }, + { + label: "Somali (Djibouti)", + value: "so_DJ", + }, + { + label: "Somali (Somalia)", + value: "so_SO", + }, + { + label: "Spanish (Argentina)", + value: "es_AR", + }, + { + label: "Spanish (Bolivia)", + value: "es_BO", + }, + { + label: "Spanish (Chile)", + value: "es_CL", + }, + { + label: "Spanish (Colombia)", + value: "es_CO", + }, + { + label: "Spanish (Costa Rica)", + value: "es_CR", + }, + { + label: "Spanish (Dominican Republic)", + value: "es_DO", + }, + { + label: "Spanish (Ecuador)", + value: "es_EC", + }, + { + label: "Spanish (El Salvador)", + value: "es_SV", + }, + { + label: "Spanish (Guatemala)", + value: "es_GT", + }, + { + label: "Spanish (Honduras)", + value: "es_HN", + }, + { + label: "Spanish (Mexico)", + value: "es_MX", + }, + { + label: "Spanish (Nicaragua)", + value: "es_NI", + }, + { + label: "Spanish (Panama)", + value: "es_PA", + }, + { + label: "Spanish (Paraguay)", + value: "es_PY", + }, + { + label: "Spanish (Peru)", + value: "es_PE", + }, + { + label: "Spanish (Puerto Rico)", + value: "es_PR", + }, + { + label: "Spanish (Spain)", + value: "es_ES", + }, + { + label: "Spanish (United States)", + value: "es_US", + }, + { + label: "Spanish (Uruguay)", + value: "es_UY", + }, + { + label: "Spanish (Venezuela)", + value: "es_VE", + }, + { + label: "Swahili (Kenya)", + value: "sw_KE", + }, + { + label: "Swedish (Sweden)", + value: "sv_SE", + }, + { + label: "Tagalog (Philippines)", + value: "tl_PH", + }, + { + label: "Tajik (Tajikistan)", + value: "tg_TJ", + }, + { + label: "Tamil (India)", + value: "ta_IN", + }, + { + label: "Tamil (Sri Lanka)", + value: "ta_LK", + }, + { + label: "Telugu (India)", + value: "te_IN", + }, + { + label: "Te reo (New Zealand)", + value: "mi_NZ", + }, + { + label: "Thai (Thailand)", + value: "th_TH", + }, + { + label: "Tigrinya (Ethiopia)", + value: "ti_ET", + }, + { + label: "Turkish (Türkiye)", + value: "tr_TR", + }, + { + label: "Ukrainian (Ukraine)", + value: "uk_UA", + }, + { + label: "Urdu (Pakistan)", + value: "ur_PK", + }, + { + label: "Uzbek (Latin, Uzbekistan)", + value: "uz_LATN_UZ", + }, + { + label: "Vietnamese (Vietnam)", + value: "vi_VN", + }, + { + label: "Welsh (United Kingdom)", + value: "cy_GB", + }, + { + label: "Xhosa (South Africa)", + value: "xh_ZA", + }, + { + label: "Yoruba (Benin)", + value: "yo_BJ", + }, + { + label: "Zulu (South Africa)", + value: "zu_ZA", + }, +]; diff --git a/components/salesforce_rest_api/common/props-async-options.mjs b/components/salesforce_rest_api/common/props-async-options.mjs index 7a111b624c553..7757d43f270e3 100644 --- a/components/salesforce_rest_api/common/props-async-options.mjs +++ b/components/salesforce_rest_api/common/props-async-options.mjs @@ -23,6 +23,26 @@ export default { }); }, }, + CallCenterId: { + type: "string", + label: "Call Center ID", + description: "The ID of a Call Center.", + options: async () => { + return this.salesforce.listRecordOptions({ + objType: "CallCenter", + }); + }, + }, + CampaignId: { + type: "string", + label: "Campaign ID", + description: "The ID of a Campaign.", + options: async () => { + return this.salesforce.listRecordOptions({ + objType: "Campaign", + }); + }, + }, CaseId: { type: "string", label: "Case ID", @@ -40,16 +60,6 @@ export default { }); }, }, - CampaignId: { - type: "string", - label: "Campaign ID", - description: "The ID of a Campaign.", - options: async () => { - return this.salesforce.listRecordOptions({ - objType: "Campaign", - }); - }, - }, CommunityId: { type: "string", label: "Community ID", @@ -145,6 +155,16 @@ export default { }); }, }, + ProfileId: { + type: "string", + label: "Profile ID", + description: "The ID of a Profile.", + options: async () => { + return this.salesforce.listRecordOptions({ + objType: "Profile", + }); + }, + }, ServiceContractId: { type: "string", label: "ServiceContract ID", @@ -165,6 +185,16 @@ export default { }); }, }, + UserRoleId: { + type: "string", + label: "User Role ID", + description: "The ID of a User Role record.", + options: async () => { + return this.salesforce.listRecordOptions({ + objType: "UserRole", + }); + }, + }, QuestionId: { type: "string", label: "Question ID", diff --git a/components/salesforce_rest_api/common/sobjects/event.mjs b/components/salesforce_rest_api/common/sobjects/event.mjs index 2d3b1b76acf66..5e1ea0ff2cdd3 100644 --- a/components/salesforce_rest_api/common/sobjects/event.mjs +++ b/components/salesforce_rest_api/common/sobjects/event.mjs @@ -1,5 +1,5 @@ import { // eslint-disable-next-line max-len - RECURRENCE_INSTANCE_OPTIONS, RECURRENCE_MONTH_OPTIONS, RECURRENCE_TIMEZONE_OPTIONS, RECURRENCE_TYPE_OPTIONS, WEEKDAY_MASK_OPTIONS, + RECURRENCE_INSTANCE_OPTIONS, RECURRENCE_MONTH_OPTIONS, TIMEZONE_OPTIONS, RECURRENCE_TYPE_OPTIONS, WEEKDAY_MASK_OPTIONS, } from "../constants-props.mjs"; import commonProps from "../props-async-options.mjs"; @@ -155,7 +155,7 @@ export default { description: "Indicates the time zone associated with a Salesforce Classic recurring event.", optional: true, - options: RECURRENCE_TIMEZONE_OPTIONS, + options: TIMEZONE_OPTIONS, }, RecurrenceType: { type: "string", diff --git a/components/salesforce_rest_api/common/sobjects/lead.mjs b/components/salesforce_rest_api/common/sobjects/lead.mjs index b41c250d9179e..a30dbf758bd28 100644 --- a/components/salesforce_rest_api/common/sobjects/lead.mjs +++ b/components/salesforce_rest_api/common/sobjects/lead.mjs @@ -148,7 +148,7 @@ export default { type: "string", label: "Latitude", description: - "A number between -90 and 90 with up to 15 decimal places. Use with `Longitude` to specify the precise geolocation of a billing address.", + "A number between -90 and 90 with up to 15 decimal places. Use with `Longitude` to specify the precise geolocation of an address.", optional: true, }, Longitude: { diff --git a/components/salesforce_rest_api/common/sobjects/task.mjs b/components/salesforce_rest_api/common/sobjects/task.mjs index 2282d4cf6ab3b..926734530246d 100644 --- a/components/salesforce_rest_api/common/sobjects/task.mjs +++ b/components/salesforce_rest_api/common/sobjects/task.mjs @@ -1,7 +1,7 @@ import { RECURRENCE_INSTANCE_OPTIONS, RECURRENCE_MONTH_OPTIONS, - RECURRENCE_TIMEZONE_OPTIONS, + TIMEZONE_OPTIONS, RECURRENCE_TYPE_OPTIONS, WEEKDAY_MASK_OPTIONS, } from "../constants-props.mjs"; @@ -195,7 +195,7 @@ export default { label: "Recurrence Time Zone", description: "The time zone associated with the recurring task.", optional: true, - options: RECURRENCE_TIMEZONE_OPTIONS, + options: TIMEZONE_OPTIONS, }, RecurrenceType: { type: "string", diff --git a/components/salesforce_rest_api/common/sobjects/user.mjs b/components/salesforce_rest_api/common/sobjects/user.mjs new file mode 100644 index 0000000000000..e5c2b48fb2752 --- /dev/null +++ b/components/salesforce_rest_api/common/sobjects/user.mjs @@ -0,0 +1,967 @@ +import { + EMAIL_ENCODING_OPTIONS, + GEOCODE_ACCURACY_OPTIONS, + LANGUAGE_OPTIONS, + LOCALE_OPTIONS, + TIMEZONE_OPTIONS, +} from "../constants-props.mjs"; +import commonProps from "../props-async-options.mjs"; + +export default { + updateProps: { + UserPreferencesEmailVerified: { + type: "boolean", + label: "Email Verified", + description: + "Indicates whether a user's email address is verified (true) or unverified (false).", + optional: true, + }, + }, + initialProps: { + Alias: { + type: "string", + label: "Alias", + description: "The user's alias.", + }, + CommunityNickname: { + type: "string", + label: "Nickname", + description: + "Name used to identify this user in the Experience Cloud site.", + optional: true, + }, + DefaultGroupNotificationFrequency: { + type: "string", + label: "Default Notification Frequency when Joining Groups", + description: + "The default frequency for sending the user's Chatter group email notifications when the user joins groups.", + optional: true, + options: [ + { + label: "Email on Each Post", + value: "P", + }, + { + label: "Daily Digests", + value: "D", + }, + { + label: "Weekly Digests", + value: "W", + }, + { + label: "Never", + value: "N", + }, + ], + }, + DigestFrequency: { + type: "picklist", + label: "Chatter Email Highlights Frequency", + flags: + "Create, Defaulted on create, Filter, Group, Restricted picklist, Sort, Update", + description: + "The send frequency of the user's Chatter personal email digest.", + options: [ + { + label: "Daily", + value: "D", + }, + { + label: "Weekly", + value: "W", + }, + { + label: "Never", + value: "N", + }, + ], + }, + Email: { + type: "string", + label: "Email", + description: "The user's email address.", + }, + LanguageLocaleKey: { + type: "string", + label: "Language", + description: "The user's language.", + options: LANGUAGE_OPTIONS, + }, + LastName: { + type: "string", + label: "Last Name", + description: "The user's last name.", + }, + LocaleSidKey: { + type: "string", + label: "Locale", + description: + "The locale affects formatting and parsing of values, especially numeric values, in the user interface.", + options: LOCALE_OPTIONS, + }, + ProfileId: { + ...commonProps.ProfileId, + description: + "ID of the user's Profile. Use this value to cache metadata based on profile.", + }, + Username: { + type: "string", + label: "Username", + description: + "Contains the name that a user enters to log in to the API or the user interface. The value for this field must be in the form of an email address, using all lowercase characters. It must also be unique across all organizations.", + }, + UserPermissionsMarketingUser: { + type: "boolean", + label: "Marketing User", + description: + "Indicates whether the user is enabled to manage campaigns in the user interface (true) or not (false).", + }, + UserPermissionsOfflineUser: { + type: "boolean", + label: "Offline User", + description: + "Indicates whether the user is enabled to use Offline Edition (true) or not (false).", + }, + }, + extraProps: { + AboutMe: { + type: "string", + label: "About Me", + description: + "Information about the user, such as areas of interest or skills.", + optional: true, + }, + AccountId: { + ...commonProps.AccountId, + description: "ID of the Account associated with a Customer Portal user.", + optional: true, + }, + CallCenterId: { + ...commonProps.CallCenterId, + description: + "If Salesforce CRM Call Center is enabled, represents the call center that this user is assigned to.", + optional: true, + }, + City: { + type: "string", + label: "City", + description: + "The city associated with the user. Up to 40 characters allowed.", + optional: true, + }, + CompanyName: { + type: "string", + label: "Company Name", + description: "The name of the user's company.", + optional: true, + }, + ContactId: { + ...commonProps.ContactId, + description: "ID of the Contact associated with this account.", + optional: true, + }, + Country: { + type: "string", + label: "Country", + description: + "The country associated with the user. Up to 80 characters allowed.", + optional: true, + }, + CurrentStatus: { + type: "string", + label: "Current Status", + description: "Text that describes what the user is working on.", + optional: true, + }, + DelegatedApproverId: { + ...commonProps.UserId, + label: "Delegated Approver ID", + description: "ID of the user who is a delegated approver for this user.", + optional: true, + }, + Department: { + type: "string", + label: "Department", + description: "The company department associated with the user.", + optional: true, + }, + Division: { + type: "string", + label: "Division", + description: "The division associated with this user.", + optional: true, + }, + EmailEncodingKey: { + type: "string", + label: "Email Encoding", + description: "The email encoding for the user.", + optional: true, + options: EMAIL_ENCODING_OPTIONS, + }, + EmailPreferencesAutoBcc: { + type: "boolean", + label: "Auto Bcc", + description: + "Determines whether the user receives copies of sent emails.", + optional: true, + }, + EmployeeNumber: { + type: "string", + label: "Employee Number", + description: "The user's employee number.", + optional: true, + }, + Extension: { + type: "string", + label: "Extension", + description: "The user's phone extension number.", + optional: true, + }, + Fax: { + type: "string", + label: "Fax", + description: "The user's fax number.", + optional: true, + }, + FederationIdentifier: { + type: "string", + label: "SAML Federation ID", + flags: "Create, Filter, idLookup, Nillable, Sort, Update", + description: + "Indicates the value that must be listed in the Subject element of a Security Assertion Markup Language (SAML) IDP certificate to authenticate the user for a client application using single sign-on.", + optional: true, + }, + FirstName: { + type: "string", + label: "First Name", + description: "The user's first name.", + optional: true, + }, + ForecastEnabled: { + type: "boolean", + label: "Allow Forecasting", + description: "Indicates whether the user is enabled for forecasts.", + optional: true, + }, + GeocodeAccuracy: { + type: "string", + label: "GeocodeAccuracy", + description: + "The level of accuracy of a location's geographical coordinates compared with its physical address.", + optional: true, + options: GEOCODE_ACCURACY_OPTIONS, + }, + IndividualId: { + ...commonProps.IndividualId, + description: "ID of the data privacy record associated with this user.", + optional: true, + }, + IsActive: { + type: "boolean", + label: "Active", + description: "Indicates whether the user has access to log in.", + optional: true, + }, + JigsawImportLimitOverride: { + type: "integer", + label: "Data.com Monthly Addition Limit", + description: + "The Data.com user's monthly addition limit. The value must be between zero and the organization's monthly addition limit.", + optional: true, + }, + Latitude: { + type: "string", + label: "Latitude", + description: + "A number between -90 and 90 with up to 15 decimal places. Use with `Longitude` to specify the precise geolocation of an address.", + optional: true, + }, + Longitude: { + type: "string", + label: "Longitude", + description: + "A number between -180 and 180 with up to 15 decimal places. Use with `Latitude` to specify the precise geolocation of an address.", + optional: true, + }, + ManagerId: { + ...commonProps.UserId, + label: "Manager ID", + description: "The ID of the user who manages this user.", + optional: true, + }, + MiddleName: { + type: "string", + label: "Middle Name", + description: "The user's middle name. Maximum size is 40 characters.", + optional: true, + }, + MobilePhone: { + type: "string", + label: "Mobile", + description: "The user's mobile device number.", + optional: true, + }, + Phone: { + type: "string", + label: "Phone", + description: "The user's phone number.", + optional: true, + }, + PostalCode: { + type: "string", + label: "Zip/Postal Code", + description: "The user's postal or ZIP code.", + optional: true, + }, + ReceivesAdminInfoEmails: { + type: "boolean", + label: "Admin Info Emails", + description: + "Indicates whether the user receives email for administrators from Salesforce (true) or not (false).", + optional: true, + }, + ReceivesInfoEmails: { + type: "boolean", + label: "Info Emails", + description: + "Indicates whether the user receives informational email from Salesforce (true) or not (false).", + optional: true, + }, + SenderEmail: { + type: "string", + label: "Email Sender Address", + description: + "The email address used as the From address when the user sends emails.", + optional: true, + }, + SenderName: { + type: "string", + label: "Email Sender Name", + description: + "The name used as the email sender when the user sends emails.", + optional: true, + }, + Signature: { + type: "string", + label: "Email Signature", + description: "The signature text added to emails.", + optional: true, + }, + State: { + type: "string", + label: "State", + description: + "The state associated with the User. Up to 80 characters allowed.", + optional: true, + }, + Street: { + type: "string", + label: "Street", + description: "The street address associated with the User.", + optional: true, + }, + Suffix: { + type: "string", + label: "Suffix", + description: "The user's name suffix. Maximum size is 40 characters.", + optional: true, + }, + TimeZoneSidKey: { + type: "string", + label: "Time Zone", + description: + "A User time zone affects the offset used when displaying or entering times in the user interface.", + options: TIMEZONE_OPTIONS, + }, + Title: { + type: "string", + label: "Title", + description: "The user's business title, such as Vice President.", + optional: true, + }, + UserRoleId: { + ...commonProps.AccountId, + description: "ID of the user's UserRole.", + optional: true, + }, + UserPermissionsCallCenterAutoLogin: { + type: "boolean", + label: "Auto-login To Call Center", + description: + "Required if Salesforce CRM Call Center is enabled. Indicates whether the user is enabled to use the auto login feature of the call center (true) or not (false).", + optional: true, + }, + UserPermissionsChatterAnswersUser: { + type: "boolean", + label: "Chatter Answers User", + description: + "Indicates whether the portal user is enabled to use the Chatter Answers feature (true) or not (false).", + optional: true, + }, + UserPermissionsInteractionUser: { + type: "boolean", + label: "Flow User", + description: "Indicates whether the user can run flows or not.", + optional: true, + }, + UserPermissionsJigsawProspectingUser: { + type: "boolean", + label: "Data.com User", + description: + "Indicates whether the user is allocated one Data.com user license (true) or not (false).", + optional: true, + }, + UserPermissionsKnowledgeUser: { + type: "boolean", + label: "Knowledge User", + description: + "Indicates whether the user is enabled to use Salesforce Knowledge (true) or not (false).", + optional: true, + }, + UserPermissionsLiveAgentUser: { + type: "boolean", + label: "Live Agent User", + description: + "Indicates whether the user is enabled to use Chat (true) or not (false).", + optional: true, + }, + UserPermissionsSFContentUser: { + type: "boolean", + label: "Salesforce CRM Content User", + description: + "Indicates whether the user is allocated one Salesforce CRM Content User License (true) or not (false).", + optional: true, + }, + UserPermissionsSiteforceContributorUser: { + type: "boolean", + label: "Site.com Contributor User", + description: + "Indicates whether the user is allocated one Site.com Contributor feature license (true) or not (false).", + optional: true, + }, + UserPermissionsSiteforcePublisherUser: { + type: "boolean", + label: "Site.com Publisher User", + description: + "Indicates whether the user is allocated one Site.com Publisher feature license (true) or not (false).", + optional: true, + }, + UserPermissionsSupportUser: { + type: "boolean", + label: "Service Cloud User", + description: "When true, the user can use the Salesforce console.", + optional: true, + }, + UserPermissionsWorkDotComUserFeature: { + type: "boolean", + label: "WDC User", + description: + "Indicates whether the WDC feature is enabled for the user (true) or not (false).", + optional: true, + }, + UserPreferencesActivityRemindersPopup: { + type: "boolean", + label: "ActivityRemindersPopup", + description: + "When true, a reminder window automatically opens when an activity reminder is due. Corresponds to the Trigger alert when reminder comes due checkbox at the Reminders page in the personal settings in the user interface.", + optional: true, + }, + UserPreferencesAllowConversationReminders: { + type: "boolean", + label: "Allow Conversation Reminders", + description: + "When true, voice and call reminders are displayed as notification cards in Lightning Experience. Corresponds to the Show conversation reminders in Lightning Experience checkbox in the Activity Reminders page in the personal settings in the user interface.", + optional: true, + }, + UserPreferencesApexPagesDeveloperMode: { + type: "boolean", + label: "Apex Pages Developer Mode", + description: + "When true, indicates that the user has enabled developer mode for editing Visualforce pages and controllers.", + optional: true, + }, + UserPreferencesAutoForwardCall: { + type: "boolean", + label: "Auto Forward Call", + description: + "When true, the user receives Dialer calls simultaneously in their browser and on their forwarding number.", + optional: true, + }, + UserPreferencesContentEmailAsAndWhen: { + type: "boolean", + label: "Content Email As And When", + description: + "When false, a user with Salesforce CRM Content subscriptions receives a once-daily email summary if activity occurs on the subscribed content, libraries, tags, or authors.", + optional: true, + }, + UserPreferencesContentNoEmail: { + type: "boolean", + label: "Content No Email", + description: + "When false, a user with Salesforce CRM Content subscriptions receives email notifications if activity occurs on the subscribed content, libraries, tags, or authors.", + optional: true, + }, + UserPreferencesEnableAutoSubForFeeds: { + type: "boolean", + label: "Enable Auto Sub For Feeds", + description: + "When true, the user automatically subscribes to feeds for any objects that the user creates.", + optional: true, + }, + UserPreferencesDisableAllFeedsEmail: { + type: "boolean", + label: "Disable All Feeds Email", + description: + "When false, the user automatically receives email for all updates to Chatter feeds, based on the types of feed emails and digests the user has enabled.", + optional: true, + }, + UserPreferencesDisableBookmarkEmail: { + type: "boolean", + label: "Disable Bookmark Email", + description: + "When false, the user automatically receives email every time someone comments on a Chatter feed item after the user has bookmarked it.", + optional: true, + }, + UserPreferencesDisableChangeCommentEmail: { + type: "boolean", + label: "Disable Change Comment Email", + description: + "When false, the user automatically receives email every time someone comments on a change the user has made, such as an update to their profile.", + optional: true, + }, + UserPreferencesDisableEndorsementEmail: { + type: "boolean", + label: "Disable Endorsement Email", + description: + "When false, the member automatically receives email every time someone endorses them for a topic.", + optional: true, + }, + UserPreferencesDisableFileShareNotificationsForApi: { + type: "boolean", + label: "Disable File Share Notifications For Api", + description: + "When false, email notifications are sent from the person who shared the file to the users that the file is shared with.", + optional: true, + }, + UserPreferencesDisableFollowersEmail: { + type: "boolean", + label: "Disable Followers Email", + description: + "When false, the user automatically receives email every time someone starts following the user in Chatter.", + optional: true, + }, + UserPreferencesDisableLaterCommentEmail: { + type: "boolean", + label: "Disable Later Comment Email", + description: + "When false, the user automatically receives email every time someone comments on a feed item after the user has commented on the feed item.", + optional: true, + }, + UserPreferencesDisableLikeEmail: { + type: "boolean", + label: "Disable Like Email", + description: + "When false, the user automatically receives email every time someone likes their post or comment.", + optional: true, + }, + UserPreferencesDisableMentionsPostEmail: { + type: "boolean", + label: "Disable Mentions Post Email", + description: + "When false, the user automatically receives email every time they're mentioned in posts.", + optional: true, + }, + UserPreferencesDisableProfilePostEmail: { + type: "boolean", + label: "Disable Profile Post Email", + description: + "When false, the user automatically receives email every time someone posts to the user's profile.", + optional: true, + }, + UserPreferencesDisableSharePostEmail: { + type: "boolean", + label: "Disable Share Post Email", + description: + "When false, the user automatically receives email every time their post is shared.", + optional: true, + }, + UserPreferencesDisableFeedbackEmail: { + type: "boolean", + label: "Disable Feedback Email", + description: + "When false, the user automatically receives emails related to WDC feedback. The user receives these emails when someone requests or offers feedback, shares feedback with the user, or reminds the user to answer a feedback request.", + optional: true, + }, + UserPreferencesDisCommentAfterLikeEmail: { + type: "boolean", + label: "Dis Comment After Like Email", + description: + "When false, the user automatically receives email every time someone comments on a post that the user liked.", + optional: true, + }, + UserPreferencesDisMentionsCommentEmail: { + type: "boolean", + label: "Dis Mentions Comment Email", + description: + "When false, the user automatically receives email every time the user is mentioned in comments.", + optional: true, + }, + UserPreferencesDisableMessageEmail: { + type: "boolean", + label: "Disable Message Email", + description: + "When false, the user automatically receives email for Chatter messages sent to the user.", + optional: true, + }, + UserPreferencesDisableRewardEmail: { + type: "boolean", + label: "Disable Reward Email", + description: + "When false, the user automatically receives emails related to WDC rewards. The user receives these emails when someone gives a reward to the user.", + optional: true, + }, + UserPreferencesDisableWorkEmail: { + type: "boolean", + label: "Disable Work Email", + description: + "When false, the user receives emails related to WDC feedback, goals, and coaching. The user must also sign up for individual emails listed on the WDC email settings page. When true, the user doesn't receive any emails related to WDC feedback, goals, or coaching even if they're signed up for individual emails.", + optional: true, + }, + UserPreferencesDisProfPostCommentEmail: { + type: "boolean", + label: "Dis Prof Post Comment Email", + description: + "When false, the user automatically receives email every time someone comments on posts on the user's profile.", + optional: true, + }, + UserPreferencesEnableVoiceCallRecording: { + type: "boolean", + label: "EnableVoiceCallRecording", + description: "When true, voice call recording is enabled for the user.", + optional: true, + }, + UserPreferencesEnableVoiceLocalPresence: { + type: "boolean", + label: "EnableVoiceLocalPresence", + description: + "When true, local numbers are shown when the user calls customers with Sales Dialer.", + optional: true, + }, + UserPreferencesEventRemindersCheckboxDefault: { + type: "boolean", + label: "Event Reminders Checkbox Default", + description: + "When true, a reminder popup is automatically set on the user's events. Corresponds to the `By default, set reminder on Events to...` checkbox on the Reminders page in the user interface. This field is related to UserPreference and customizing activity reminders.", + optional: true, + }, + UserPreferencesHideBiggerPhotoCallout: { + type: "boolean", + label: "Hide Bigger Photo Callout", + description: + "When true, users can choose to hide the callout text below the large profile photo.", + optional: true, + }, + UserPreferencesHideChatterOnboardingSplash: { + type: "boolean", + label: "Hide Chatter Onboarding Splash", + description: + "When true, the initial Chatter onboarding prompts don't appear.", + optional: true, + }, + UserPreferencesHideCSNDesktopTask: { + type: "boolean", + label: "Hide CSN Desktop Task", + description: + "When true, the Chatter recommendations panel never displays the recommendation to install Chatter Desktop.", + optional: true, + }, + UserPreferencesHideCSNGetChatterMobileTask: { + type: "boolean", + label: "Hide CSN Get Chatter Mobile Task", + description: + "When true, the Chatter recommendations panel never displays the recommendation to install Chatter Mobile.", + optional: true, + }, + UserPreferencesHideSecondChatterOnboardingSplash: { + type: "boolean", + label: "HideSecondChatterOnboardingSplash", + description: + "When true, the secondary Chatter onboarding prompts don't appear.", + optional: true, + }, + UserPreferencesHideS1BrowserUI: { + type: "boolean", + label: "Hide S1 Browser UI", + description: + "Controls the interface that the user sees when logging in to Salesforce from a supported mobile browser. If false, the user is automatically redirected to the Salesforce mobile web. If true, the user sees the full Salesforce site.", + optional: true, + }, + UserPreferencesHideSfxWelcomeMat: { + type: "boolean", + label: "Hide Sfx Welcome Mat", + description: + "Controls whether a user sees the Lightning Experience new user message. That message welcomes users to the new interface and provides step-by-step instructions that describe how to return to Salesforce Classic.", + optional: true, + }, + UserPreferencesJigsawListUser: { + type: "boolean", + label: "Data.com List User", + description: + "When true, the user is a Data.com List user so shares record additions from a pool.", + optional: true, + }, + UserPreferencesLightningExperiencePreferred: { + type: "boolean", + label: "Lightning Experience Preferred", + description: + "When true, redirects the user to the Lightning Experience interface. Label is Switch to Lightning Experience.", + optional: true, + }, + UserPreferencesLiveAgentMiawSetupDeflection: { + type: "boolean", + label: "Live Agent Miaw Setup Deflection", + description: + "When true, disables the pop-up to deflect users on Chat setup nodes to the Messaging setup. The default value is false.", + optional: true, + }, + UserPreferencesNativeEmailClient: { + type: "boolean", + label: "Native Email Client", + description: + "Use this field to set a default email preference for the user's native email client.", + optional: true, + }, + UserPreferencesOutboundBridge: { + type: "boolean", + label: "Outbound Bridge", + description: + "When true, outbound calls are made through the user's phone.", + optional: true, + }, + UserPreferencesPathAssistantCollapsed: { + type: "boolean", + label: "Path Assistant Collapsed", + description: + "When true, Sales Path appears collapsed or hidden to the user.", + optional: true, + }, + UserPreferencesReceiveNoNotificationsAsApprover: { + type: "boolean", + label: "Receive No Notifications As Approver", + description: + "Controls email notifications from the approval process for approvers. If true, emails are disabled. If false, emails are enabled. The default value is false.", + optional: true, + }, + UserPreferencesReceiveNotificationsAsDelegatedApprover: { + type: "boolean", + label: "Receive Notifications As Delegated Approver", + description: + "Controls email notifications from the approval process for delegated approvers. If true, emails are enabled. If false, emails are disabled. The default value is false.", + optional: true, + }, + UserPreferencesReminderSoundOff: { + type: "boolean", + label: "Reminde Sound Off", + description: + "When true, a sound automatically plays when an activity reminder is due. Corresponds to the `Play a reminder sound` checkbox on the Reminders page in the user interface.", + optional: true, + }, + UserPreferencesShowCityToExternalUsers: { + type: "boolean", + label: "Show City To External Users", + description: + "Indicates the visibility of the city field in the user's contact information. ", + optional: true, + }, + UserPreferencesShowCityToGuestUsers: { + type: "boolean", + label: "Show City To Guest Users", + description: + "Indicates the visibility of the city field in the user's contact information.", + optional: true, + }, + UserPreferencesShowCountryToExternalUsers: { + type: "boolean", + label: "Show Country To External Users", + description: + "Indicates the visibility of the country field in the user's contact information.", + optional: true, + }, + UserPreferencesShowCountryToGuestUsers: { + type: "boolean", + label: "Show Country To Guest Users", + description: + "Indicates the visibility of the country field in the user's contact information.", + optional: true, + }, + UserPreferencesShowEmailToExternalUsers: { + type: "boolean", + label: "Show Email To External Users", + description: + "Indicates the visibility of the email address field in the user's contact information.", + optional: true, + }, + UserPreferencesShowEmailToGuestUsers: { + type: "boolean", + label: "Show Email To Guest Users", + description: + "Indicates the visibility of the email address field in the user's contact information.", + optional: true, + }, + UserPreferencesShowFaxToExternalUsers: { + type: "boolean", + label: "Show Fax To External Users", + description: + "Indicates the visibility of the fax number field in the user's contact information.", + optional: true, + }, + UserPreferencesShowFaxToGuestUsers: { + type: "boolean", + label: "Show Fax To Guest Users", + description: + "Indicates the visibility of the fax number field in the user's contact information.", + optional: true, + }, + UserPreferencesShowManagerToExternalUsers: { + type: "boolean", + label: "Show Manager To External Users", + description: + "Indicates the visibility of the manager field in the user's contact information.", + optional: true, + }, + UserPreferencesShowManagerToGuestUsers: { + type: "boolean", + label: "Show Manager To Guest Users", + description: + "Indicates the visibility of the manager field in the user's contact information..", + optional: true, + }, + UserPreferencesShowMobilePhoneToExternalUsers: { + type: "boolean", + label: "Show Mobile Phone To External Users", + description: + "Indicates the visibility of the mobile device number field in the user's contact information.", + optional: true, + }, + UserPreferencesShowMobilePhoneToGuestUsers: { + type: "boolean", + label: "Show Mobile Phone To Guest Users", + description: + "Indicates the visibility of the mobile phone field in the user's contact information.", + optional: true, + }, + UserPreferencesShowPostalCodeToExternalUsers: { + type: "boolean", + label: "Show Postal Code To External Users", + description: + "Indicates the visibility of the postal or ZIP code field in the user's contact information.", + optional: true, + }, + UserPreferencesShowPostalCodeToGuestUsers: { + type: "boolean", + label: "Show Postal Code To Guest Users", + description: + "Indicates the visibility of the postal or ZIP code field in the user's contact information.", + optional: true, + }, + UserPreferencesShowProfilePicToGuestUsers: { + type: "boolean", + label: "Show Profile Pic To Guest Users", + description: + "Indicates the visibility of the user's profile photo.", + optional: true, + }, + UserPreferencesShowStateToExternalUsers: { + type: "boolean", + label: "Show State To External Users", + description: + "Indicates the visibility of the state field in the user's contact information.", + optional: true, + }, + UserPreferencesShowStateToGuestUsers: { + type: "boolean", + label: "Show State To Guest Users", + description: + "Indicates the visibility of the state field in the user's contact information.", + optional: true, + }, + UserPreferencesShowStreetAddressToExternalUsers: { + type: "boolean", + label: "Show Street Address To External Users", + description: + "Indicates the visibility of the street address field in the user's contact information.", + optional: true, + }, + UserPreferencesShowStreetAddressToGuestUsers: { + type: "boolean", + label: "Show Street Address To Guest Users", + description: + "Indicates the visibility of the street address field in the user's contact information.", + optional: true, + }, + UserPreferencesShowTitleToExternalUsers: { + type: "boolean", + label: "Show Title To External Users", + description: + "Indicates the visibility of the business title field in the user's contact information.", + optional: true, + }, + UserPreferencesShowTitleToGuestUsers: { + type: "boolean", + label: "Show Title To Guest Users", + description: + "Indicates the visibility of the business title field in the user's contact information.", + optional: true, + }, + UserPreferencesShowWorkPhoneToExternalUsers: { + type: "boolean", + label: "Show Work Phone To External Users", + description: + "Indicates the visibility of the work phone number field in the user's contact information.", + optional: true, + }, + UserPreferencesShowWorkPhoneToGuestUsers: { + type: "boolean", + label: "Show Work Phone To Guest Users", + description: + "Indicates the visibility of the work phone field in the user's contact information.", + optional: true, + }, + UserPreferencesSortFeedByComment: { + type: "boolean", + label: "Sort Feed By Comment", + description: + "Specifies the data value used in sorting a user's feed. When true, the feed is sorted by most recent comment activity. When false, the feed is sorted by post date.", + optional: true, + }, + UserPreferencesSuppressEventSFXReminders: { + type: "boolean", + label: "Suppress Event SFX Reminders", + description: + "When true, event reminders don't appear. Corresponds to the Show event reminders in Lightning Experience checkbox on the Activity Reminders page in the user interface.", + optional: true, + }, + UserPreferencesSuppressTaskSFXReminders: { + type: "boolean", + label: "Suppress Task SFX Reminders", + description: + "When true, task reminders don't appear. Corresponds to the `Show task reminders in Lightning Experience.` checkbox on the Activity Reminders page in the user interface.", + optional: true, + }, + UserPreferencesTaskRemindersCheckboxDefault: { + type: "boolean", + label: "Task Reminders Checkbox Default", + description: + "When true, a reminder popup is automatically set on the user's tasks. Corresponds to the `By default, set reminder on Tasks to...` checkbox on the Reminders page in the user interface.", + optional: true, + }, + UserPreferencesUserDebugModePref: { + type: "boolean", + label: "User Debug Mode Pref", + description: + "When true, the Lightning Component framework executes in debug mode for the user. Corresponds to the `Debug Mode` checkbox on the Advanced User Details page of personal settings in the user interface.", + optional: true, + }, + }, +}; From 31a2582ad465c8e581420f3208d2dbab061346d2 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sat, 20 Jul 2024 18:23:46 -0300 Subject: [PATCH 066/106] Create User + adjustments --- .../actions/create-user/create-user.mjs | 19 ++- .../common/constants-props.mjs | 146 +++++++++--------- .../common/sobjects/user.mjs | 7 +- 3 files changed, 89 insertions(+), 83 deletions(-) diff --git a/components/salesforce_rest_api/actions/create-user/create-user.mjs b/components/salesforce_rest_api/actions/create-user/create-user.mjs index c9543e683e0b9..37233a8f20e72 100644 --- a/components/salesforce_rest_api/actions/create-user/create-user.mjs +++ b/components/salesforce_rest_api/actions/create-user/create-user.mjs @@ -9,7 +9,7 @@ export default { key: "salesforce_rest_api-create-user", name: "Create User", description: `Creates a Salesforce user. [See the documentation](${docsLink})`, - version: "0.1.0", + version: "0.1.{{ts}}", type: "action", methods: { ...common.methods, @@ -27,17 +27,28 @@ export default { props: getProps({ objType: user, docsLink, - showDateInfo: true, }), async run({ $ }) { + /* eslint-disable no-unused-vars */ const { + salesforce, createUser, + getAdvancedProps, + getAdditionalFields, + formatDateTimeProps, + useAdvancedProps, + docsInfo, + dateInfo, + additionalFields, ...data } = this; - + /* eslint-enable no-unused-vars */ const response = await createUser({ $, - data, + data: { + ...data, + ...getAdditionalFields(), + }, }); $.export("$summary", `Successfully created user (ID: ${response.id})`); return response; diff --git a/components/salesforce_rest_api/common/constants-props.mjs b/components/salesforce_rest_api/common/constants-props.mjs index 36a151ce7e89e..db777f8190e68 100644 --- a/components/salesforce_rest_api/common/constants-props.mjs +++ b/components/salesforce_rest_api/common/constants-props.mjs @@ -629,80 +629,78 @@ export const EMAIL_ENCODING_OPTIONS = [ ]; export const LANGUAGE_OPTIONS = [ - [ - { - label: "English", - value: "en_US", - }, - { - label: "German", - value: "de", - }, - { - label: "Spanish", - value: "es", - }, - { - label: "French", - value: "fr", - }, - { - label: "Italian", - value: "it", - }, - { - label: "Japanese", - value: "ja", - }, - { - label: "Swedish", - value: "sv", - }, - { - label: "Korean", - value: "ko", - }, - { - label: "Chinese (Traditional)", - value: "zh_TW", - }, - { - label: "Chinese (Simplified)", - value: "zh_CN", - }, - { - label: "Portuguese (Brazil)", - value: "pt_BR", - }, - { - label: "Dutch", - value: "nl_NL", - }, - { - label: "Danish", - value: "da", - }, - { - label: "Thai", - value: "th", - }, - { - label: "Finnish", - value: "fi", - }, - { - label: "Russian", - value: "ru", - }, - { - label: "Spanish (Mexico)", - value: "es_MX", - }, - { - label: "Norwegian", - value: "no", - }, - ], + { + label: "English", + value: "en_US", + }, + { + label: "German", + value: "de", + }, + { + label: "Spanish", + value: "es", + }, + { + label: "French", + value: "fr", + }, + { + label: "Italian", + value: "it", + }, + { + label: "Japanese", + value: "ja", + }, + { + label: "Swedish", + value: "sv", + }, + { + label: "Korean", + value: "ko", + }, + { + label: "Chinese (Traditional)", + value: "zh_TW", + }, + { + label: "Chinese (Simplified)", + value: "zh_CN", + }, + { + label: "Portuguese (Brazil)", + value: "pt_BR", + }, + { + label: "Dutch", + value: "nl_NL", + }, + { + label: "Danish", + value: "da", + }, + { + label: "Thai", + value: "th", + }, + { + label: "Finnish", + value: "fi", + }, + { + label: "Russian", + value: "ru", + }, + { + label: "Spanish (Mexico)", + value: "es_MX", + }, + { + label: "Norwegian", + value: "no", + }, ]; export const LOCALE_OPTIONS = [ diff --git a/components/salesforce_rest_api/common/sobjects/user.mjs b/components/salesforce_rest_api/common/sobjects/user.mjs index e5c2b48fb2752..28a497bb119db 100644 --- a/components/salesforce_rest_api/common/sobjects/user.mjs +++ b/components/salesforce_rest_api/common/sobjects/user.mjs @@ -56,10 +56,8 @@ export default { ], }, DigestFrequency: { - type: "picklist", + type: "string", label: "Chatter Email Highlights Frequency", - flags: - "Create, Defaulted on create, Filter, Group, Restricted picklist, Sort, Update", description: "The send frequency of the user's Chatter personal email digest.", options: [ @@ -227,7 +225,6 @@ export default { FederationIdentifier: { type: "string", label: "SAML Federation ID", - flags: "Create, Filter, idLookup, Nillable, Sort, Update", description: "Indicates the value that must be listed in the Subject element of a Security Assertion Markup Language (SAML) IDP certificate to authenticate the user for a client application using single sign-on.", optional: true, @@ -246,7 +243,7 @@ export default { }, GeocodeAccuracy: { type: "string", - label: "GeocodeAccuracy", + label: "Geocode Accuracy", description: "The level of accuracy of a location's geographical coordinates compared with its physical address.", optional: true, From 8270583b9ce7663147269eadb6478c9218d7e0a5 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sat, 20 Jul 2024 18:38:35 -0300 Subject: [PATCH 067/106] Adjustments on user props --- .../common/sobjects/user.mjs | 85 ++++++++++--------- 1 file changed, 44 insertions(+), 41 deletions(-) diff --git a/components/salesforce_rest_api/common/sobjects/user.mjs b/components/salesforce_rest_api/common/sobjects/user.mjs index 28a497bb119db..0c424ca2eba59 100644 --- a/components/salesforce_rest_api/common/sobjects/user.mjs +++ b/components/salesforce_rest_api/common/sobjects/user.mjs @@ -21,39 +21,13 @@ export default { Alias: { type: "string", label: "Alias", - description: "The user's alias.", + description: "The user's alias (max 8 characters).", }, CommunityNickname: { type: "string", label: "Nickname", description: "Name used to identify this user in the Experience Cloud site.", - optional: true, - }, - DefaultGroupNotificationFrequency: { - type: "string", - label: "Default Notification Frequency when Joining Groups", - description: - "The default frequency for sending the user's Chatter group email notifications when the user joins groups.", - optional: true, - options: [ - { - label: "Email on Each Post", - value: "P", - }, - { - label: "Daily Digests", - value: "D", - }, - { - label: "Weekly Digests", - value: "W", - }, - { - label: "Never", - value: "N", - }, - ], }, DigestFrequency: { type: "string", @@ -80,6 +54,12 @@ export default { label: "Email", description: "The user's email address.", }, + EmailEncodingKey: { + type: "string", + label: "Email Encoding", + description: "The email encoding for the user.", + options: EMAIL_ENCODING_OPTIONS, + }, LanguageLocaleKey: { type: "string", label: "Language", @@ -102,6 +82,18 @@ export default { ...commonProps.ProfileId, description: "ID of the user's Profile. Use this value to cache metadata based on profile.", + async options() { + return this.salesforce.listRecordOptions({ + objType: "Profile", + }); + }, + }, + TimeZoneSidKey: { + type: "string", + label: "Time Zone", + description: + "A User time zone affects the offset used when displaying or entering times in the user interface.", + options: TIMEZONE_OPTIONS, }, Username: { type: "string", @@ -172,6 +164,31 @@ export default { description: "Text that describes what the user is working on.", optional: true, }, + DefaultGroupNotificationFrequency: { + type: "string", + label: "Default Notification Frequency when Joining Groups", + description: + "The default frequency for sending the user's Chatter group email notifications when the user joins groups.", + optional: true, + options: [ + { + label: "Email on Each Post", + value: "P", + }, + { + label: "Daily Digests", + value: "D", + }, + { + label: "Weekly Digests", + value: "W", + }, + { + label: "Never", + value: "N", + }, + ], + }, DelegatedApproverId: { ...commonProps.UserId, label: "Delegated Approver ID", @@ -190,13 +207,6 @@ export default { description: "The division associated with this user.", optional: true, }, - EmailEncodingKey: { - type: "string", - label: "Email Encoding", - description: "The email encoding for the user.", - optional: true, - options: EMAIL_ENCODING_OPTIONS, - }, EmailPreferencesAutoBcc: { type: "boolean", label: "Auto Bcc", @@ -364,13 +374,6 @@ export default { description: "The user's name suffix. Maximum size is 40 characters.", optional: true, }, - TimeZoneSidKey: { - type: "string", - label: "Time Zone", - description: - "A User time zone affects the offset used when displaying or entering times in the user interface.", - options: TIMEZONE_OPTIONS, - }, Title: { type: "string", label: "Title", From 394c77a740345e9742ee5f5f86d1ef5ac912d8c2 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sat, 20 Jul 2024 21:18:32 -0300 Subject: [PATCH 068/106] Create attachment + adjustments --- .../create-attachment/create-attachment.mjs | 88 ++++++++----------- .../common/sobjects/attachment.mjs | 7 +- 2 files changed, 43 insertions(+), 52 deletions(-) diff --git a/components/salesforce_rest_api/actions/create-attachment/create-attachment.mjs b/components/salesforce_rest_api/actions/create-attachment/create-attachment.mjs index 029c864213d15..868d8bf5bda5f 100644 --- a/components/salesforce_rest_api/actions/create-attachment/create-attachment.mjs +++ b/components/salesforce_rest_api/actions/create-attachment/create-attachment.mjs @@ -1,63 +1,51 @@ -import common from "../common/base.mjs"; +import common, { getProps } from "../common/base.mjs"; import attachment from "../../common/sobjects/attachment.mjs"; -import { - pickBy, pick, -} from "lodash-es"; -import { toSingleLineString } from "../../common/utils.mjs"; +import fs from "fs"; -const { salesforce } = common.props; +const docsLink = "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_attachment.htm"; + +/* eslint-disable no-unused-vars */ +const { + useAdvancedProps, ...props +} = getProps({ + objType: attachment, + docsLink, +}); +/* eslint-enable no-unused-vars */ export default { ...common, key: "salesforce_rest_api-create-attachment", name: "Create Attachment", - description: toSingleLineString(` - Creates an attachment, which represents a file that a User has uploaded and attached to a parent object. - See [Attachment SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_attachment.htm) - and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm) - `), - version: "0.4.0", + description: `Creates an Attachment on a parent object. [See the documentation](${docsLink})`, + version: "0.4.{{ts}}", type: "action", - props: { - salesforce, - Body: { - type: "string", - label: "Body", - description: "Encoded file data.", - }, - Name: { - type: "string", - label: "Name", - description: "Name of the attached file. Maximum size is 255 characters.", - }, - ParentId: { - type: "string", - label: "Parent ID", - description: "ID of the parent object of the attachment. The following objects are supported as parents of attachments:\n* Account\n* Asset\n* Campaign\n* Case\n* Contact\n* Contract\n* Custom objects\n* EmailMessage\n* EmailTemplate\n* Event\n* Lead\n* Opportunity\n* Product2\n* Solution\n* Task", - }, - selector: { - propDefinition: [ - salesforce, - "fieldSelector", - ], - description: `${salesforce.propDefinitions.fieldSelector.description} Attachment`, - options: () => Object.keys(attachment), - reloadProps: true, - }, - }, - additionalProps() { - return this.additionalProps(this.selector, attachment); - }, + props, async run({ $ }) { - const data = pickBy(pick(this, [ - "Body", - "Name", - "ParentId", - ...this.selector, - ])); - const response = await this.salesforce.createAttachment({ + /* eslint-disable no-unused-vars */ + const { + salesforce, + getAdvancedProps, + getAdditionalFields, + formatDateTimeProps, + docsInfo, + filePathOrContent, + ...data + } = this; + /* eslint-enable no-unused-vars */ + + const body = filePathOrContent.includes("tmp/") + ? fs.createReadStream(filePathOrContent, { + encoding: "base64 ", + }) + : filePathOrContent; + + const response = await salesforce.createAttachment({ $, - data, + data: { + Body: body, + ...data, + }, }); $.export("$summary", `Successfully created attachment "${this.Name}"`); return response; diff --git a/components/salesforce_rest_api/common/sobjects/attachment.mjs b/components/salesforce_rest_api/common/sobjects/attachment.mjs index a7b997c84f329..26947ce451234 100644 --- a/components/salesforce_rest_api/common/sobjects/attachment.mjs +++ b/components/salesforce_rest_api/common/sobjects/attachment.mjs @@ -38,8 +38,6 @@ export default { description: "Description of the attachment. Max 500 characters.", optional: true, }, - }, - extraProps: { IsPrivate: { type: "boolean", label: "Private", @@ -51,6 +49,11 @@ export default { label: "Owner ID", description: "ID of the user who owns the attachment.", optional: true, + async options () { + return this.salesforce.listRecordOptions({ + objType: "User", + }); + }, }, }, }; From e0df96b11656e71bc767667dca9046fbe795f789 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sat, 20 Jul 2024 22:14:10 -0300 Subject: [PATCH 069/106] Add Contact to Campaign adjustments --- .../add-contact-to-campaign.mjs | 63 ++++++++----------- 1 file changed, 27 insertions(+), 36 deletions(-) diff --git a/components/salesforce_rest_api/actions/add-contact-to-campaign/add-contact-to-campaign.mjs b/components/salesforce_rest_api/actions/add-contact-to-campaign/add-contact-to-campaign.mjs index 240302cce6dd2..c8389a475d70a 100644 --- a/components/salesforce_rest_api/actions/add-contact-to-campaign/add-contact-to-campaign.mjs +++ b/components/salesforce_rest_api/actions/add-contact-to-campaign/add-contact-to-campaign.mjs @@ -1,52 +1,43 @@ -import salesForceRestApi from "../../salesforce_rest_api.app.mjs"; -import { toSingleLineString } from "../../common/utils.mjs"; +import salesforce from "../../salesforce_rest_api.app.mjs"; import constants from "../../common/constants.mjs"; +import commonProps from "../../common/props-async-options.mjs"; export default { key: "salesforce_rest_api-add-contact-to-campaign", name: "Add Contact to Campaign", - description: toSingleLineString(` - Adds an existing contact to an existing campaign. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_campaignmember.htm) - `), - version: "0.1.0", + description: "Adds an existing contact to an existing campaign. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_campaignmember.htm)", + version: "0.1.{{ts}}", type: "action", props: { - salesForceRestApi, - campaignId: { - propDefinition: [ - salesForceRestApi, - "sobjectId", - () => ({ - objectType: constants.OBJECT_TYPE.CAMPAIGN, - }), - ], - label: "Campaign ID", + salesforce, + CampaignId: { + ...commonProps.CampaignId, description: "The Campaign to add a Contact to.", + async options() { + return this.salesforce.listRecordOptions({ + objType: "Campaign", + }); + }, }, - contactId: { - propDefinition: [ - salesForceRestApi, - "sobjectId", - () => ({ - objectType: constants.OBJECT_TYPE.CONTACT, - }), - ], - label: "Contact ID", + ContactId: { + ...commonProps.ContactId, description: "The Contact to add to the selected Campaign.", + async options() { + return this.salesforce.listRecordOptions({ + objType: "Contact", + }); + }, }, }, async run({ $ }) { - const data = { - CampaignId: this.campaignId, - ContactId: this.contactId, - }; - const response = await this.salesForceRestApi.createObject( - { - $, - objectType: constants.OBJECT_TYPE.CAMPAIGN_MEMBER, - data, - }, - ); + const { + salesforce, ...data + } = this; + const response = await salesforce.createObject({ + $, + objectType: constants.OBJECT_TYPE.CAMPAIGN_MEMBER, + data, + }); $.export("$summary", "Successfully added contact to campaign"); return response; }, From 75b87be58ed4c7572db24d70aa68f6b305a99750 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sun, 21 Jul 2024 01:45:04 -0300 Subject: [PATCH 070/106] SOQL and SOSL search action updates --- .../actions/soql-search/soql-search.mjs | 19 ++++++++++------- .../actions/sosl-search/sosl-search.mjs | 21 +++++++++++-------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/components/salesforce_rest_api/actions/soql-search/soql-search.mjs b/components/salesforce_rest_api/actions/soql-search/soql-search.mjs index e3a0bac5774e3..4c549f304357d 100644 --- a/components/salesforce_rest_api/actions/soql-search/soql-search.mjs +++ b/components/salesforce_rest_api/actions/soql-search/soql-search.mjs @@ -1,21 +1,24 @@ -import { toSingleLineString } from "../../common/utils.mjs"; import salesforce from "../../salesforce_rest_api.app.mjs"; +const docsLink = "https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_examples.htm"; + export default { key: "salesforce_rest_api-soql-search", - name: "SOQL Search", - description: toSingleLineString(` - Executes a SOQL query. - See [docs](https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql.htm) - `), - version: "0.3.0", + name: "SOQL Query (Object Query)", + description: `Executes a [Salesforce Object Query Language (SOQL)](${docsLink}) query-based, SQL-like search.`, + version: "0.3.{{ts}}", type: "action", props: { salesforce, + exampleInfo: { + type: "alert", + alertType: "info", + content: "Example query: `SELECT Id, Name, BillingCity FROM Account`", + }, query: { type: "string", label: "SOQL Query", - description: "A SOQL search query", + description: `A SOQL search query. [See the documentation](${docsLink}) for examples and more information.`, }, }, async run({ $ }) { diff --git a/components/salesforce_rest_api/actions/sosl-search/sosl-search.mjs b/components/salesforce_rest_api/actions/sosl-search/sosl-search.mjs index 1b1dc8e4c34ef..2d5c13e7601d3 100644 --- a/components/salesforce_rest_api/actions/sosl-search/sosl-search.mjs +++ b/components/salesforce_rest_api/actions/sosl-search/sosl-search.mjs @@ -1,21 +1,24 @@ import salesforce from "../../salesforce_rest_api.app.mjs"; -import { toSingleLineString } from "../../common/utils.mjs"; + +const docsLink = "https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_sosl_examples.htm"; export default { key: "salesforce_rest_api-sosl-search", - name: "SOSL Search", - description: toSingleLineString(` - Executes the specified SOSL search. - See [docs](https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_sosl.htm) - `), - version: "0.3.0", + name: "SOSL Search (Object Search)", + description: `Executes a [Salesforce Object Search Language (SOSL)](${docsLink}) text-based search query.`, + version: "0.3.{{ts}}", type: "action", props: { salesforce, + exampleInfo: { + type: "alert", + alertType: "info", + content: "Example query: `FIND {Joe Smith} IN Name Fields RETURNING lead(name, phone)`", + }, search: { type: "string", label: "SOSL Query", - description: "A SOSL search query", + description: `A SOSL search query. [See the documentation](${docsLink}) for examples and more information.`, }, }, async run({ $ }) { @@ -23,7 +26,7 @@ export default { $, search: this.search, }); - $.export("$summary", `Successfully returned ${response.length} results for SOSL search`); + $.export("$summary", `Successfully returned ${response.searchRecords} results for SOSL search`); return response; }, }; From 325519038eadce44924db4b85feb6aac70ceb372 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sun, 21 Jul 2024 01:50:22 -0300 Subject: [PATCH 071/106] Extra docs info box for SOSL and SOQL --- .../actions/soql-search/soql-search.mjs | 2 ++ .../actions/sosl-search/sosl-search.mjs | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/components/salesforce_rest_api/actions/soql-search/soql-search.mjs b/components/salesforce_rest_api/actions/soql-search/soql-search.mjs index 4c549f304357d..fcb6fed8b09f6 100644 --- a/components/salesforce_rest_api/actions/soql-search/soql-search.mjs +++ b/components/salesforce_rest_api/actions/soql-search/soql-search.mjs @@ -1,4 +1,5 @@ import salesforce from "../../salesforce_rest_api.app.mjs"; +import { docsInfo } from "../sosl-search/sosl-search.mjs"; const docsLink = "https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_examples.htm"; @@ -10,6 +11,7 @@ export default { type: "action", props: { salesforce, + docsInfo, exampleInfo: { type: "alert", alertType: "info", diff --git a/components/salesforce_rest_api/actions/sosl-search/sosl-search.mjs b/components/salesforce_rest_api/actions/sosl-search/sosl-search.mjs index 2d5c13e7601d3..a123960fd36aa 100644 --- a/components/salesforce_rest_api/actions/sosl-search/sosl-search.mjs +++ b/components/salesforce_rest_api/actions/sosl-search/sosl-search.mjs @@ -2,6 +2,12 @@ import salesforce from "../../salesforce_rest_api.app.mjs"; const docsLink = "https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_sosl_examples.htm"; +export const docsInfo = { + type: "alert", + alertType: "info", + content: "You can find helpful information on SOQL and SOSL in [the Salesforce documentation](https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_sosl_intro.htm).", +}; + export default { key: "salesforce_rest_api-sosl-search", name: "SOSL Search (Object Search)", @@ -10,10 +16,11 @@ export default { type: "action", props: { salesforce, + docsInfo, exampleInfo: { type: "alert", alertType: "info", - content: "Example query: `FIND {Joe Smith} IN Name Fields RETURNING lead(name, phone)`", + content: "Example search: `FIND {Joe Smith} IN Name Fields RETURNING lead(name, phone)`", }, search: { type: "string", From e666e5ff0bfc9290f46cb5cb35b48c937c85f6f6 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sun, 21 Jul 2024 01:58:47 -0300 Subject: [PATCH 072/106] Add Lead to Campaign + improvements --- .../add-contact-to-campaign.mjs | 13 ++-- .../add-lead-to-campaign.mjs | 60 +++++++++---------- .../common/props-async-options.mjs | 10 ++++ 3 files changed, 45 insertions(+), 38 deletions(-) diff --git a/components/salesforce_rest_api/actions/add-contact-to-campaign/add-contact-to-campaign.mjs b/components/salesforce_rest_api/actions/add-contact-to-campaign/add-contact-to-campaign.mjs index c8389a475d70a..f03242d75cdd3 100644 --- a/components/salesforce_rest_api/actions/add-contact-to-campaign/add-contact-to-campaign.mjs +++ b/components/salesforce_rest_api/actions/add-contact-to-campaign/add-contact-to-campaign.mjs @@ -10,7 +10,7 @@ export default { type: "action", props: { salesforce, - CampaignId: { + campaignId: { ...commonProps.CampaignId, description: "The Campaign to add a Contact to.", async options() { @@ -19,7 +19,7 @@ export default { }); }, }, - ContactId: { + contactId: { ...commonProps.ContactId, description: "The Contact to add to the selected Campaign.", async options() { @@ -31,14 +31,17 @@ export default { }, async run({ $ }) { const { - salesforce, ...data + salesforce, campaignId, contactId, } = this; const response = await salesforce.createObject({ $, objectType: constants.OBJECT_TYPE.CAMPAIGN_MEMBER, - data, + data: { + CampaignId: campaignId, + ContactId: contactId, + }, }); - $.export("$summary", "Successfully added contact to campaign"); + $.export("$summary", `Successfully added contact (ID: ${contactId}) to campaign (ID: ${campaignId})`); return response; }, }; diff --git a/components/salesforce_rest_api/actions/add-lead-to-campaign/add-lead-to-campaign.mjs b/components/salesforce_rest_api/actions/add-lead-to-campaign/add-lead-to-campaign.mjs index efb0f9e019b38..206d789d9f98e 100644 --- a/components/salesforce_rest_api/actions/add-lead-to-campaign/add-lead-to-campaign.mjs +++ b/components/salesforce_rest_api/actions/add-lead-to-campaign/add-lead-to-campaign.mjs @@ -1,53 +1,47 @@ -import salesForceRestApi from "../../salesforce_rest_api.app.mjs"; -import { toSingleLineString } from "../../common/utils.mjs"; +import salesforce from "../../salesforce_rest_api.app.mjs"; import constants from "../../common/constants.mjs"; +import commonProps from "../../common/props-async-options.mjs"; export default { key: "salesforce_rest_api-add-lead-to-campaign", name: "Add Lead to Campaign", - description: toSingleLineString(` - Adds an existing lead to an existing campaign. - See [Event SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_campaignmember.htm) - and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm) - `), + description: "Adds an existing lead to an existing campaign. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_campaignmember.htm)", version: "0.1.0", type: "action", props: { - salesForceRestApi, + salesforce, campaignId: { - propDefinition: [ - salesForceRestApi, - "sobjectId", - () => ({ - objectType: constants.OBJECT_TYPE.CAMPAIGN, - }), - ], - label: "Campaign ID", - description: "ID of the Campaign to which this Lead is associated.", + ...commonProps.CampaignId, + description: "The Campaign to add a Lead to.", + async options() { + return this.salesforce.listRecordOptions({ + objType: "Campaign", + }); + }, }, leadId: { - propDefinition: [ - salesForceRestApi, - "sobjectId", - () => ({ - objectType: constants.OBJECT_TYPE.LEAD, - }), - ], - label: "Lead ID", - description: "ID of the Lead who is associated with a Campaign.", + ...commonProps.LeadId, + description: "The Lead to add to the selected Campaign.", + async options() { + return this.salesforce.listRecordOptions({ + objType: "Lead", + }); + }, }, }, async run({ $ }) { - const data = { - CampaignId: this.campaignId, - LeadId: this.leadId, - }; - const response = await this.salesForceRestApi.createObject({ + const { + salesforce, campaignId, leadId, + } = this; + const response = await salesforce.createObject({ $, objectType: constants.OBJECT_TYPE.CAMPAIGN_MEMBER, - data, + data: { + CampaignId: campaignId, + LeadId: leadId, + }, }); - $.export("$summary", "Successfully added lead to campaign"); + $.export("$summary", `Successfully added lead (ID: ${leadId}) to campaign (ID: ${campaignId})`); return response; }, }; diff --git a/components/salesforce_rest_api/common/props-async-options.mjs b/components/salesforce_rest_api/common/props-async-options.mjs index 7757d43f270e3..58cb0e6f7241b 100644 --- a/components/salesforce_rest_api/common/props-async-options.mjs +++ b/components/salesforce_rest_api/common/props-async-options.mjs @@ -125,6 +125,16 @@ export default { }); }, }, + LeadId: { + type: "string", + label: "Lead ID", + description: "The ID of a Lead.", + options: async () => { + return this.salesforce.listRecordOptions({ + objType: "Lead", + }); + }, + }, OperatingHoursId: { type: "string", label: "Operating Hours ID", From dcdfc5d920554864e6e5f783e3e0758b39e2e034 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sun, 21 Jul 2024 02:50:42 -0300 Subject: [PATCH 073/106] Delete Record refactoring --- .../actions/delete-record/delete-record.mjs | 20 +++++------ .../salesforce_rest_api.app.mjs | 33 +++++++++++++++++-- 2 files changed, 41 insertions(+), 12 deletions(-) diff --git a/components/salesforce_rest_api/actions/delete-record/delete-record.mjs b/components/salesforce_rest_api/actions/delete-record/delete-record.mjs index 020afebfec1b9..38ec6e0dbc7ba 100644 --- a/components/salesforce_rest_api/actions/delete-record/delete-record.mjs +++ b/components/salesforce_rest_api/actions/delete-record/delete-record.mjs @@ -2,10 +2,10 @@ import salesForceRestApi from "../../salesforce_rest_api.app.mjs"; export default { key: "salesforce_rest_api-delete-record", - name: "Delete a Record in an Object", + name: "Delete Record", description: - "Deletes an existing record in an object. [API Doc](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_query.htm)", - version: "0.2.0", + "Deletes an existing record in an object. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_sobject_retrieve_delete.htm)", + version: "0.2.{{ts}}", type: "action", props: { salesForceRestApi, @@ -15,29 +15,29 @@ export default { "objectType", ], }, - sobjectId: { + recordId: { propDefinition: [ salesForceRestApi, - "sobjectId", + "recordId", (c) => ({ - objectType: c.sobjectType, + objType: c.sobjectType, }), ], description: - "ID of the Salesforce standard object to get field values from.", + "The record to delete.", }, }, async run({ $ }) { const { sobjectType, - sobjectId, + recordId, } = this; const response = await this.salesForceRestApi.deleteObject({ $, sobjectType, - sobjectId, + recordId, }); - response && $.export("$summary", `Successfully deleted record (ID: ${sobjectId})`); + $.export("$summary", `Successfully deleted record (ID: ${recordId})`); return response; }, }; diff --git a/components/salesforce_rest_api/salesforce_rest_api.app.mjs b/components/salesforce_rest_api/salesforce_rest_api.app.mjs index 8d2c6193bd4b1..7a407bdd79fda 100644 --- a/components/salesforce_rest_api/salesforce_rest_api.app.mjs +++ b/components/salesforce_rest_api/salesforce_rest_api.app.mjs @@ -38,6 +38,35 @@ export default { return sobjects.filter(filter).map(mapper); }, }, + recordId: { + type: "string", + label: "Record ID", + description: "The ID of the record of the selected object type.", + async options({ + objType, + fields, + getLabel, + }) { + let response; + try { + console.log("first request attempt"); + response = await this.listRecordOptions({ + objType, + fields, + getLabel, + }); + } catch (err) { + response = await this.listRecordOptions({ + objType, + fields: [ + "Id", + ], + getLabel: (item) => `ID ${item.Id}`, + }); + } + return response; + }, + }, field: { type: "string", label: "Field", @@ -249,9 +278,9 @@ export default { }); }, async deleteObject({ - objectType, sobjectId, ...args + sobjectType, recordId, ...args }) { - const url = `${this._sObjectsApiUrl()}/${objectType}/${sobjectId}`; + const url = `${this._sObjectsApiUrl()}/${sobjectType}/${recordId}`; return this._makeRequest({ url, method: "DELETE", From 18a730e6b8c892cc57b2fb824634fdf690c9d928 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sun, 21 Jul 2024 02:58:56 -0300 Subject: [PATCH 074/106] Delete Opportunity update --- .../delete-opportunity/delete-opportunity.mjs | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/components/salesforce_rest_api/actions/delete-opportunity/delete-opportunity.mjs b/components/salesforce_rest_api/actions/delete-opportunity/delete-opportunity.mjs index 751fe24f8402b..c142d1f800225 100644 --- a/components/salesforce_rest_api/actions/delete-opportunity/delete-opportunity.mjs +++ b/components/salesforce_rest_api/actions/delete-opportunity/delete-opportunity.mjs @@ -1,30 +1,30 @@ +import propsAsyncOptions from "../../common/props-async-options.mjs"; import salesforce from "../../salesforce_rest_api.app.mjs"; -import { toSingleLineString } from "../../common/utils.mjs"; export default { key: "salesforce_rest_api-delete-opportunity", name: "Delete Opportunity", - description: toSingleLineString(` - Deletes an opportunity. - See [Opportunity SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_opportunity.htm) - and [Delete Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_delete_record.htm) - `), - version: "0.3.0", + description: "Deletes an opportunity. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_delete_record.htm)", + version: "0.3.{{ts}}", type: "action", props: { salesforce, - OpportunityId: { - type: "string", - label: "Opportunity ID", - description: "ID of the Opportunity to delete", + opportunityId: { + ...propsAsyncOptions.OpportunityId, + description: "ID of the opportunity to delete.", + async options() { + return this.salesforce.listRecordOptions({ + objType: "Opportunity", + }); + }, }, }, async run({ $ }) { const response = await this.salesforce.deleteOpportunity({ $, - id: this.OpportunityId, + id: this.opportunityId, }); - $.export("$summary", `Successfully deleted opportunity (ID: ${this.OpportunityId})`); + $.export("$summary", `Successfully deleted opportunity (ID: ${this.opportunityId})`); return response; }, }; From 41f9a9135984fb673b74256859f8a8a90cbb04e3 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sun, 21 Jul 2024 03:37:36 -0300 Subject: [PATCH 075/106] Post Feed to Chatter updates --- .../actions/delete-record/delete-record.mjs | 1 + .../post-feed-to-chatter.mjs | 59 +++++++++++++------ .../salesforce_rest_api.app.mjs | 4 +- 3 files changed, 45 insertions(+), 19 deletions(-) diff --git a/components/salesforce_rest_api/actions/delete-record/delete-record.mjs b/components/salesforce_rest_api/actions/delete-record/delete-record.mjs index 38ec6e0dbc7ba..5214062d754ad 100644 --- a/components/salesforce_rest_api/actions/delete-record/delete-record.mjs +++ b/components/salesforce_rest_api/actions/delete-record/delete-record.mjs @@ -14,6 +14,7 @@ export default { salesForceRestApi, "objectType", ], + description: "The type of object to delete a record from.", }, recordId: { propDefinition: [ diff --git a/components/salesforce_rest_api/actions/post-feed-to-chatter/post-feed-to-chatter.mjs b/components/salesforce_rest_api/actions/post-feed-to-chatter/post-feed-to-chatter.mjs index 31c77251e03af..48c0b16be00d9 100644 --- a/components/salesforce_rest_api/actions/post-feed-to-chatter/post-feed-to-chatter.mjs +++ b/components/salesforce_rest_api/actions/post-feed-to-chatter/post-feed-to-chatter.mjs @@ -1,39 +1,64 @@ import salesForceRestApi from "../../salesforce_rest_api.app.mjs"; -import { toSingleLineString } from "../../common/utils.mjs"; export default { key: "salesforce_rest_api-post-feed-to-chatter", name: "Post a Message to Chatter Feed", - description: toSingleLineString(` - Posts a message to the Chatter Feed. - [See doc](https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/quickreference_post_feed_item.htm) - `), - version: "0.1.0", + description: + "Post a feed item in Chatter. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/quickreference_post_feed_item.htm)", + version: "0.1.{{ts}}", type: "action", props: { salesForceRestApi, - text: { - label: "Text body", - description: "Text body.", - type: "string", + sobjectType: { + propDefinition: [ + salesForceRestApi, + "objectType", + ], + description: "The type of object to select a record from.", }, subjectId: { - label: "Subject ID", - description: "Specify the user, group, or record that will parent the feed item.", - type: "string", + propDefinition: [ + salesForceRestApi, + "recordId", + (c) => ({ + objType: c.sobjectType, + }), + ], + description: "The record that will parent the feed item.", + }, + messageSegments: { + label: "Message segments", + description: + "Each message segment can be a text string, which will be treated as a segment of `type: Text`, or a [message segment object](https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_requests_message_body_input.htm) such as `{ \"type\": \"Mention\", \"username\": \"john\" }`", + type: "string[]", }, }, async run({ $ }) { - const params = { - text: this.text, + const data = { subjectId: this.subjectId, feedElementType: "FeedItem", + body: { + messageSegments: this.messageSegments.map((segment) => { + if (typeof segment === "string") { + try { + return JSON.parse(segment); + } catch (err) { + return { + type: "Text", + text: segment, + }; + } + } + + return segment; + }), + }, }; const response = await this.salesForceRestApi.postFeed({ $, - params, + data, }); - response && $.export("$summary", "Successfully added message to chatter feed"); + response && $.export("$summary", "Successfully posted feed item"); return response; }, }; diff --git a/components/salesforce_rest_api/salesforce_rest_api.app.mjs b/components/salesforce_rest_api/salesforce_rest_api.app.mjs index 7a407bdd79fda..424897431daaa 100644 --- a/components/salesforce_rest_api/salesforce_rest_api.app.mjs +++ b/components/salesforce_rest_api/salesforce_rest_api.app.mjs @@ -6,7 +6,7 @@ export default { propDefinitions: { sobjectId: { type: "string", - label: "SObject ID", + label: "Object Type", description: "ID of the Standard object to get field values from", async options(context) { const { objectType } = context; @@ -593,7 +593,7 @@ export default { }; return axios($ ?? this, requestConfig); }, - async postFeed(args = {}) { + async postFeed(args) { const baseUrl = this._baseApiVersionUrl(); const url = `${baseUrl}/chatter/feed-elements`; return this._makeRequest({ From f63902976204d936315adf8aa95c421b451113af Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sun, 21 Jul 2024 04:14:46 -0300 Subject: [PATCH 076/106] Search String adjustments --- .../actions/search-string/search-string.mjs | 45 +++++++++---------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/components/salesforce_rest_api/actions/search-string/search-string.mjs b/components/salesforce_rest_api/actions/search-string/search-string.mjs index 29c1a9ff82acf..9290c1df0bdb8 100644 --- a/components/salesforce_rest_api/actions/search-string/search-string.mjs +++ b/components/salesforce_rest_api/actions/search-string/search-string.mjs @@ -4,16 +4,22 @@ export default { key: "salesforce_rest_api-search-string", name: "Search Object Records", description: - "Searches for records in an object using a parameterized search. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_search_parameterized.htm)", - version: "0.1.0", + "Searches for records in an object using a parameterized search. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_search_parameterized_get.htm)", + version: "0.1.{{ts}}", type: "action", props: { salesForceRestApi, + infoBox: { + type: "alert", + alertType: "info", + content: "If you need a more flexible search, consider using the **SOQL Search** or **SOSL Search** actions instead.", + }, sobjectType: { propDefinition: [ salesForceRestApi, "objectType", ], + description: "The type of object to search for records.", }, searchTerm: { type: "string", @@ -22,9 +28,9 @@ export default { }, fields: { type: "string[]", - label: "Fields to get values from", + label: "Fields", description: - "List of the Salesforce object's fields to get values from.", + "List of the Salesforce object's fields to get values from, such as `Id` or `Name`.", }, }, async run({ $ }) { @@ -33,24 +39,17 @@ export default { searchTerm, fields, } = this; - try { - const response = await this.salesForceRestApi.parameterizedSearch({ - $, - params: { - q: searchTerm, - sobject: sobjectType, - fields: fields.join(","), - }, - }); - const resultsFound = response.searchRecords.length; - $.export("$summary", "Search completed successfully"); - $.export("results_found", resultsFound); - return response; - } catch (error) { - console.error(error); - $.export("$summary", "Search failed"); - $.export("results_found", 0); - throw new Error(`Search failed: ${error.message}`); - } + + const response = await this.salesForceRestApi.parameterizedSearch({ + $, + params: { + q: searchTerm, + sobject: sobjectType, + fields: fields.join(","), + }, + }); + const resultsFound = response.searchRecords.length; + $.export("$summary", `Sucessfully found ${resultsFound} results`); + return response; }, }; From 99aface3f74c3e84b416c3e28f441a683eb2bc40 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Sun, 21 Jul 2024 04:20:05 -0300 Subject: [PATCH 077/106] Text adjustments and info box on Convert SOAP XML to JSON --- .../convert-soap-xml-to-json.mjs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/components/salesforce_rest_api/actions/convert-soap-xml-to-json/convert-soap-xml-to-json.mjs b/components/salesforce_rest_api/actions/convert-soap-xml-to-json/convert-soap-xml-to-json.mjs index 1ea86c0ca285b..e6eca981d09c6 100644 --- a/components/salesforce_rest_api/actions/convert-soap-xml-to-json/convert-soap-xml-to-json.mjs +++ b/components/salesforce_rest_api/actions/convert-soap-xml-to-json/convert-soap-xml-to-json.mjs @@ -9,6 +9,13 @@ export default { type: "action", props: { salesforce_rest_api, + infoBox: { + type: "alert", + alertType: "info", + content: `This action is useful in conjunction with Salesforce Flow Builder, and is primarily used if Instant triggers are not working for your use case. +\\ +[See the documentation](https://pipedream.com/apps/salesforce-rest-api#troubleshooting) for more details.`, + }, xml: { type: "string", label: "XML Soap Object", @@ -17,14 +24,14 @@ export default { extractNotificationOnly: { type: "boolean", label: "Extract Notifications Only", - description: "Extracts only the notification parts from the XML. Default: `true`.", + description: "Whether to extract only the notification parts from the XML. Default: `true`.", optional: true, default: true, }, failOnError: { type: "boolean", label: "Fail on Error", - description: "If should fail on error when extracting notifications. Default: `false`.", + description: "Whether the action should fail if an error occurs when extracting notifications. Default: `false`.", optional: true, default: false, }, From 5b3bf357a75135690e2c5291f5353d2e015d9e5a Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Mon, 22 Jul 2024 04:05:56 -0300 Subject: [PATCH 078/106] Create Record + several improvements, and added prop mapping --- .../actions/common/base.mjs | 40 ++---- .../actions/create-record/create-record.mjs | 120 ++++++++++++++++-- .../actions/find-records/find-records.mjs | 2 +- .../common/props-utils.mjs | 21 +++ .../salesforce_rest_api.app.mjs | 1 - 5 files changed, 140 insertions(+), 44 deletions(-) diff --git a/components/salesforce_rest_api/actions/common/base.mjs b/components/salesforce_rest_api/actions/common/base.mjs index 3b6bc0cd859ab..1c85ceb2ccfc2 100644 --- a/components/salesforce_rest_api/actions/common/base.mjs +++ b/components/salesforce_rest_api/actions/common/base.mjs @@ -1,5 +1,14 @@ import { ConfigurationError } from "@pipedream/platform"; import salesforce from "../../salesforce_rest_api.app.mjs"; +import { getAdditionalFields } from "../../common/props-utils.mjs"; + +export const additionalFields = { + type: "object", + label: "Additional Fields", + description: + "Other fields to set for this record. Values will be parsed as JSON where applicable.", + optional: true, +}; export function getProps({ objType, @@ -28,7 +37,7 @@ export function getProps({ ...showDateInfo && { dateInfo: { type: "alert", - alertType: "info", + alertType: "warning", content: "Date fields should be a [valid date string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#date_time_string_format) or a Unix timestamp in milliseconds. Example values: `2022-01-15T18:30:00.000Z` or `1642271400000`.", }, }, @@ -55,26 +64,7 @@ export default { getAdvancedProps() { return {}; }, - getAdditionalFields() { - return Object.fromEntries( - Object.entries(this.additionalFields ?? {}).map(([ - key, - value, - ]) => { - try { - return [ - key, - JSON.parse(value), - ]; - } catch (err) { - return [ - key, - value, - ]; - } - }), - ); - }, + getAdditionalFields, formatDateTimeProps(props = {}) { // https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_valid_date_formats.htm return Object.fromEntries(Object.entries(props).map(([ @@ -99,13 +89,7 @@ export default { return this.useAdvancedProps ? { ...this.getAdvancedProps(), - additionalFields: { - type: "object", - label: "Additional Fields", - description: - "Other fields to set for this object. Values will be parsed as JSON where applicable.", - optional: true, - }, + additionalFields, } : {}; }, diff --git a/components/salesforce_rest_api/actions/create-record/create-record.mjs b/components/salesforce_rest_api/actions/create-record/create-record.mjs index 91506741d6790..fd73c352d27ef 100644 --- a/components/salesforce_rest_api/actions/create-record/create-record.mjs +++ b/components/salesforce_rest_api/actions/create-record/create-record.mjs @@ -1,14 +1,12 @@ +import { getAdditionalFields } from "../../common/props-utils.mjs"; import salesforce from "../../salesforce_rest_api.app.mjs"; -import { toSingleLineString } from "../../common/utils.mjs"; +import { additionalFields } from "../common/base.mjs"; export default { key: "salesforce_rest_api-create-record", name: "Create Record", - description: toSingleLineString(` - Create new records of a given resource. - See [docs](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_create.htm) - `), - version: "0.3.0", + description: "Create a record of a given object. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_create.htm)", + version: "0.3.{{ts}}", type: "action", props: { salesforce, @@ -17,20 +15,114 @@ export default { salesforce, "objectType", ], - description: "SObject Type for this record", + description: "SObject Type to create a record of", + reloadProps: true, }, - sobject: { - type: "object", - label: "SObject fields and values", - description: "Data of the SObject record to create", + }, + methods: { + getAdditionalFields, + getFieldPropType(fieldType) { + // https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/field_types.htm + switch (fieldType) { + case "boolean": + return "boolean"; + case "int": + return "integer"; + case "multipicklist": + return "string[]"; + default: + return "string"; + } }, }, + async additionalProps() { + const { objectType } = this; + const fields = await this.salesforce.getFieldsForObjectType(objectType); + + const requiredFields = fields.filter((field) => { + return field.createable && !field.nillable && !field.defaultedOnCreate; + }); + + const requiredFieldProps = requiredFields.map((field) => { + const { type } = field; + const prop = { + label: field.name, + type: this.getFieldPropType(type), + }; + if ([ + "date", + "datetime", + ].includes(type)) { + prop.description = `This is a \`${type}\` field. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_valid_date_formats.htm) for the expected format.`; + } + else if ([ + "picklist", + "multipicklist", + ].includes(type) && field.picklistValues?.length) { + prop.options = field.picklistValues.map(({ + label, value, + }) => ({ + label, + value, + })); + } else if (type === "reference" && field.referenceTo?.length === 1) { + prop.options = async () => { + let response; + try { + response = await this.salesforce.listRecordOptions({ + objType: field.referenceTo[0], + }); + } catch (err) { + response = await this.salesforce.listRecordOptions({ + objType: field.referenceTo[0], + fields: [ + "Id", + ], + getLabel: (item) => `ID ${item.Id}`, + }); + } + return response; + }; + } + + return prop; + }).reduce((obj, prop) => { + obj[prop.label] = prop; + return obj; + }, {}); + + return { + docsInfo: { + type: "alert", + alertType: "info", + content: `[See the documentation](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_${objectType.toLowerCase()}.htm) for information on all available fields.`, + }, + ...requiredFieldProps, + additionalFields, + }; + }, async run({ $ }) { - const response = await this.salesforce.createRecord(this.objectType, { + /* eslint-disable no-unused-vars */ + const { + salesforce, + objectType, + getAdditionalFields, + getFieldPropType, + docsInfo, + dateInfo, + additionalFields, + ...data + } = this; + /* eslint-enable no-unused-vars */ + $.export("data", data); + const response = await salesforce.createRecord(objectType, { $, - data: this.sobject, + data: { + ...data, + ...getAdditionalFields(), + }, }); - $.export("$summary", `Successfully created ${this.objectType} record`); + $.export("$summary", `Successfully created ${this.objectType} record (ID: ${response.id})`); return response; }, }; diff --git a/components/salesforce_rest_api/actions/find-records/find-records.mjs b/components/salesforce_rest_api/actions/find-records/find-records.mjs index 78a3ee0fedc9c..33d4cf3fcce59 100644 --- a/components/salesforce_rest_api/actions/find-records/find-records.mjs +++ b/components/salesforce_rest_api/actions/find-records/find-records.mjs @@ -2,7 +2,7 @@ import salesForceRestApi from "../../salesforce_rest_api.app.mjs"; export default { key: "salesforce_rest_api-find-records", - name: "Get Object Records", + name: "Find Records", description: "Retrieves all records in an object or a record in an object by the given ID or criteria. [API Doc](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_get_field_values.htm)", version: "0.2.0", diff --git a/components/salesforce_rest_api/common/props-utils.mjs b/components/salesforce_rest_api/common/props-utils.mjs index 49c6f718d3c66..a2f80db32fa78 100644 --- a/components/salesforce_rest_api/common/props-utils.mjs +++ b/components/salesforce_rest_api/common/props-utils.mjs @@ -36,3 +36,24 @@ function keysToCapitalCase(data = {}) { export default { keysToCapitalCase, }; + +export function getAdditionalFields() { + return Object.fromEntries( + Object.entries(this.additionalFields ?? {}).map(([ + key, + value, + ]) => { + try { + return [ + key, + JSON.parse(value), + ]; + } catch (err) { + return [ + key, + value, + ]; + } + }), + ); +} diff --git a/components/salesforce_rest_api/salesforce_rest_api.app.mjs b/components/salesforce_rest_api/salesforce_rest_api.app.mjs index 424897431daaa..40c88d319a9a2 100644 --- a/components/salesforce_rest_api/salesforce_rest_api.app.mjs +++ b/components/salesforce_rest_api/salesforce_rest_api.app.mjs @@ -49,7 +49,6 @@ export default { }) { let response; try { - console.log("first request attempt"); response = await this.listRecordOptions({ objType, fields, From aa12585197782a9a88424e0acfdfdff596c621ae Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Mon, 22 Jul 2024 19:34:13 -0300 Subject: [PATCH 079/106] Adjustments to additionalProps for records --- .../actions/create-record/create-record.mjs | 111 ++++++++++-------- .../common/props-utils.mjs | 104 ++++++++++++++-- 2 files changed, 161 insertions(+), 54 deletions(-) diff --git a/components/salesforce_rest_api/actions/create-record/create-record.mjs b/components/salesforce_rest_api/actions/create-record/create-record.mjs index fd73c352d27ef..1025e8611f4cd 100644 --- a/components/salesforce_rest_api/actions/create-record/create-record.mjs +++ b/components/salesforce_rest_api/actions/create-record/create-record.mjs @@ -43,53 +43,72 @@ export default { return field.createable && !field.nillable && !field.defaultedOnCreate; }); - const requiredFieldProps = requiredFields.map((field) => { - const { type } = field; - const prop = { - label: field.name, - type: this.getFieldPropType(type), - }; - if ([ - "date", - "datetime", - ].includes(type)) { - prop.description = `This is a \`${type}\` field. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_valid_date_formats.htm) for the expected format.`; - } - else if ([ - "picklist", - "multipicklist", - ].includes(type) && field.picklistValues?.length) { - prop.options = field.picklistValues.map(({ - label, value, - }) => ({ - label, - value, - })); - } else if (type === "reference" && field.referenceTo?.length === 1) { - prop.options = async () => { - let response; - try { - response = await this.salesforce.listRecordOptions({ - objType: field.referenceTo[0], - }); - } catch (err) { - response = await this.salesforce.listRecordOptions({ - objType: field.referenceTo[0], - fields: [ - "Id", - ], - getLabel: (item) => `ID ${item.Id}`, - }); - } - return response; + const requiredFieldProps = requiredFields + .map((field) => { + const { type } = field; + const prop = { + type: this.getFieldPropType(type), + label: field.name, + description: `Field type: \`${type}\``, }; - } + if ([ + "date", + "datetime", + ].includes(type)) { + prop.description = `This is a \`${type}\` field. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_valid_date_formats.htm) for the expected format.`; + } else if ( + [ + "picklist", + "multipicklist", + ].includes(type) && + field.picklistValues?.length + ) { + prop.description = `Select ${ + type === "picklist" + ? "a value" + : "one or more values" + } from the list.`; + prop.options = field.picklistValues.map(({ + label, value, + }) => ({ + label, + value, + })); + } else if (type === "reference") { + if (field.referenceTo?.length === 1) { + prop.description = `The ID of a${field.referenceTo[0].startsWith("A") + ? "n" + : ""} \`${field.referenceTo[0]}\` record.`; + prop.options = async () => { + let response; + try { + response = await this.salesforce.listRecordOptions({ + objType: field.referenceTo[0], + }); + } catch (err) { + response = await this.salesforce.listRecordOptions({ + objType: field.referenceTo[0], + fields: [ + "Id", + ], + getLabel: (item) => `ID ${item.Id}`, + }); + } + return response; + }; + } else if (field.referenceTo?.length > 1) { + prop.description = `The ID of a record of one of these object types: ${field.referenceTo + .map((s) => `\`${s}\``) + .join(", ")}`; + } + } - return prop; - }).reduce((obj, prop) => { - obj[prop.label] = prop; - return obj; - }, {}); + return prop; + }) + .reduce((obj, prop) => { + obj[prop.label] = prop; + return obj; + }, {}); return { docsInfo: { @@ -107,7 +126,7 @@ export default { salesforce, objectType, getAdditionalFields, - getFieldPropType, + convertFieldsToProps, docsInfo, dateInfo, additionalFields, diff --git a/components/salesforce_rest_api/common/props-utils.mjs b/components/salesforce_rest_api/common/props-utils.mjs index a2f80db32fa78..0d61e529c5fee 100644 --- a/components/salesforce_rest_api/common/props-utils.mjs +++ b/components/salesforce_rest_api/common/props-utils.mjs @@ -10,27 +10,30 @@ function filterProps(props) { return; } return Object.fromEntries( - Object.entries(props) - .filter(([ + Object.entries(props).filter( + ([ key, value, - ]) => typeof (value) !== "function" - && ![ + ]) => + typeof value !== "function" && ![ "app", "salesforce", - ].includes(key)), + ].includes(key), + ), ); } function keysToCapitalCase(data = {}) { - return Object.entries(filterProps(data)) - .reduce((acc, [ + return Object.entries(filterProps(data)).reduce( + (acc, [ key, value, ]) => ({ ...acc, [toCapitalCase(key)]: value, - }), {}); + }), + {}, + ); } export default { @@ -57,3 +60,88 @@ export function getAdditionalFields() { }), ); } + +function getFieldPropType(fieldType) { + // https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/field_types.htm + switch (fieldType) { + case "boolean": + return "boolean"; + case "int": + return "integer"; + case "multipicklist": + return "string[]"; + default: + return "string"; + } +} + +export const convertFieldsToProps = (fields) => { + return fields + .map((field) => { + const { type } = field; + const prop = { + type: getFieldPropType(type), + label: field.name, + description: `Field type: \`${type}\``, + }; + if ([ + "date", + "datetime", + ].includes(type)) { + prop.description = `This is a \`${type}\` field. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_valid_date_formats.htm) for the expected format.`; + } else if ( + [ + "picklist", + "multipicklist", + ].includes(type) && + field.picklistValues?.length + ) { + prop.description = `Select ${ + type === "picklist" + ? "a value" + : "one or more values" + } from the list.`; + prop.options = field.picklistValues.map(({ + label, value, + }) => ({ + label, + value, + })); + } else if (type === "reference") { + if (field.referenceTo?.length === 1) { + const objType = field.referenceTo[0]; + prop.description = `The ID of a${objType.startsWith("A") + ? "n" + : ""} \`${objType}\` record.`; + prop.options = async () => { + let response; + try { + response = await this.salesforce.listRecordOptions({ + objType, + }); + } catch (err) { + response = await this.salesforce.listRecordOptions({ + objType, + fields: [ + "Id", + ], + getLabel: (item) => `ID ${item.Id}`, + }); + } + return response; + }; + } else if (field.referenceTo?.length > 1) { + const fieldNames = field.referenceTo + .map((s) => `\`${s}\``) + .join(", "); + prop.description = `The ID of a record of one of these object types: ${fieldNames}`; + } + } + + return prop; + }) + .reduce((obj, prop) => { + obj[prop.label] = prop; + return obj; + }, {}); +}; From fc874ee7968232e7b1878c2bcb6f0ea1458c86b8 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Tue, 23 Jul 2024 02:22:43 -0300 Subject: [PATCH 080/106] Creating complete sobject name/namefield mapping --- .../actions/create-record/create-record.mjs | 25 +- .../common/all-sobjects.mjs | 3812 +++++++++++++++++ .../salesforce_rest_api.app.mjs | 19 +- 3 files changed, 3829 insertions(+), 27 deletions(-) create mode 100644 components/salesforce_rest_api/common/all-sobjects.mjs diff --git a/components/salesforce_rest_api/actions/create-record/create-record.mjs b/components/salesforce_rest_api/actions/create-record/create-record.mjs index 1025e8611f4cd..88442283d2c63 100644 --- a/components/salesforce_rest_api/actions/create-record/create-record.mjs +++ b/components/salesforce_rest_api/actions/create-record/create-record.mjs @@ -1,6 +1,7 @@ import { getAdditionalFields } from "../../common/props-utils.mjs"; import salesforce from "../../salesforce_rest_api.app.mjs"; import { additionalFields } from "../common/base.mjs"; +import allSobjects from "../../common/all-sobjects.mjs"; export default { key: "salesforce_rest_api-create-record", @@ -76,26 +77,12 @@ export default { })); } else if (type === "reference") { if (field.referenceTo?.length === 1) { - prop.description = `The ID of a${field.referenceTo[0].startsWith("A") + const objName = field.referenceTo[0]; + prop.description = `The ID of a${objName.startsWith("A") ? "n" - : ""} \`${field.referenceTo[0]}\` record.`; - prop.options = async () => { - let response; - try { - response = await this.salesforce.listRecordOptions({ - objType: field.referenceTo[0], - }); - } catch (err) { - response = await this.salesforce.listRecordOptions({ - objType: field.referenceTo[0], - fields: [ - "Id", - ], - getLabel: (item) => `ID ${item.Id}`, - }); - } - return response; - }; + : ""} \`${objName}\` record.`; + const optionsFn = allSobjects.find(({ name }) => name === objName)?.getRecords; + if (optionsFn) prop.options = optionsFn; } else if (field.referenceTo?.length > 1) { prop.description = `The ID of a record of one of these object types: ${field.referenceTo .map((s) => `\`${s}\``) diff --git a/components/salesforce_rest_api/common/all-sobjects.mjs b/components/salesforce_rest_api/common/all-sobjects.mjs new file mode 100644 index 0000000000000..1a75aa83c60fc --- /dev/null +++ b/components/salesforce_rest_api/common/all-sobjects.mjs @@ -0,0 +1,3812 @@ +// The execution context of additionalProps prevents usage of propDefinitions +// and of standard async options methods (an arrow function is required) +// And the execution context of async options prevents any variable "leaking" +// so the only way is to actually paste these out as plain individual functions, +// unfortunately, without any references to code outside the function + +/* +getRecords: () => this.salesforce.listRecordOptions({ objType: "ObjType", +nameField: "NameField" }) +*/ + +const sobjects = [ + { + name: "AIInsightAction", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "AIInsightAction", + nameField: "Name", + }), + }, + { + name: "AIInsightFeedback", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "AIInsightFeedback", + nameField: "Name", + }), + }, + { + name: "AIInsightReason", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "AIInsightReason", + nameField: "Name", + }), + }, + { + name: "AIInsightValue", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "AIInsightValue", + nameField: "Name", + }), + }, + { + name: "AIRecordInsight", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "AIRecordInsight", + nameField: "Name", + }), + }, + { + name: "Account", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Account", + nameField: "Name", + }), + }, + { + name: "AccountCleanInfo", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "AccountCleanInfo", + nameField: "Name", + }), + }, + { + name: "AccountContactRole", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "AccountContactRole", + nameField: "Id", + }), + }, + { + name: "AccountFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "AccountFeed", + nameField: "Id", + }), + }, + { + name: "AccountHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "AccountHistory", + nameField: "Id", + }), + }, + { + name: "AdditionalNumber", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "AdditionalNumber", + nameField: "Name", + }), + }, + { + name: "Address", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Address", + nameField: "Name", + }), + }, + { + name: "Announcement", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Announcement", + nameField: "Id", + }), + }, + { + name: "ApexClass", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ApexClass", + nameField: "Name", + }), + }, + { + name: "ApexComponent", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ApexComponent", + nameField: "Name", + }), + }, + { + name: "ApexPage", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ApexPage", + nameField: "Name", + }), + }, + { + name: "ApexTrigger", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ApexTrigger", + nameField: "Name", + }), + }, + { + name: "ApiAnomalyEventStore", + nameField: "ApiAnomalyEventNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ApiAnomalyEventStore", + nameField: "ApiAnomalyEventNumber", + }), + }, + { + name: "ApiAnomalyEventStoreFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ApiAnomalyEventStoreFeed", + nameField: "Id", + }), + }, + { + name: "AppAnalyticsQueryRequest", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "AppAnalyticsQueryRequest", + nameField: "Name", + }), + }, + { + name: "AppUsageAssignment", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "AppUsageAssignment", + nameField: "Name", + }), + }, + { + name: "Asset", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Asset", + nameField: "Name", + }), + }, + { + name: "AssetAction", + nameField: "AssetActionNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "AssetAction", + nameField: "AssetActionNumber", + }), + }, + { + name: "AssetActionSource", + nameField: "AssetActionSourceNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "AssetActionSource", + nameField: "AssetActionSourceNumber", + }), + }, + { + name: "AssetFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "AssetFeed", + nameField: "Id", + }), + }, + { + name: "AssetHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "AssetHistory", + nameField: "Id", + }), + }, + { + name: "AssetRelationship", + nameField: "AssetRelationshipNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "AssetRelationship", + nameField: "AssetRelationshipNumber", + }), + }, + { + name: "AssetRelationshipFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "AssetRelationshipFeed", + nameField: "Id", + }), + }, + { + name: "AssetRelationshipHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "AssetRelationshipHistory", + nameField: "Id", + }), + }, + { + name: "AssetStatePeriod", + nameField: "AssetStatePeriodNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "AssetStatePeriod", + nameField: "AssetStatePeriodNumber", + }), + }, + { + name: "AssignedResource", + nameField: "AssignedResourceNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "AssignedResource", + nameField: "AssignedResourceNumber", + }), + }, + { + name: "AssignedResourceFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "AssignedResourceFeed", + nameField: "Id", + }), + }, + { + name: "AssociatedLocation", + nameField: "AssociatedLocationNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "AssociatedLocation", + nameField: "AssociatedLocationNumber", + }), + }, + { + name: "AssociatedLocationHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "AssociatedLocationHistory", + nameField: "Id", + }), + }, + { + name: "Attachment", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Attachment", + nameField: "Name", + }), + }, + { + name: "AuthorizationForm", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "AuthorizationForm", + nameField: "Name", + }), + }, + { + name: "AuthorizationFormConsent", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "AuthorizationFormConsent", + nameField: "Name", + }), + }, + { + name: "AuthorizationFormConsentHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "AuthorizationFormConsentHistory", + nameField: "Id", + }), + }, + { + name: "AuthorizationFormDataUse", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "AuthorizationFormDataUse", + nameField: "Name", + }), + }, + { + name: "AuthorizationFormDataUseHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "AuthorizationFormDataUseHistory", + nameField: "Id", + }), + }, + { + name: "AuthorizationFormHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "AuthorizationFormHistory", + nameField: "Id", + }), + }, + { + name: "AuthorizationFormText", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "AuthorizationFormText", + nameField: "Name", + }), + }, + { + name: "AuthorizationFormTextHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "AuthorizationFormTextHistory", + nameField: "Id", + }), + }, + { + name: "BackgroundOperation", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "BackgroundOperation", + nameField: "Name", + }), + }, + { + name: "BrandTemplate", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "BrandTemplate", + nameField: "Name", + }), + }, + { + name: "BriefcaseAssignment", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "BriefcaseAssignment", + nameField: "Id", + }), + }, + { + name: "BusinessHours", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "BusinessHours", + nameField: "Name", + }), + }, + { + name: "BusinessProcess", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "BusinessProcess", + nameField: "Name", + }), + }, + { + name: "BuyerGroup", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "BuyerGroup", + nameField: "Name", + }), + }, + { + name: "BuyerGroupFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "BuyerGroupFeed", + nameField: "Id", + }), + }, + { + name: "BuyerGroupHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "BuyerGroupHistory", + nameField: "Id", + }), + }, + { + name: "CalendarView", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CalendarView", + nameField: "Name", + }), + }, + { + name: "CallCenter", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CallCenter", + nameField: "Name", + }), + }, + { + name: "Campaign", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Campaign", + nameField: "Name", + }), + }, + { + name: "CampaignFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CampaignFeed", + nameField: "Id", + }), + }, + { + name: "CampaignHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CampaignHistory", + nameField: "Id", + }), + }, + { + name: "CampaignMember", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CampaignMember", + nameField: "Id", + }), + }, + { + name: "CampaignMemberStatus", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CampaignMemberStatus", + nameField: "Id", + }), + }, + { + name: "CardPaymentMethod", + nameField: "CardPaymentMethodNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CardPaymentMethod", + nameField: "CardPaymentMethodNumber", + }), + }, + { + name: "CartCheckoutSession", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CartCheckoutSession", + nameField: "Name", + }), + }, + { + name: "CartDeliveryGroup", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CartDeliveryGroup", + nameField: "Name", + }), + }, + { + name: "CartDeliveryGroupMethod", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CartDeliveryGroupMethod", + nameField: "Name", + }), + }, + { + name: "CartItem", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CartItem", + nameField: "Name", + }), + }, + { + name: "CartRelatedItem", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CartRelatedItem", + nameField: "Name", + }), + }, + { + name: "CartTax", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CartTax", + nameField: "Name", + }), + }, + { + name: "CartValidationOutput", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CartValidationOutput", + nameField: "Name", + }), + }, + { + name: "Case", + nameField: "CaseNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Case", + nameField: "CaseNumber", + }), + }, + { + name: "CaseComment", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CaseComment", + nameField: "Id", + }), + }, + { + name: "CaseContactRole", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CaseContactRole", + nameField: "Id", + }), + }, + { + name: "CaseFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CaseFeed", + nameField: "Id", + }), + }, + { + name: "CaseHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CaseHistory", + nameField: "Id", + }), + }, + { + name: "CaseSolution", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CaseSolution", + nameField: "Id", + }), + }, + { + name: "CaseTeamMember", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CaseTeamMember", + nameField: "Id", + }), + }, + { + name: "CaseTeamRole", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CaseTeamRole", + nameField: "Name", + }), + }, + { + name: "CaseTeamTemplate", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CaseTeamTemplate", + nameField: "Name", + }), + }, + { + name: "CaseTeamTemplateMember", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CaseTeamTemplateMember", + nameField: "Id", + }), + }, + { + name: "CaseTeamTemplateRecord", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CaseTeamTemplateRecord", + nameField: "Id", + }), + }, + { + name: "CategoryData", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CategoryData", + nameField: "Id", + }), + }, + { + name: "CategoryNode", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CategoryNode", + nameField: "Id", + }), + }, + { + name: "ChatterActivity", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ChatterActivity", + nameField: "Id", + }), + }, + { + name: "CollaborationGroupFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CollaborationGroupFeed", + nameField: "Id", + }), + }, + { + name: "CollaborationGroupMember", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CollaborationGroupMember", + nameField: "Id", + }), + }, + { + name: "CollaborationGroupRecord", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CollaborationGroupRecord", + nameField: "Id", + }), + }, + { + name: "CommSubscription", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CommSubscription", + nameField: "Name", + }), + }, + { + name: "CommSubscriptionChannelType", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CommSubscriptionChannelType", + nameField: "Name", + }), + }, + { + name: "CommSubscriptionChannelTypeFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CommSubscriptionChannelTypeFeed", + nameField: "Id", + }), + }, + { + name: "CommSubscriptionChannelTypeHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CommSubscriptionChannelTypeHistory", + nameField: "Id", + }), + }, + { + name: "CommSubscriptionConsent", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CommSubscriptionConsent", + nameField: "Name", + }), + }, + { + name: "CommSubscriptionConsentFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CommSubscriptionConsentFeed", + nameField: "Id", + }), + }, + { + name: "CommSubscriptionConsentHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CommSubscriptionConsentHistory", + nameField: "Id", + }), + }, + { + name: "CommSubscriptionFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CommSubscriptionFeed", + nameField: "Id", + }), + }, + { + name: "CommSubscriptionHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CommSubscriptionHistory", + nameField: "Id", + }), + }, + { + name: "CommSubscriptionTiming", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CommSubscriptionTiming", + nameField: "Name", + }), + }, + { + name: "CommSubscriptionTimingFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CommSubscriptionTimingFeed", + nameField: "Id", + }), + }, + { + name: "CommSubscriptionTimingHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CommSubscriptionTimingHistory", + nameField: "Id", + }), + }, + { + name: "ConferenceNumber", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ConferenceNumber", + nameField: "Name", + }), + }, + { + name: "ConsumptionRate", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ConsumptionRate", + nameField: "Name", + }), + }, + { + name: "ConsumptionRateHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ConsumptionRateHistory", + nameField: "Id", + }), + }, + { + name: "ConsumptionSchedule", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ConsumptionSchedule", + nameField: "Name", + }), + }, + { + name: "ConsumptionScheduleFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ConsumptionScheduleFeed", + nameField: "Id", + }), + }, + { + name: "ConsumptionScheduleHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ConsumptionScheduleHistory", + nameField: "Id", + }), + }, + { + name: "Contact", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Contact", + nameField: "Name", + }), + }, + { + name: "ContactCleanInfo", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ContactCleanInfo", + nameField: "Name", + }), + }, + { + name: "ContactFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ContactFeed", + nameField: "Id", + }), + }, + { + name: "ContactHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ContactHistory", + nameField: "Id", + }), + }, + { + name: "ContactPointAddress", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ContactPointAddress", + nameField: "Name", + }), + }, + { + name: "ContactPointAddressHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ContactPointAddressHistory", + nameField: "Id", + }), + }, + { + name: "ContactPointConsent", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ContactPointConsent", + nameField: "Name", + }), + }, + { + name: "ContactPointConsentHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ContactPointConsentHistory", + nameField: "Id", + }), + }, + { + name: "ContactPointEmail", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ContactPointEmail", + nameField: "Name", + }), + }, + { + name: "ContactPointEmailHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ContactPointEmailHistory", + nameField: "Id", + }), + }, + { + name: "ContactPointPhone", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ContactPointPhone", + nameField: "Name", + }), + }, + { + name: "ContactPointPhoneHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ContactPointPhoneHistory", + nameField: "Id", + }), + }, + { + name: "ContactPointTypeConsent", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ContactPointTypeConsent", + nameField: "Name", + }), + }, + { + name: "ContactPointTypeConsentHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ContactPointTypeConsentHistory", + nameField: "Id", + }), + }, + { + name: "ContactRequest", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ContactRequest", + nameField: "Name", + }), + }, + { + name: "ContentDocumentFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ContentDocumentFeed", + nameField: "Id", + }), + }, + { + name: "ContentDocumentHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ContentDocumentHistory", + nameField: "Id", + }), + }, + { + name: "ContentFolder", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ContentFolder", + nameField: "Name", + }), + }, + { + name: "ContentVersionHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ContentVersionHistory", + nameField: "Id", + }), + }, + { + name: "Contract", + nameField: "ContractNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Contract", + nameField: "ContractNumber", + }), + }, + { + name: "ContractContactRole", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ContractContactRole", + nameField: "Id", + }), + }, + { + name: "ContractFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ContractFeed", + nameField: "Id", + }), + }, + { + name: "ContractHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ContractHistory", + nameField: "Id", + }), + }, + { + name: "ContractLineItem", + nameField: "LineItemNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ContractLineItem", + nameField: "LineItemNumber", + }), + }, + { + name: "ContractLineItemHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ContractLineItemHistory", + nameField: "Id", + }), + }, + { + name: "CredentialStuffingEventStore", + nameField: "CredentialStuffingEventNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CredentialStuffingEventStore", + nameField: "CredentialStuffingEventNumber", + }), + }, + { + name: "CredentialStuffingEventStoreFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CredentialStuffingEventStoreFeed", + nameField: "Id", + }), + }, + { + name: "CreditMemo", + nameField: "DocumentNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CreditMemo", + nameField: "DocumentNumber", + }), + }, + { + name: "CreditMemoFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CreditMemoFeed", + nameField: "Id", + }), + }, + { + name: "CreditMemoHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CreditMemoHistory", + nameField: "Id", + }), + }, + { + name: "CreditMemoInvApplication", + nameField: "CreditMemoInvoiceNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CreditMemoInvApplication", + nameField: "CreditMemoInvoiceNumber", + }), + }, + { + name: "CreditMemoInvApplicationFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CreditMemoInvApplicationFeed", + nameField: "Id", + }), + }, + { + name: "CreditMemoInvApplicationHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CreditMemoInvApplicationHistory", + nameField: "Id", + }), + }, + { + name: "CreditMemoLine", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CreditMemoLine", + nameField: "Name", + }), + }, + { + name: "CreditMemoLineFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CreditMemoLineFeed", + nameField: "Id", + }), + }, + { + name: "CreditMemoLineHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "CreditMemoLineHistory", + nameField: "Id", + }), + }, + { + name: "DandBCompany", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "DandBCompany", + nameField: "Name", + }), + }, + { + name: "DashboardComponentFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "DashboardComponentFeed", + nameField: "Id", + }), + }, + { + name: "DashboardFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "DashboardFeed", + nameField: "Id", + }), + }, + { + name: "DataAssessmentFieldMetric", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "DataAssessmentFieldMetric", + nameField: "Name", + }), + }, + { + name: "DataAssessmentMetric", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "DataAssessmentMetric", + nameField: "Name", + }), + }, + { + name: "DataAssessmentValueMetric", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "DataAssessmentValueMetric", + nameField: "Name", + }), + }, + { + name: "DataKitDeploymentLog", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "DataKitDeploymentLog", + nameField: "Id", + }), + }, + { + name: "DataUseLegalBasis", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "DataUseLegalBasis", + nameField: "Name", + }), + }, + { + name: "DataUseLegalBasisHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "DataUseLegalBasisHistory", + nameField: "Id", + }), + }, + { + name: "DataUsePurpose", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "DataUsePurpose", + nameField: "Name", + }), + }, + { + name: "DataUsePurposeHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "DataUsePurposeHistory", + nameField: "Id", + }), + }, + { + name: "DatacloudOwnedEntity", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "DatacloudOwnedEntity", + nameField: "Name", + }), + }, + { + name: "DatacloudPurchaseUsage", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "DatacloudPurchaseUsage", + nameField: "Name", + }), + }, + { + name: "DigitalWallet", + nameField: "DigitalWalletNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "DigitalWallet", + nameField: "DigitalWalletNumber", + }), + }, + { + name: "Document", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Document", + nameField: "Name", + }), + }, + { + name: "DuplicateRecordItem", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "DuplicateRecordItem", + nameField: "Name", + }), + }, + { + name: "DuplicateRecordSet", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "DuplicateRecordSet", + nameField: "Name", + }), + }, + { + name: "EmailMessage", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "EmailMessage", + nameField: "Id", + }), + }, + { + name: "EmailMessageRelation", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "EmailMessageRelation", + nameField: "Id", + }), + }, + { + name: "EmailServicesAddress", + nameField: "LocalPart", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "EmailServicesAddress", + nameField: "LocalPart", + }), + }, + { + name: "EmailServicesFunction", + nameField: "FunctionName", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "EmailServicesFunction", + nameField: "FunctionName", + }), + }, + { + name: "EmailTemplate", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "EmailTemplate", + nameField: "Name", + }), + }, + { + name: "EngagementChannelType", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "EngagementChannelType", + nameField: "Name", + }), + }, + { + name: "EngagementChannelTypeFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "EngagementChannelTypeFeed", + nameField: "Id", + }), + }, + { + name: "EngagementChannelTypeHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "EngagementChannelTypeHistory", + nameField: "Id", + }), + }, + { + name: "EnhancedLetterhead", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "EnhancedLetterhead", + nameField: "Name", + }), + }, + { + name: "EnhancedLetterheadFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "EnhancedLetterheadFeed", + nameField: "Id", + }), + }, + { + name: "Entitlement", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Entitlement", + nameField: "Name", + }), + }, + { + name: "EntitlementContact", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "EntitlementContact", + nameField: "Name", + }), + }, + { + name: "EntitlementFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "EntitlementFeed", + nameField: "Id", + }), + }, + { + name: "EntitlementHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "EntitlementHistory", + nameField: "Id", + }), + }, + { + name: "EntityMilestone", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "EntityMilestone", + nameField: "Name", + }), + }, + { + name: "EntityMilestoneFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "EntityMilestoneFeed", + nameField: "Id", + }), + }, + { + name: "EntityMilestoneHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "EntityMilestoneHistory", + nameField: "Id", + }), + }, + { + name: "EntitySubscription", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "EntitySubscription", + nameField: "Id", + }), + }, + { + name: "Event", + nameField: "Subject", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Event", + nameField: "Subject", + }), + }, + { + name: "EventFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "EventFeed", + nameField: "Id", + }), + }, + { + name: "EventRelation", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "EventRelation", + nameField: "Id", + }), + }, + { + name: "ExpressionFilter", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ExpressionFilter", + nameField: "Name", + }), + }, + { + name: "ExpressionFilterCriteria", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ExpressionFilterCriteria", + nameField: "Name", + }), + }, + { + name: "ExternalEvent", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ExternalEvent", + nameField: "Name", + }), + }, + { + name: "ExternalEventMapping", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ExternalEventMapping", + nameField: "Name", + }), + }, + { + name: "FeedComment", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "FeedComment", + nameField: "Id", + }), + }, + { + name: "FeedItem", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "FeedItem", + nameField: "Id", + }), + }, + { + name: "FeedRevision", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "FeedRevision", + nameField: "Id", + }), + }, + { + name: "FileSearchActivity", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "FileSearchActivity", + nameField: "Name", + }), + }, + { + name: "FinanceBalanceSnapshot", + nameField: "FinanceBalanceSnapshotNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "FinanceBalanceSnapshot", + nameField: "FinanceBalanceSnapshotNumber", + }), + }, + { + name: "FinanceTransaction", + nameField: "FinanceTransactionNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "FinanceTransaction", + nameField: "FinanceTransactionNumber", + }), + }, + { + name: "FiscalYearSettings", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "FiscalYearSettings", + nameField: "Name", + }), + }, + { + name: "FlowInterview", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "FlowInterview", + nameField: "Name", + }), + }, + { + name: "FlowInterviewLog", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "FlowInterviewLog", + nameField: "Name", + }), + }, + { + name: "FlowInterviewLogEntry", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "FlowInterviewLogEntry", + nameField: "Name", + }), + }, + { + name: "FlowRecordRelation", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "FlowRecordRelation", + nameField: "Name", + }), + }, + { + name: "FlowStageRelation", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "FlowStageRelation", + nameField: "Name", + }), + }, + { + name: "Folder", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Folder", + nameField: "Name", + }), + }, + { + name: "FulfillmentOrder", + nameField: "FulfillmentOrderNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "FulfillmentOrder", + nameField: "FulfillmentOrderNumber", + }), + }, + { + name: "FulfillmentOrderFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "FulfillmentOrderFeed", + nameField: "Id", + }), + }, + { + name: "FulfillmentOrderItemAdjustment", + nameField: "FulfillmentOrderItemAdjustmentNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "FulfillmentOrderItemAdjustment", + nameField: "FulfillmentOrderItemAdjustmentNumber", + }), + }, + { + name: "FulfillmentOrderItemAdjustmentFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "FulfillmentOrderItemAdjustmentFeed", + nameField: "Id", + }), + }, + { + name: "FulfillmentOrderItemTax", + nameField: "FulfillmentOrderItemTaxNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "FulfillmentOrderItemTax", + nameField: "FulfillmentOrderItemTaxNumber", + }), + }, + { + name: "FulfillmentOrderItemTaxFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "FulfillmentOrderItemTaxFeed", + nameField: "Id", + }), + }, + { + name: "FulfillmentOrderLineItem", + nameField: "FulfillmentOrderLineItemNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "FulfillmentOrderLineItem", + nameField: "FulfillmentOrderLineItemNumber", + }), + }, + { + name: "FulfillmentOrderLineItemFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "FulfillmentOrderLineItemFeed", + nameField: "Id", + }), + }, + { + name: "Group", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Group", + nameField: "Name", + }), + }, + { + name: "GroupMember", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "GroupMember", + nameField: "Id", + }), + }, + { + name: "Holiday", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Holiday", + nameField: "Name", + }), + }, + { + name: "Idea", + nameField: "Title", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Idea", + nameField: "Title", + }), + }, + { + name: "IdeaComment", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "IdeaComment", + nameField: "Id", + }), + }, + { + name: "Image", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Image", + nameField: "Name", + }), + }, + { + name: "Individual", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Individual", + nameField: "Name", + }), + }, + { + name: "IndividualHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "IndividualHistory", + nameField: "Id", + }), + }, + { + name: "InstalledMobileApp", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "InstalledMobileApp", + nameField: "Name", + }), + }, + { + name: "Invoice", + nameField: "DocumentNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Invoice", + nameField: "DocumentNumber", + }), + }, + { + name: "InvoiceFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "InvoiceFeed", + nameField: "Id", + }), + }, + { + name: "InvoiceHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "InvoiceHistory", + nameField: "Id", + }), + }, + { + name: "InvoiceLine", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "InvoiceLine", + nameField: "Name", + }), + }, + { + name: "InvoiceLineFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "InvoiceLineFeed", + nameField: "Id", + }), + }, + { + name: "InvoiceLineHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "InvoiceLineHistory", + nameField: "Id", + }), + }, + { + name: "Lead", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Lead", + nameField: "Name", + }), + }, + { + name: "LeadCleanInfo", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "LeadCleanInfo", + nameField: "Name", + }), + }, + { + name: "LeadFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "LeadFeed", + nameField: "Id", + }), + }, + { + name: "LeadHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "LeadHistory", + nameField: "Id", + }), + }, + { + name: "LegalEntity", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "LegalEntity", + nameField: "Name", + }), + }, + { + name: "LegalEntityFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "LegalEntityFeed", + nameField: "Id", + }), + }, + { + name: "LegalEntityHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "LegalEntityHistory", + nameField: "Id", + }), + }, + { + name: "ListEmail", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ListEmail", + nameField: "Name", + }), + }, + { + name: "ListEmailIndividualRecipient", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ListEmailIndividualRecipient", + nameField: "Name", + }), + }, + { + name: "ListEmailRecipientSource", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ListEmailRecipientSource", + nameField: "Name", + }), + }, + { + name: "Location", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Location", + nameField: "Name", + }), + }, + { + name: "LocationFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "LocationFeed", + nameField: "Id", + }), + }, + { + name: "LocationHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "LocationHistory", + nameField: "Id", + }), + }, + { + name: "Macro", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Macro", + nameField: "Name", + }), + }, + { + name: "MacroHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "MacroHistory", + nameField: "Id", + }), + }, + { + name: "MacroInstruction", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "MacroInstruction", + nameField: "Name", + }), + }, + { + name: "MacroUsage", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "MacroUsage", + nameField: "Name", + }), + }, + { + name: "MailmergeTemplate", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "MailmergeTemplate", + nameField: "Name", + }), + }, + { + name: "MatchingInformation", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "MatchingInformation", + nameField: "Name", + }), + }, + { + name: "MessagingDeliveryError", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "MessagingDeliveryError", + nameField: "Name", + }), + }, + { + name: "MessagingEndUser", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "MessagingEndUser", + nameField: "Name", + }), + }, + { + name: "MessagingEndUserHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "MessagingEndUserHistory", + nameField: "Id", + }), + }, + { + name: "MessagingSession", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "MessagingSession", + nameField: "Name", + }), + }, + { + name: "MessagingSessionFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "MessagingSessionFeed", + nameField: "Id", + }), + }, + { + name: "MessagingSessionHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "MessagingSessionHistory", + nameField: "Id", + }), + }, + { + name: "MlFeatureValueMetric", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "MlFeatureValueMetric", + nameField: "Name", + }), + }, + { + name: "Note", + nameField: "Title", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Note", + nameField: "Title", + }), + }, + { + name: "OperatingHours", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "OperatingHours", + nameField: "Name", + }), + }, + { + name: "OperatingHoursFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "OperatingHoursFeed", + nameField: "Id", + }), + }, + { + name: "OperatingHoursHoliday", + nameField: "OperatingHoursHolidayNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "OperatingHoursHoliday", + nameField: "OperatingHoursHolidayNumber", + }), + }, + { + name: "OperatingHoursHolidayFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "OperatingHoursHolidayFeed", + nameField: "Id", + }), + }, + { + name: "Opportunity", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Opportunity", + nameField: "Name", + }), + }, + { + name: "OpportunityCompetitor", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "OpportunityCompetitor", + nameField: "Id", + }), + }, + { + name: "OpportunityContactRole", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "OpportunityContactRole", + nameField: "Id", + }), + }, + { + name: "OpportunityFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "OpportunityFeed", + nameField: "Id", + }), + }, + { + name: "OpportunityFieldHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "OpportunityFieldHistory", + nameField: "Id", + }), + }, + { + name: "OpportunityHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "OpportunityHistory", + nameField: "Id", + }), + }, + { + name: "OpportunityLineItem", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "OpportunityLineItem", + nameField: "Name", + }), + }, + { + name: "Order", + nameField: "OrderNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Order", + nameField: "OrderNumber", + }), + }, + { + name: "OrderFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "OrderFeed", + nameField: "Id", + }), + }, + { + name: "OrderHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "OrderHistory", + nameField: "Id", + }), + }, + { + name: "OrderItem", + nameField: "OrderItemNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "OrderItem", + nameField: "OrderItemNumber", + }), + }, + { + name: "OrderItemFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "OrderItemFeed", + nameField: "Id", + }), + }, + { + name: "OrderItemHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "OrderItemHistory", + nameField: "Id", + }), + }, + { + name: "OrgDeleteRequest", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "OrgDeleteRequest", + nameField: "Name", + }), + }, + { + name: "OrgWideEmailAddress", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "OrgWideEmailAddress", + nameField: "Id", + }), + }, + { + name: "Organization", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Organization", + nameField: "Name", + }), + }, + { + name: "Partner", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Partner", + nameField: "Id", + }), + }, + { + name: "PartyConsent", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "PartyConsent", + nameField: "Name", + }), + }, + { + name: "PartyConsentFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "PartyConsentFeed", + nameField: "Id", + }), + }, + { + name: "PartyConsentHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "PartyConsentHistory", + nameField: "Id", + }), + }, + { + name: "Payment", + nameField: "PaymentNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Payment", + nameField: "PaymentNumber", + }), + }, + { + name: "PaymentAuthorization", + nameField: "PaymentAuthorizationNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "PaymentAuthorization", + nameField: "PaymentAuthorizationNumber", + }), + }, + { + name: "PaymentGateway", + nameField: "PaymentGatewayName", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "PaymentGateway", + nameField: "PaymentGatewayName", + }), + }, + { + name: "PaymentGatewayLog", + nameField: "PaymentGatewayLogNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "PaymentGatewayLog", + nameField: "PaymentGatewayLogNumber", + }), + }, + { + name: "PaymentGroup", + nameField: "PaymentGroupNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "PaymentGroup", + nameField: "PaymentGroupNumber", + }), + }, + { + name: "PaymentLineInvoice", + nameField: "PaymentLineInvoiceNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "PaymentLineInvoice", + nameField: "PaymentLineInvoiceNumber", + }), + }, + { + name: "Period", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Period", + nameField: "Id", + }), + }, + { + name: "Pricebook2", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Pricebook2", + nameField: "Name", + }), + }, + { + name: "Pricebook2History", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Pricebook2History", + nameField: "Id", + }), + }, + { + name: "PricebookEntry", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "PricebookEntry", + nameField: "Name", + }), + }, + { + name: "PricebookEntryHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "PricebookEntryHistory", + nameField: "Id", + }), + }, + { + name: "ProcessException", + nameField: "ProcessExceptionNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ProcessException", + nameField: "ProcessExceptionNumber", + }), + }, + { + name: "ProcessInstanceNode", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ProcessInstanceNode", + nameField: "Id", + }), + }, + { + name: "Product2", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Product2", + nameField: "Name", + }), + }, + { + name: "Product2Feed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Product2Feed", + nameField: "Id", + }), + }, + { + name: "Product2History", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Product2History", + nameField: "Id", + }), + }, + { + name: "ProductAttribute", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ProductAttribute", + nameField: "Name", + }), + }, + { + name: "ProductAttributeSetProduct", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ProductAttributeSetProduct", + nameField: "Name", + }), + }, + { + name: "ProductCatalog", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ProductCatalog", + nameField: "Name", + }), + }, + { + name: "ProductCatalogFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ProductCatalogFeed", + nameField: "Id", + }), + }, + { + name: "ProductCatalogHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ProductCatalogHistory", + nameField: "Id", + }), + }, + { + name: "ProductCategory", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ProductCategory", + nameField: "Name", + }), + }, + { + name: "ProductCategoryFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ProductCategoryFeed", + nameField: "Id", + }), + }, + { + name: "ProductCategoryHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ProductCategoryHistory", + nameField: "Id", + }), + }, + { + name: "ProductCategoryProduct", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ProductCategoryProduct", + nameField: "Name", + }), + }, + { + name: "ProductCategoryProductHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ProductCategoryProductHistory", + nameField: "Id", + }), + }, + { + name: "ProductConsumptionSchedule", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ProductConsumptionSchedule", + nameField: "Id", + }), + }, + { + name: "Profile", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Profile", + nameField: "Name", + }), + }, + { + name: "Promotion", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Promotion", + nameField: "Name", + }), + }, + { + name: "PromotionFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "PromotionFeed", + nameField: "Id", + }), + }, + { + name: "PromotionHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "PromotionHistory", + nameField: "Id", + }), + }, + { + name: "PromptAction", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "PromptAction", + nameField: "Name", + }), + }, + { + name: "QueueSobject", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "QueueSobject", + nameField: "Id", + }), + }, + { + name: "QuickText", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "QuickText", + nameField: "Name", + }), + }, + { + name: "QuickTextHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "QuickTextHistory", + nameField: "Id", + }), + }, + { + name: "QuickTextUsage", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "QuickTextUsage", + nameField: "Name", + }), + }, + { + name: "QuoteTemplateRichTextData", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "QuoteTemplateRichTextData", + nameField: "Name", + }), + }, + { + name: "Recommendation", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Recommendation", + nameField: "Name", + }), + }, + { + name: "RecordAction", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "RecordAction", + nameField: "Id", + }), + }, + { + name: "RecordType", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "RecordType", + nameField: "Name", + }), + }, + { + name: "Refund", + nameField: "RefundNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Refund", + nameField: "RefundNumber", + }), + }, + { + name: "RefundLinePayment", + nameField: "RefundLinePaymentNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "RefundLinePayment", + nameField: "RefundLinePaymentNumber", + }), + }, + { + name: "ReportAnomalyEventStore", + nameField: "ReportAnomalyEventNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ReportAnomalyEventStore", + nameField: "ReportAnomalyEventNumber", + }), + }, + { + name: "ReportAnomalyEventStoreFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ReportAnomalyEventStoreFeed", + nameField: "Id", + }), + }, + { + name: "ReportFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ReportFeed", + nameField: "Id", + }), + }, + { + name: "ResourceAbsence", + nameField: "AbsenceNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ResourceAbsence", + nameField: "AbsenceNumber", + }), + }, + { + name: "ResourceAbsenceFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ResourceAbsenceFeed", + nameField: "Id", + }), + }, + { + name: "ResourceAbsenceHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ResourceAbsenceHistory", + nameField: "Id", + }), + }, + { + name: "ResourcePreference", + nameField: "ResourcePreferenceNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ResourcePreference", + nameField: "ResourcePreferenceNumber", + }), + }, + { + name: "ResourcePreferenceFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ResourcePreferenceFeed", + nameField: "Id", + }), + }, + { + name: "ResourcePreferenceHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ResourcePreferenceHistory", + nameField: "Id", + }), + }, + { + name: "ReturnOrder", + nameField: "ReturnOrderNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ReturnOrder", + nameField: "ReturnOrderNumber", + }), + }, + { + name: "ReturnOrderFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ReturnOrderFeed", + nameField: "Id", + }), + }, + { + name: "ReturnOrderHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ReturnOrderHistory", + nameField: "Id", + }), + }, + { + name: "ReturnOrderItemAdjustment", + nameField: "ReturnOrderItemAdjustmentNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ReturnOrderItemAdjustment", + nameField: "ReturnOrderItemAdjustmentNumber", + }), + }, + { + name: "ReturnOrderItemTax", + nameField: "ReturnOrderItemTaxNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ReturnOrderItemTax", + nameField: "ReturnOrderItemTaxNumber", + }), + }, + { + name: "ReturnOrderLineItem", + nameField: "ReturnOrderLineItemNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ReturnOrderLineItem", + nameField: "ReturnOrderLineItemNumber", + }), + }, + { + name: "ReturnOrderLineItemFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ReturnOrderLineItemFeed", + nameField: "Id", + }), + }, + { + name: "ReturnOrderLineItemHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ReturnOrderLineItemHistory", + nameField: "Id", + }), + }, + { + name: "Scontrol", + nameField: "DeveloperName", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Scontrol", + nameField: "DeveloperName", + }), + }, + { + name: "SearchPromotionRule", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "SearchPromotionRule", + nameField: "Id", + }), + }, + { + name: "ServiceAppointment", + nameField: "AppointmentNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ServiceAppointment", + nameField: "AppointmentNumber", + }), + }, + { + name: "ServiceAppointmentFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ServiceAppointmentFeed", + nameField: "Id", + }), + }, + { + name: "ServiceAppointmentHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ServiceAppointmentHistory", + nameField: "Id", + }), + }, + { + name: "ServiceContract", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ServiceContract", + nameField: "Name", + }), + }, + { + name: "ServiceContractFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ServiceContractFeed", + nameField: "Id", + }), + }, + { + name: "ServiceContractHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ServiceContractHistory", + nameField: "Id", + }), + }, + { + name: "ServiceResource", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ServiceResource", + nameField: "Name", + }), + }, + { + name: "ServiceResourceFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ServiceResourceFeed", + nameField: "Id", + }), + }, + { + name: "ServiceResourceHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ServiceResourceHistory", + nameField: "Id", + }), + }, + { + name: "ServiceResourceSkill", + nameField: "SkillNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ServiceResourceSkill", + nameField: "SkillNumber", + }), + }, + { + name: "ServiceResourceSkillFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ServiceResourceSkillFeed", + nameField: "Id", + }), + }, + { + name: "ServiceResourceSkillHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ServiceResourceSkillHistory", + nameField: "Id", + }), + }, + { + name: "ServiceTerritory", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ServiceTerritory", + nameField: "Name", + }), + }, + { + name: "ServiceTerritoryFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ServiceTerritoryFeed", + nameField: "Id", + }), + }, + { + name: "ServiceTerritoryHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ServiceTerritoryHistory", + nameField: "Id", + }), + }, + { + name: "ServiceTerritoryMember", + nameField: "MemberNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ServiceTerritoryMember", + nameField: "MemberNumber", + }), + }, + { + name: "ServiceTerritoryMemberFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ServiceTerritoryMemberFeed", + nameField: "Id", + }), + }, + { + name: "ServiceTerritoryMemberHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ServiceTerritoryMemberHistory", + nameField: "Id", + }), + }, + { + name: "ServiceTerritoryWorkType", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ServiceTerritoryWorkType", + nameField: "Name", + }), + }, + { + name: "ServiceTerritoryWorkTypeFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ServiceTerritoryWorkTypeFeed", + nameField: "Id", + }), + }, + { + name: "ServiceTerritoryWorkTypeHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ServiceTerritoryWorkTypeHistory", + nameField: "Id", + }), + }, + { + name: "SessionHijackingEventStore", + nameField: "SessionHijackingEventNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "SessionHijackingEventStore", + nameField: "SessionHijackingEventNumber", + }), + }, + { + name: "SessionHijackingEventStoreFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "SessionHijackingEventStoreFeed", + nameField: "Id", + }), + }, + { + name: "SetupAssistantStep", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "SetupAssistantStep", + nameField: "Name", + }), + }, + { + name: "Shift", + nameField: "ShiftNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Shift", + nameField: "ShiftNumber", + }), + }, + { + name: "ShiftFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ShiftFeed", + nameField: "Id", + }), + }, + { + name: "ShiftHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ShiftHistory", + nameField: "Id", + }), + }, + { + name: "Shipment", + nameField: "ShipmentNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Shipment", + nameField: "ShipmentNumber", + }), + }, + { + name: "ShipmentFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ShipmentFeed", + nameField: "Id", + }), + }, + { + name: "ShipmentHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ShipmentHistory", + nameField: "Id", + }), + }, + { + name: "SiteFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "SiteFeed", + nameField: "Id", + }), + }, + { + name: "SiteHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "SiteHistory", + nameField: "Id", + }), + }, + { + name: "SkillRequirement", + nameField: "SkillNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "SkillRequirement", + nameField: "SkillNumber", + }), + }, + { + name: "SkillRequirementFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "SkillRequirementFeed", + nameField: "Id", + }), + }, + { + name: "SkillRequirementHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "SkillRequirementHistory", + nameField: "Id", + }), + }, + { + name: "Solution", + nameField: "SolutionName", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Solution", + nameField: "SolutionName", + }), + }, + { + name: "SolutionFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "SolutionFeed", + nameField: "Id", + }), + }, + { + name: "SolutionHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "SolutionHistory", + nameField: "Id", + }), + }, + { + name: "StaticResource", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "StaticResource", + nameField: "Name", + }), + }, + { + name: "StreamingChannel", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "StreamingChannel", + nameField: "Name", + }), + }, + { + name: "Task", + nameField: "Subject", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Task", + nameField: "Subject", + }), + }, + { + name: "TaskFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "TaskFeed", + nameField: "Id", + }), + }, + { + name: "ThreatDetectionFeedback", + nameField: "ThreatDetectionFeedbackNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ThreatDetectionFeedback", + nameField: "ThreatDetectionFeedbackNumber", + }), + }, + { + name: "ThreatDetectionFeedbackFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "ThreatDetectionFeedbackFeed", + nameField: "Id", + }), + }, + { + name: "TimeSlot", + nameField: "TimeSlotNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "TimeSlot", + nameField: "TimeSlotNumber", + }), + }, + { + name: "TodayGoal", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "TodayGoal", + nameField: "Name", + }), + }, + { + name: "Topic", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Topic", + nameField: "Name", + }), + }, + { + name: "TopicAssignment", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "TopicAssignment", + nameField: "Id", + }), + }, + { + name: "TopicFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "TopicFeed", + nameField: "Id", + }), + }, + { + name: "User", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "User", + nameField: "Name", + }), + }, + { + name: "UserAppInfo", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "UserAppInfo", + nameField: "Id", + }), + }, + { + name: "UserAppMenuCustomization", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "UserAppMenuCustomization", + nameField: "Id", + }), + }, + { + name: "UserEmailPreferredPerson", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "UserEmailPreferredPerson", + nameField: "Name", + }), + }, + { + name: "UserFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "UserFeed", + nameField: "Id", + }), + }, + { + name: "UserProvAccount", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "UserProvAccount", + nameField: "Name", + }), + }, + { + name: "UserProvAccountStaging", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "UserProvAccountStaging", + nameField: "Name", + }), + }, + { + name: "UserProvMockTarget", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "UserProvMockTarget", + nameField: "Name", + }), + }, + { + name: "UserProvisioningLog", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "UserProvisioningLog", + nameField: "Name", + }), + }, + { + name: "UserProvisioningRequest", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "UserProvisioningRequest", + nameField: "Name", + }), + }, + { + name: "UserRole", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "UserRole", + nameField: "Name", + }), + }, + { + name: "VoiceCall", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "VoiceCall", + nameField: "Id", + }), + }, + { + name: "VoiceCallFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "VoiceCallFeed", + nameField: "Id", + }), + }, + { + name: "VoiceCallRecording", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "VoiceCallRecording", + nameField: "Name", + }), + }, + { + name: "Vote", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "Vote", + nameField: "Id", + }), + }, + { + name: "WaveAutoInstallRequest", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "WaveAutoInstallRequest", + nameField: "Name", + }), + }, + { + name: "WaveCompatibilityCheckItem", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "WaveCompatibilityCheckItem", + nameField: "Name", + }), + }, + { + name: "WebCart", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "WebCart", + nameField: "Name", + }), + }, + { + name: "WebCartHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "WebCartHistory", + nameField: "Id", + }), + }, + { + name: "WebLink", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "WebLink", + nameField: "Name", + }), + }, + { + name: "WebStore", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "WebStore", + nameField: "Name", + }), + }, + { + name: "WebStoreBuyerGroup", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "WebStoreBuyerGroup", + nameField: "Name", + }), + }, + { + name: "WebStoreCatalog", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "WebStoreCatalog", + nameField: "Name", + }), + }, + { + name: "WebStoreCatalogHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "WebStoreCatalogHistory", + nameField: "Id", + }), + }, + { + name: "WorkOrder", + nameField: "WorkOrderNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "WorkOrder", + nameField: "WorkOrderNumber", + }), + }, + { + name: "WorkOrderFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "WorkOrderFeed", + nameField: "Id", + }), + }, + { + name: "WorkOrderHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "WorkOrderHistory", + nameField: "Id", + }), + }, + { + name: "WorkOrderLineItem", + nameField: "LineItemNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "WorkOrderLineItem", + nameField: "LineItemNumber", + }), + }, + { + name: "WorkOrderLineItemFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "WorkOrderLineItemFeed", + nameField: "Id", + }), + }, + { + name: "WorkOrderLineItemHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "WorkOrderLineItemHistory", + nameField: "Id", + }), + }, + { + name: "WorkPlan", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "WorkPlan", + nameField: "Name", + }), + }, + { + name: "WorkPlanFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "WorkPlanFeed", + nameField: "Id", + }), + }, + { + name: "WorkPlanHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "WorkPlanHistory", + nameField: "Id", + }), + }, + { + name: "WorkPlanTemplate", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "WorkPlanTemplate", + nameField: "Name", + }), + }, + { + name: "WorkPlanTemplateEntry", + nameField: "WorkPlanTemplateEntryNumber", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "WorkPlanTemplateEntry", + nameField: "WorkPlanTemplateEntryNumber", + }), + }, + { + name: "WorkStep", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "WorkStep", + nameField: "Name", + }), + }, + { + name: "WorkStepTemplate", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "WorkStepTemplate", + nameField: "Name", + }), + }, + { + name: "WorkType", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "WorkType", + nameField: "Name", + }), + }, + { + name: "WorkTypeFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "WorkTypeFeed", + nameField: "Id", + }), + }, + { + name: "WorkTypeGroup", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "WorkTypeGroup", + nameField: "Name", + }), + }, + { + name: "WorkTypeGroupFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "WorkTypeGroupFeed", + nameField: "Id", + }), + }, + { + name: "WorkTypeGroupHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "WorkTypeGroupHistory", + nameField: "Id", + }), + }, + { + name: "WorkTypeGroupMember", + nameField: "Name", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "WorkTypeGroupMember", + nameField: "Name", + }), + }, + { + name: "WorkTypeGroupMemberFeed", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "WorkTypeGroupMemberFeed", + nameField: "Id", + }), + }, + { + name: "WorkTypeGroupMemberHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "WorkTypeGroupMemberHistory", + nameField: "Id", + }), + }, + { + name: "WorkTypeHistory", + nameField: "Id", + getRecords: () => + this.salesforce.listRecordOptions({ + objType: "WorkTypeHistory", + nameField: "Id", + }), + }, +]; +export default sobjects; diff --git a/components/salesforce_rest_api/salesforce_rest_api.app.mjs b/components/salesforce_rest_api/salesforce_rest_api.app.mjs index 40c88d319a9a2..65bf68bccf0bc 100644 --- a/components/salesforce_rest_api/salesforce_rest_api.app.mjs +++ b/components/salesforce_rest_api/salesforce_rest_api.app.mjs @@ -542,19 +542,22 @@ export default { }, async listRecordOptions({ objType, - fields = [ - "Id", - "Name", - ], - getLabel = (item) => item[fields[1]], - getValue = (item) => item[fields[0]], + nameField = "Name", }) { + const fields = [ + "Id", + ...nameField === "Id" + ? [] + : [ + nameField, + ], + ]; const { records } = await this.query({ query: `SELECT ${fields.join(", ")} FROM ${objType}`, }); return records?.map?.((item) => ({ - label: getLabel(item), - value: getValue(item), + label: item[nameField], + value: item.Id, })) ?? []; }, async search({ From adab85fed979f57f9f6ade96d3055c0477cb03ef Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Tue, 23 Jul 2024 02:26:22 -0300 Subject: [PATCH 081/106] Reusing field to prop generator --- .../actions/create-record/create-record.mjs | 72 ++----------------- .../common/props-utils.mjs | 64 +++++++---------- 2 files changed, 32 insertions(+), 104 deletions(-) diff --git a/components/salesforce_rest_api/actions/create-record/create-record.mjs b/components/salesforce_rest_api/actions/create-record/create-record.mjs index 88442283d2c63..46e61c3256589 100644 --- a/components/salesforce_rest_api/actions/create-record/create-record.mjs +++ b/components/salesforce_rest_api/actions/create-record/create-record.mjs @@ -1,7 +1,8 @@ -import { getAdditionalFields } from "../../common/props-utils.mjs"; +import { + convertFieldsToProps, getAdditionalFields, +} from "../../common/props-utils.mjs"; import salesforce from "../../salesforce_rest_api.app.mjs"; import { additionalFields } from "../common/base.mjs"; -import allSobjects from "../../common/all-sobjects.mjs"; export default { key: "salesforce_rest_api-create-record", @@ -22,19 +23,7 @@ export default { }, methods: { getAdditionalFields, - getFieldPropType(fieldType) { - // https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/field_types.htm - switch (fieldType) { - case "boolean": - return "boolean"; - case "int": - return "integer"; - case "multipicklist": - return "string[]"; - default: - return "string"; - } - }, + convertFieldsToProps, }, async additionalProps() { const { objectType } = this; @@ -44,58 +33,7 @@ export default { return field.createable && !field.nillable && !field.defaultedOnCreate; }); - const requiredFieldProps = requiredFields - .map((field) => { - const { type } = field; - const prop = { - type: this.getFieldPropType(type), - label: field.name, - description: `Field type: \`${type}\``, - }; - if ([ - "date", - "datetime", - ].includes(type)) { - prop.description = `This is a \`${type}\` field. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_valid_date_formats.htm) for the expected format.`; - } else if ( - [ - "picklist", - "multipicklist", - ].includes(type) && - field.picklistValues?.length - ) { - prop.description = `Select ${ - type === "picklist" - ? "a value" - : "one or more values" - } from the list.`; - prop.options = field.picklistValues.map(({ - label, value, - }) => ({ - label, - value, - })); - } else if (type === "reference") { - if (field.referenceTo?.length === 1) { - const objName = field.referenceTo[0]; - prop.description = `The ID of a${objName.startsWith("A") - ? "n" - : ""} \`${objName}\` record.`; - const optionsFn = allSobjects.find(({ name }) => name === objName)?.getRecords; - if (optionsFn) prop.options = optionsFn; - } else if (field.referenceTo?.length > 1) { - prop.description = `The ID of a record of one of these object types: ${field.referenceTo - .map((s) => `\`${s}\``) - .join(", ")}`; - } - } - - return prop; - }) - .reduce((obj, prop) => { - obj[prop.label] = prop; - return obj; - }, {}); + const requiredFieldProps = this.convertFieldsToProps(requiredFields); return { docsInfo: { diff --git a/components/salesforce_rest_api/common/props-utils.mjs b/components/salesforce_rest_api/common/props-utils.mjs index 0d61e529c5fee..86b16e1c80441 100644 --- a/components/salesforce_rest_api/common/props-utils.mjs +++ b/components/salesforce_rest_api/common/props-utils.mjs @@ -1,3 +1,5 @@ +import allSobjects from "./all-sobjects.mjs"; + function toCapitalCase(str) { return str .split(" ") @@ -61,21 +63,21 @@ export function getAdditionalFields() { ); } -function getFieldPropType(fieldType) { - // https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/field_types.htm - switch (fieldType) { - case "boolean": - return "boolean"; - case "int": - return "integer"; - case "multipicklist": - return "string[]"; - default: - return "string"; +export const convertFieldsToProps = (fields) => { + function getFieldPropType(fieldType) { + // https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/field_types.htm + switch (fieldType) { + case "boolean": + return "boolean"; + case "int": + return "integer"; + case "multipicklist": + return "string[]"; + default: + return "string"; + } } -} -export const convertFieldsToProps = (fields) => { return fields .map((field) => { const { type } = field; @@ -109,32 +111,20 @@ export const convertFieldsToProps = (fields) => { })); } else if (type === "reference") { if (field.referenceTo?.length === 1) { - const objType = field.referenceTo[0]; - prop.description = `The ID of a${objType.startsWith("A") - ? "n" - : ""} \`${objType}\` record.`; - prop.options = async () => { - let response; - try { - response = await this.salesforce.listRecordOptions({ - objType, - }); - } catch (err) { - response = await this.salesforce.listRecordOptions({ - objType, - fields: [ - "Id", - ], - getLabel: (item) => `ID ${item.Id}`, - }); - } - return response; - }; + const objName = field.referenceTo[0]; + prop.description = `The ID of a${ + objName.startsWith("A") + ? "n" + : "" + } \`${objName}\` record.`; + const optionsFn = allSobjects.find( + ({ name }) => name === objName, + )?.getRecords; + if (optionsFn) prop.options = optionsFn; } else if (field.referenceTo?.length > 1) { - const fieldNames = field.referenceTo + prop.description = `The ID of a record of one of these object types: ${field.referenceTo .map((s) => `\`${s}\``) - .join(", "); - prop.description = `The ID of a record of one of these object types: ${fieldNames}`; + .join(", ")}`; } } From a9d863758e767df3f787ef78621b991528090589 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Tue, 23 Jul 2024 02:58:45 -0300 Subject: [PATCH 082/106] Adjusting actions to use recordId propDefinition --- .../add-contact-to-campaign.mjs | 31 +++++++++++-------- .../add-lead-to-campaign.mjs | 31 +++++++++++-------- .../delete-opportunity/delete-opportunity.mjs | 16 +++++----- .../actions/update-account/update-account.mjs | 15 +++++---- .../actions/update-contact/update-contact.mjs | 15 +++++---- .../update-opportunity/update-opportunity.mjs | 15 +++++---- .../common/props-async-options.mjs | 2 ++ .../common/sobjects/attachment.mjs | 16 +++++----- .../common/sobjects/case.mjs | 16 ++++++---- .../common/sobjects/caseComment.mjs | 24 ++++++-------- .../common/sobjects/event.mjs | 2 ++ .../common/sobjects/note.mjs | 16 +++++----- .../common/sobjects/opportunity.mjs | 16 ++++++---- .../common/sobjects/user.mjs | 16 ++++++---- .../salesforce_rest_api.app.mjs | 27 +++++----------- 15 files changed, 140 insertions(+), 118 deletions(-) diff --git a/components/salesforce_rest_api/actions/add-contact-to-campaign/add-contact-to-campaign.mjs b/components/salesforce_rest_api/actions/add-contact-to-campaign/add-contact-to-campaign.mjs index f03242d75cdd3..e4b530aac9678 100644 --- a/components/salesforce_rest_api/actions/add-contact-to-campaign/add-contact-to-campaign.mjs +++ b/components/salesforce_rest_api/actions/add-contact-to-campaign/add-contact-to-campaign.mjs @@ -1,6 +1,5 @@ import salesforce from "../../salesforce_rest_api.app.mjs"; import constants from "../../common/constants.mjs"; -import commonProps from "../../common/props-async-options.mjs"; export default { key: "salesforce_rest_api-add-contact-to-campaign", @@ -11,22 +10,28 @@ export default { props: { salesforce, campaignId: { - ...commonProps.CampaignId, - description: "The Campaign to add a Contact to.", - async options() { - return this.salesforce.listRecordOptions({ + propDefinition: [ + salesforce, + "recordId", + () => ({ objType: "Campaign", - }); - }, + nameField: "Name", + }), + ], + label: "Campaign ID", + description: "The Campaign to add a Contact to.", }, contactId: { - ...commonProps.ContactId, - description: "The Contact to add to the selected Campaign.", - async options() { - return this.salesforce.listRecordOptions({ + propDefinition: [ + salesforce, + "recordId", + () => ({ objType: "Contact", - }); - }, + nameField: "Name", + }), + ], + label: "Contact ID", + description: "The Contact to add to the selected Campaign.", }, }, async run({ $ }) { diff --git a/components/salesforce_rest_api/actions/add-lead-to-campaign/add-lead-to-campaign.mjs b/components/salesforce_rest_api/actions/add-lead-to-campaign/add-lead-to-campaign.mjs index 206d789d9f98e..ac4dc7fe5aa01 100644 --- a/components/salesforce_rest_api/actions/add-lead-to-campaign/add-lead-to-campaign.mjs +++ b/components/salesforce_rest_api/actions/add-lead-to-campaign/add-lead-to-campaign.mjs @@ -1,6 +1,5 @@ import salesforce from "../../salesforce_rest_api.app.mjs"; import constants from "../../common/constants.mjs"; -import commonProps from "../../common/props-async-options.mjs"; export default { key: "salesforce_rest_api-add-lead-to-campaign", @@ -11,22 +10,28 @@ export default { props: { salesforce, campaignId: { - ...commonProps.CampaignId, - description: "The Campaign to add a Lead to.", - async options() { - return this.salesforce.listRecordOptions({ + propDefinition: [ + salesforce, + "recordId", + () => ({ objType: "Campaign", - }); - }, + nameField: "Name", + }), + ], + label: "Campaign ID", + description: "The Campaign to add a Lead to.", }, leadId: { - ...commonProps.LeadId, - description: "The Lead to add to the selected Campaign.", - async options() { - return this.salesforce.listRecordOptions({ + propDefinition: [ + salesforce, + "recordId", + () => ({ objType: "Lead", - }); - }, + nameField: "Name", + }), + ], + label: "Lead ID", + description: "The Lead to add to the selected Campaign.", }, }, async run({ $ }) { diff --git a/components/salesforce_rest_api/actions/delete-opportunity/delete-opportunity.mjs b/components/salesforce_rest_api/actions/delete-opportunity/delete-opportunity.mjs index c142d1f800225..4813d599c62ab 100644 --- a/components/salesforce_rest_api/actions/delete-opportunity/delete-opportunity.mjs +++ b/components/salesforce_rest_api/actions/delete-opportunity/delete-opportunity.mjs @@ -1,4 +1,3 @@ -import propsAsyncOptions from "../../common/props-async-options.mjs"; import salesforce from "../../salesforce_rest_api.app.mjs"; export default { @@ -10,13 +9,16 @@ export default { props: { salesforce, opportunityId: { - ...propsAsyncOptions.OpportunityId, - description: "ID of the opportunity to delete.", - async options() { - return this.salesforce.listRecordOptions({ + propDefinition: [ + salesforce, + "recordId", + () => ({ objType: "Opportunity", - }); - }, + nameField: "Name", + }), + ], + label: "Opportunity ID", + description: "ID of the opportunity to delete.", }, }, async run({ $ }) { diff --git a/components/salesforce_rest_api/actions/update-account/update-account.mjs b/components/salesforce_rest_api/actions/update-account/update-account.mjs index db46adeb95406..418f4eeca56ab 100644 --- a/components/salesforce_rest_api/actions/update-account/update-account.mjs +++ b/components/salesforce_rest_api/actions/update-account/update-account.mjs @@ -1,7 +1,6 @@ import common, { getProps } from "../common/base.mjs"; import account from "../../common/sobjects/account.mjs"; import { docsLink } from "../create-account/create-account.mjs"; -import propsAsyncOptions from "../../common/props-async-options.mjs"; const { salesforce, ...props @@ -27,12 +26,16 @@ export default { props: { salesforce, accountId: { - ...propsAsyncOptions.AccountId, - async options() { - return this.salesforce.listRecordOptions({ + propDefinition: [ + salesforce, + "recordId", + () => ({ objType: "Account", - }); - }, + nameField: "Name", + }), + ], + label: "Account ID", + description: "The Account to update.", }, ...props, }, diff --git a/components/salesforce_rest_api/actions/update-contact/update-contact.mjs b/components/salesforce_rest_api/actions/update-contact/update-contact.mjs index ae02b040a642d..596d34b016112 100644 --- a/components/salesforce_rest_api/actions/update-contact/update-contact.mjs +++ b/components/salesforce_rest_api/actions/update-contact/update-contact.mjs @@ -1,7 +1,6 @@ import common, { getProps } from "../common/base.mjs"; import contact from "../../common/sobjects/contact.mjs"; import { docsLink } from "../create-contact/create-contact.mjs"; -import propsAsyncOptions from "../../common/props-async-options.mjs"; const { salesforce, ...props @@ -28,12 +27,16 @@ export default { props: { salesforce, contactId: { - ...propsAsyncOptions.ContactId, - async options() { - return this.salesforce.listRecordOptions({ + propDefinition: [ + salesforce, + "recordId", + () => ({ objType: "Contact", - }); - }, + nameField: "Name", + }), + ], + label: "Contact ID", + description: "The Contact to update.", }, ...props, }, diff --git a/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs b/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs index 7e159bd79d5f6..2864b4a8ecae0 100644 --- a/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs +++ b/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs @@ -1,7 +1,6 @@ import common, { getProps } from "../common/base.mjs"; import opportunity from "../../common/sobjects/opportunity.mjs"; import { docsLink } from "../create-opportunity/create-opportunity.mjs"; -import propsAsyncOptions from "../../common/props-async-options.mjs"; const { salesforce, ...props @@ -28,12 +27,16 @@ export default { props: { salesforce, opportunityId: { - ...propsAsyncOptions.OpportunityId, - async options() { - return this.salesforce.listRecordOptions({ + propDefinition: [ + salesforce, + "recordId", + () => ({ objType: "Opportunity", - }); - }, + nameField: "Name", + }), + ], + label: "Opportunity ID", + description: "The Opportunity to update.", }, ...props, }, diff --git a/components/salesforce_rest_api/common/props-async-options.mjs b/components/salesforce_rest_api/common/props-async-options.mjs index 58cb0e6f7241b..2383c37912e40 100644 --- a/components/salesforce_rest_api/common/props-async-options.mjs +++ b/components/salesforce_rest_api/common/props-async-options.mjs @@ -105,9 +105,11 @@ export default { options: async () => { const contacts = await this.salesforce.listRecordOptions({ objType: "Contact", + nameField: "Name", }); const leads = await this.salesforce.listRecordOptions({ objType: "Lead", + nameField: "Name", }); return [ ...(contacts ?? []), diff --git a/components/salesforce_rest_api/common/sobjects/attachment.mjs b/components/salesforce_rest_api/common/sobjects/attachment.mjs index 26947ce451234..fc01ea14726d8 100644 --- a/components/salesforce_rest_api/common/sobjects/attachment.mjs +++ b/components/salesforce_rest_api/common/sobjects/attachment.mjs @@ -1,4 +1,4 @@ -import commonProps from "../props-async-options.mjs"; +import salesforce from "../../salesforce_rest_api.app.mjs"; export default { createProps: { @@ -45,15 +45,17 @@ export default { optional: true, }, OwnerId: { - ...commonProps.UserId, + propDefinition: [ + salesforce, + "recordId", + () => ({ + objType: "User", + nameField: "Name", + }), + ], label: "Owner ID", description: "ID of the user who owns the attachment.", optional: true, - async options () { - return this.salesforce.listRecordOptions({ - objType: "User", - }); - }, }, }, }; diff --git a/components/salesforce_rest_api/common/sobjects/case.mjs b/components/salesforce_rest_api/common/sobjects/case.mjs index 7fb7b957b8e7a..57275071b6872 100644 --- a/components/salesforce_rest_api/common/sobjects/case.mjs +++ b/components/salesforce_rest_api/common/sobjects/case.mjs @@ -1,15 +1,19 @@ import commonProps from "../props-async-options.mjs"; +import salesforce from "../../salesforce_rest_api.app.mjs"; export default { initialProps: { ServiceContractId: { - ...commonProps.ServiceContractId, - description: "ID of the ServiceContract associated with the entitlement.", - async options () { - return this.salesforce.listRecordOptions({ + propDefinition: [ + salesforce, + "recordId", + () => ({ objType: "ServiceContract", - }); - }, + nameField: "Name", + }), + ], + label: "Service Contract ID", + description: "ID of the ServiceContract associated with the entitlement.", }, Description: { type: "string", diff --git a/components/salesforce_rest_api/common/sobjects/caseComment.mjs b/components/salesforce_rest_api/common/sobjects/caseComment.mjs index 458183e07a086..74857cb62e316 100644 --- a/components/salesforce_rest_api/common/sobjects/caseComment.mjs +++ b/components/salesforce_rest_api/common/sobjects/caseComment.mjs @@ -1,4 +1,4 @@ -import commonProps from "../props-async-options.mjs"; +import salesforce from "../../salesforce_rest_api.app.mjs"; export default { initialProps: { @@ -9,22 +9,16 @@ export default { optional: true, }, ParentId: { - ...commonProps.CaseId, + propDefinition: [ + salesforce, + "recordId", + () => ({ + objType: "Case", + nameField: "CaseNumber", + }), + ], label: "Parent Case ID", description: "ID of the parent Case.", - async options() { - return this.salesforce.listRecordOptions({ - objType: "Case", - fields: [ - "Id", - "CaseNumber", - "Subject", - "SuppliedName", - ], - getLabel: (item) => - item.SuppliedName ?? item.Subject ?? item.CaseNumber, - }); - }, }, IsNotificationSelected: { type: "boolean", diff --git a/components/salesforce_rest_api/common/sobjects/event.mjs b/components/salesforce_rest_api/common/sobjects/event.mjs index 5e1ea0ff2cdd3..56cdcc168a52a 100644 --- a/components/salesforce_rest_api/common/sobjects/event.mjs +++ b/components/salesforce_rest_api/common/sobjects/event.mjs @@ -13,9 +13,11 @@ export default { async options() { const contacts = await this.salesforce.listRecordOptions({ objType: "Contact", + nameField: "Name", }); const leads = await this.salesforce.listRecordOptions({ objType: "Lead", + nameField: "Name", }); return [ ...(contacts ?? []), diff --git a/components/salesforce_rest_api/common/sobjects/note.mjs b/components/salesforce_rest_api/common/sobjects/note.mjs index 2a60ed4ae78c3..1016a567f7e21 100644 --- a/components/salesforce_rest_api/common/sobjects/note.mjs +++ b/components/salesforce_rest_api/common/sobjects/note.mjs @@ -1,4 +1,4 @@ -import commonProps from "../props-async-options.mjs"; +import salesforce from "../../salesforce_rest_api.app.mjs"; export default { initialProps: { @@ -14,15 +14,17 @@ export default { optional: true, }, OwnerId: { - ...commonProps.UserId, + propDefinition: [ + salesforce, + "recordId", + () => ({ + objType: "User", + nameField: "Name", + }), + ], label: "Owner ID", description: "ID of the user who owns the note.", optional: true, - async options () { - return this.salesforce.listRecordOptions({ - objType: "User", - }); - }, }, ParentId: { type: "string", diff --git a/components/salesforce_rest_api/common/sobjects/opportunity.mjs b/components/salesforce_rest_api/common/sobjects/opportunity.mjs index 0444d47fbc860..1dc19b34df326 100644 --- a/components/salesforce_rest_api/common/sobjects/opportunity.mjs +++ b/components/salesforce_rest_api/common/sobjects/opportunity.mjs @@ -1,18 +1,22 @@ import { RECORD_SOURCE_OPTIONS } from "../constants-props.mjs"; import commonProps from "../props-async-options.mjs"; +import salesforce from "../../salesforce_rest_api.app.mjs"; export default { createProps: { ContactId: { - ...commonProps.ContactId, + propDefinition: [ + salesforce, + "recordId", + () => ({ + objType: "Contact", + nameField: "Name", + }), + ], + label: "Contact ID", description: "ID of the contact associated with this opportunity, set as the primary contact.", optional: true, - async options() { - return this.salesforce.listRecordOptions({ - objType: "Contact", - }); - }, }, }, initialProps: { diff --git a/components/salesforce_rest_api/common/sobjects/user.mjs b/components/salesforce_rest_api/common/sobjects/user.mjs index 0c424ca2eba59..423573ae48a24 100644 --- a/components/salesforce_rest_api/common/sobjects/user.mjs +++ b/components/salesforce_rest_api/common/sobjects/user.mjs @@ -1,3 +1,4 @@ +import salesforce from "../../salesforce_rest_api.app.mjs"; import { EMAIL_ENCODING_OPTIONS, GEOCODE_ACCURACY_OPTIONS, @@ -79,14 +80,17 @@ export default { options: LOCALE_OPTIONS, }, ProfileId: { - ...commonProps.ProfileId, + propDefinition: [ + salesforce, + "recordId", + () => ({ + objType: "Profile", + nameField: "Name", + }), + ], + label: "Profile ID", description: "ID of the user's Profile. Use this value to cache metadata based on profile.", - async options() { - return this.salesforce.listRecordOptions({ - objType: "Profile", - }); - }, }, TimeZoneSidKey: { type: "string", diff --git a/components/salesforce_rest_api/salesforce_rest_api.app.mjs b/components/salesforce_rest_api/salesforce_rest_api.app.mjs index 65bf68bccf0bc..85e11b5647d41 100644 --- a/components/salesforce_rest_api/salesforce_rest_api.app.mjs +++ b/components/salesforce_rest_api/salesforce_rest_api.app.mjs @@ -44,26 +44,13 @@ export default { description: "The ID of the record of the selected object type.", async options({ objType, - fields, - getLabel, + nameField, }) { - let response; - try { - response = await this.listRecordOptions({ - objType, - fields, - getLabel, - }); - } catch (err) { - response = await this.listRecordOptions({ - objType, - fields: [ - "Id", - ], - getLabel: (item) => `ID ${item.Id}`, - }); - } - return response; + if (!nameField) nameField = await this.getNameFieldForObjectType(objType); + return this.listRecordOptions({ + objType, + nameField, + }); }, }, field: { @@ -542,7 +529,7 @@ export default { }, async listRecordOptions({ objType, - nameField = "Name", + nameField = "Id", }) { const fields = [ "Id", From 0ae66dd7994197d62b89aa81970158251316af78 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Tue, 23 Jul 2024 03:11:50 -0300 Subject: [PATCH 083/106] Reusing allSobjects mapping for common props --- .../common/props-async-options.mjs | 140 ++++-------------- 1 file changed, 32 insertions(+), 108 deletions(-) diff --git a/components/salesforce_rest_api/common/props-async-options.mjs b/components/salesforce_rest_api/common/props-async-options.mjs index 2383c37912e40..3438a96a6d508 100644 --- a/components/salesforce_rest_api/common/props-async-options.mjs +++ b/components/salesforce_rest_api/common/props-async-options.mjs @@ -2,101 +2,65 @@ // whereas when using regular props, the standard method syntax is needed instead. // These props are more commonly used in additionalProps, so all are defined as such, // and the options method needs to be redefined if used in regular props. + +import allSobjects from "./all-sobjects.mjs"; + +const findSobjectOptions = (objName) => { + return allSobjects.find(({ name }) => name === objName)?.getRecords; +}; + export default { AccountId: { type: "string", label: "Account ID", description: "The ID of an Account.", - options: async () => { - return this.salesforce.listRecordOptions({ - objType: "Account", - }); - }, + options: findSobjectOptions("Account"), }, BusinessHoursId: { type: "string", label: "Business Hours ID", description: "The ID of a Business Hours record.", - options: async () => { - return this.salesforce.listRecordOptions({ - objType: "BusinessHours", - }); - }, + options: findSobjectOptions("BusinessHours"), }, CallCenterId: { type: "string", label: "Call Center ID", description: "The ID of a Call Center.", - options: async () => { - return this.salesforce.listRecordOptions({ - objType: "CallCenter", - }); - }, + options: findSobjectOptions("CallCenter"), }, CampaignId: { type: "string", label: "Campaign ID", description: "The ID of a Campaign.", - options: async () => { - return this.salesforce.listRecordOptions({ - objType: "Campaign", - }); - }, + options: findSobjectOptions("Campaign"), }, CaseId: { type: "string", label: "Case ID", description: "The ID of a Case.", - options: async () => { - return this.salesforce.listRecordOptions({ - objType: "Case", - fields: [ - "Id", - "CaseNumber", - "Subject", - "SuppliedName", - ], - getLabel: (item) => item.SuppliedName ?? item.Subject ?? item.CaseNumber, - }); - }, + options: findSobjectOptions("Case"), }, CommunityId: { type: "string", label: "Community ID", description: "The ID of a Community (Zone) record.", - options: async () => { - return this.salesforce.listRecordOptions({ + options: () => + this.salesforce.listRecordOptions({ objType: "Community", - }); - }, + nameField: "Name", + }), }, ContactId: { type: "string", label: "Contact ID", description: "The ID of a Contact.", - options: async () => { - return this.salesforce.listRecordOptions({ - objType: "Contact", - }); - }, + options: findSobjectOptions("Contact"), }, ContractId: { type: "string", label: "Contract ID", description: "The ID of a Contract.", - options: async () => { - return this.salesforce.listRecordOptions({ - objType: "Contract", - fields: [ - "Id", - "ContractNumber", - "Description", - ], - getLabel: (item) => item.ContractNumber + (item.Description - ? ` - ${item.Description}` - : ""), - }); - }, + options: findSobjectOptions("Contract"), }, ContactOrLeadIds: { type: "string[]", @@ -121,110 +85,70 @@ export default { type: "string", label: "Individual ID", description: "The ID of an Individual.", - options: async () => { - return this.salesforce.listRecordOptions({ - objType: "Individual", - }); - }, + options: findSobjectOptions("Individual"), }, LeadId: { type: "string", label: "Lead ID", description: "The ID of a Lead.", - options: async () => { - return this.salesforce.listRecordOptions({ - objType: "Lead", - }); - }, + options: findSobjectOptions("Lead"), }, OperatingHoursId: { type: "string", label: "Operating Hours ID", description: "The ID of an Operating Hours record.", - options: async () => { - return this.salesforce.listRecordOptions({ - objType: "OperatingHours", - }); - }, + options: findSobjectOptions("OperatingHours"), }, OpportunityId: { type: "string", label: "Opportunity ID", description: "The ID of an Opportunity.", - options: async () => { - return this.salesforce.listRecordOptions({ - objType: "Opportunity", - }); - }, + options: findSobjectOptions("Opportunity"), }, Pricebook2Id: { type: "string", label: "Pricebook2 ID", description: "The ID of a Pricebook2 record.", - options: async () => { - return this.salesforce.listRecordOptions({ - objType: "Pricebook2", - }); - }, + options: findSobjectOptions("Pricebook2"), }, ProfileId: { type: "string", label: "Profile ID", description: "The ID of a Profile.", - options: async () => { - return this.salesforce.listRecordOptions({ - objType: "Profile", - }); - }, + options: findSobjectOptions("Profile"), }, ServiceContractId: { type: "string", label: "ServiceContract ID", description: "The ID of a Service Contract record.", - options: async () => { - return this.salesforce.listRecordOptions({ - objType: "ServiceContract", - }); - }, + options: findSobjectOptions("ServiceContract"), }, UserId: { type: "string", label: "User ID", description: "The ID of a User in your organization.", - options: async () => { - return this.salesforce.listRecordOptions({ - objType: "User", - }); - }, + options: findSobjectOptions("User"), }, UserRoleId: { type: "string", label: "User Role ID", description: "The ID of a User Role record.", - options: async () => { - return this.salesforce.listRecordOptions({ - objType: "UserRole", - }); - }, + options: findSobjectOptions("UserRole"), }, QuestionId: { type: "string", label: "Question ID", description: "The ID of a Question.", - options: async () => { - return this.salesforce.listRecordOptions({ + options: () => + this.salesforce.listRecordOptions({ objType: "Question", - }); - }, + nameField: "Title", + }), }, RecordTypeId: { type: "string", label: "Record Type ID", description: "ID of the record type assigned to this record.", - options: async () => { - return this.salesforce.listRecordOptions({ - objType: "RecordType", - }); - }, + options: findSobjectOptions("RecordType"), }, }; From 7beef8417520d95948080fbfdff6cbe7f6915ac7 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Tue, 23 Jul 2024 03:17:50 -0300 Subject: [PATCH 084/106] Rename common action file --- .../actions/common/{base.mjs => base-create-update.mjs} | 0 .../actions/create-account/create-account.mjs | 2 +- .../actions/create-attachment/create-attachment.mjs | 2 +- .../actions/create-campaign/create-campaign.mjs | 2 +- .../salesforce_rest_api/actions/create-case/create-case.mjs | 2 +- .../actions/create-casecomment/create-casecomment.mjs | 2 +- .../actions/create-contact/create-contact.mjs | 2 +- .../salesforce_rest_api/actions/create-event/create-event.mjs | 2 +- .../salesforce_rest_api/actions/create-lead/create-lead.mjs | 2 +- .../salesforce_rest_api/actions/create-note/create-note.mjs | 2 +- .../actions/create-opportunity/create-opportunity.mjs | 2 +- .../salesforce_rest_api/actions/create-record/create-record.mjs | 2 +- .../salesforce_rest_api/actions/create-task/create-task.mjs | 2 +- .../salesforce_rest_api/actions/create-user/create-user.mjs | 2 +- .../actions/update-account/update-account.mjs | 2 +- .../actions/update-contact/update-contact.mjs | 2 +- .../actions/update-opportunity/update-opportunity.mjs | 2 +- 17 files changed, 16 insertions(+), 16 deletions(-) rename components/salesforce_rest_api/actions/common/{base.mjs => base-create-update.mjs} (100%) diff --git a/components/salesforce_rest_api/actions/common/base.mjs b/components/salesforce_rest_api/actions/common/base-create-update.mjs similarity index 100% rename from components/salesforce_rest_api/actions/common/base.mjs rename to components/salesforce_rest_api/actions/common/base-create-update.mjs diff --git a/components/salesforce_rest_api/actions/create-account/create-account.mjs b/components/salesforce_rest_api/actions/create-account/create-account.mjs index 63b9a3107e03b..830c87be8920f 100644 --- a/components/salesforce_rest_api/actions/create-account/create-account.mjs +++ b/components/salesforce_rest_api/actions/create-account/create-account.mjs @@ -1,4 +1,4 @@ -import common, { getProps } from "../common/base.mjs"; +import common, { getProps } from "../common/base-create-update.mjs"; import account from "../../common/sobjects/account.mjs"; export const docsLink = "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_account.htm"; diff --git a/components/salesforce_rest_api/actions/create-attachment/create-attachment.mjs b/components/salesforce_rest_api/actions/create-attachment/create-attachment.mjs index 868d8bf5bda5f..2f407b14db082 100644 --- a/components/salesforce_rest_api/actions/create-attachment/create-attachment.mjs +++ b/components/salesforce_rest_api/actions/create-attachment/create-attachment.mjs @@ -1,4 +1,4 @@ -import common, { getProps } from "../common/base.mjs"; +import common, { getProps } from "../common/base-create-update.mjs"; import attachment from "../../common/sobjects/attachment.mjs"; import fs from "fs"; diff --git a/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs b/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs index e06df98840798..e3e6b6e98f3c5 100644 --- a/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs +++ b/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs @@ -1,4 +1,4 @@ -import common, { getProps } from "../common/base.mjs"; +import common, { getProps } from "../common/base-create-update.mjs"; import campaign from "../../common/sobjects/campaign.mjs"; const docsLink = "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_campaign.htm"; diff --git a/components/salesforce_rest_api/actions/create-case/create-case.mjs b/components/salesforce_rest_api/actions/create-case/create-case.mjs index e2e0ba91191cb..4dcb564724486 100644 --- a/components/salesforce_rest_api/actions/create-case/create-case.mjs +++ b/components/salesforce_rest_api/actions/create-case/create-case.mjs @@ -1,4 +1,4 @@ -import common, { getProps } from "../common/base.mjs"; +import common, { getProps } from "../common/base-create-update.mjs"; import caseObj from "../../common/sobjects/case.mjs"; const docsLink = "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_case.htm"; diff --git a/components/salesforce_rest_api/actions/create-casecomment/create-casecomment.mjs b/components/salesforce_rest_api/actions/create-casecomment/create-casecomment.mjs index d6419136c1281..fa33e3eecc442 100644 --- a/components/salesforce_rest_api/actions/create-casecomment/create-casecomment.mjs +++ b/components/salesforce_rest_api/actions/create-casecomment/create-casecomment.mjs @@ -1,4 +1,4 @@ -import common, { getProps } from "../common/base.mjs"; +import common, { getProps } from "../common/base-create-update.mjs"; import caseComment from "../../common/sobjects/caseComment.mjs"; const docsLink = "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_casecomment.htm"; diff --git a/components/salesforce_rest_api/actions/create-contact/create-contact.mjs b/components/salesforce_rest_api/actions/create-contact/create-contact.mjs index c71e565f88b4e..b78f99dc3e18e 100644 --- a/components/salesforce_rest_api/actions/create-contact/create-contact.mjs +++ b/components/salesforce_rest_api/actions/create-contact/create-contact.mjs @@ -1,4 +1,4 @@ -import common, { getProps } from "../common/base.mjs"; +import common, { getProps } from "../common/base-create-update.mjs"; import contact from "../../common/sobjects/contact.mjs"; export const docsLink = "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_contact.htm"; diff --git a/components/salesforce_rest_api/actions/create-event/create-event.mjs b/components/salesforce_rest_api/actions/create-event/create-event.mjs index a3d0c335d4f9c..a8f741ef1b130 100644 --- a/components/salesforce_rest_api/actions/create-event/create-event.mjs +++ b/components/salesforce_rest_api/actions/create-event/create-event.mjs @@ -1,4 +1,4 @@ -import common, { getProps } from "../common/base.mjs"; +import common, { getProps } from "../common/base-create-update.mjs"; import event from "../../common/sobjects/event.mjs"; const docsLink = diff --git a/components/salesforce_rest_api/actions/create-lead/create-lead.mjs b/components/salesforce_rest_api/actions/create-lead/create-lead.mjs index 40723991fe8fb..ca954eebb85c9 100644 --- a/components/salesforce_rest_api/actions/create-lead/create-lead.mjs +++ b/components/salesforce_rest_api/actions/create-lead/create-lead.mjs @@ -1,4 +1,4 @@ -import common, { getProps } from "../common/base.mjs"; +import common, { getProps } from "../common/base-create-update.mjs"; import lead from "../../common/sobjects/lead.mjs"; const docsLink = "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_lead.htm"; diff --git a/components/salesforce_rest_api/actions/create-note/create-note.mjs b/components/salesforce_rest_api/actions/create-note/create-note.mjs index 8bd3fff443d11..7e1f0571d6272 100644 --- a/components/salesforce_rest_api/actions/create-note/create-note.mjs +++ b/components/salesforce_rest_api/actions/create-note/create-note.mjs @@ -1,4 +1,4 @@ -import common, { getProps } from "../common/base.mjs"; +import common, { getProps } from "../common/base-create-update.mjs"; import note from "../../common/sobjects/note.mjs"; const docsLink = "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_note.htm"; diff --git a/components/salesforce_rest_api/actions/create-opportunity/create-opportunity.mjs b/components/salesforce_rest_api/actions/create-opportunity/create-opportunity.mjs index 6405219a89b55..16182831e29b2 100644 --- a/components/salesforce_rest_api/actions/create-opportunity/create-opportunity.mjs +++ b/components/salesforce_rest_api/actions/create-opportunity/create-opportunity.mjs @@ -1,4 +1,4 @@ -import common, { getProps } from "../common/base.mjs"; +import common, { getProps } from "../common/base-create-update.mjs"; import opportunity from "../../common/sobjects/opportunity.mjs"; export const docsLink = "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_opportunity.htm"; diff --git a/components/salesforce_rest_api/actions/create-record/create-record.mjs b/components/salesforce_rest_api/actions/create-record/create-record.mjs index 46e61c3256589..8d26edaf768a7 100644 --- a/components/salesforce_rest_api/actions/create-record/create-record.mjs +++ b/components/salesforce_rest_api/actions/create-record/create-record.mjs @@ -2,7 +2,7 @@ import { convertFieldsToProps, getAdditionalFields, } from "../../common/props-utils.mjs"; import salesforce from "../../salesforce_rest_api.app.mjs"; -import { additionalFields } from "../common/base.mjs"; +import { additionalFields } from "../common/base-create-update.mjs"; export default { key: "salesforce_rest_api-create-record", diff --git a/components/salesforce_rest_api/actions/create-task/create-task.mjs b/components/salesforce_rest_api/actions/create-task/create-task.mjs index b85e5d6c70710..a2a4cffd76654 100644 --- a/components/salesforce_rest_api/actions/create-task/create-task.mjs +++ b/components/salesforce_rest_api/actions/create-task/create-task.mjs @@ -1,4 +1,4 @@ -import common, { getProps } from "../common/base.mjs"; +import common, { getProps } from "../common/base-create-update.mjs"; import task from "../../common/sobjects/task.mjs"; const docsLink = diff --git a/components/salesforce_rest_api/actions/create-user/create-user.mjs b/components/salesforce_rest_api/actions/create-user/create-user.mjs index 37233a8f20e72..bfe9d21abb7c2 100644 --- a/components/salesforce_rest_api/actions/create-user/create-user.mjs +++ b/components/salesforce_rest_api/actions/create-user/create-user.mjs @@ -1,4 +1,4 @@ -import common, { getProps } from "../common/base.mjs"; +import common, { getProps } from "../common/base-create-update.mjs"; import user from "../../common/sobjects/user.mjs"; const docsLink = diff --git a/components/salesforce_rest_api/actions/update-account/update-account.mjs b/components/salesforce_rest_api/actions/update-account/update-account.mjs index 418f4eeca56ab..4bbfb20ffe260 100644 --- a/components/salesforce_rest_api/actions/update-account/update-account.mjs +++ b/components/salesforce_rest_api/actions/update-account/update-account.mjs @@ -1,4 +1,4 @@ -import common, { getProps } from "../common/base.mjs"; +import common, { getProps } from "../common/base-create-update.mjs"; import account from "../../common/sobjects/account.mjs"; import { docsLink } from "../create-account/create-account.mjs"; diff --git a/components/salesforce_rest_api/actions/update-contact/update-contact.mjs b/components/salesforce_rest_api/actions/update-contact/update-contact.mjs index 596d34b016112..ab8541e87fff8 100644 --- a/components/salesforce_rest_api/actions/update-contact/update-contact.mjs +++ b/components/salesforce_rest_api/actions/update-contact/update-contact.mjs @@ -1,4 +1,4 @@ -import common, { getProps } from "../common/base.mjs"; +import common, { getProps } from "../common/base-create-update.mjs"; import contact from "../../common/sobjects/contact.mjs"; import { docsLink } from "../create-contact/create-contact.mjs"; diff --git a/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs b/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs index 2864b4a8ecae0..7d0cac503366e 100644 --- a/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs +++ b/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs @@ -1,4 +1,4 @@ -import common, { getProps } from "../common/base.mjs"; +import common, { getProps } from "../common/base-create-update.mjs"; import opportunity from "../../common/sobjects/opportunity.mjs"; import { docsLink } from "../create-opportunity/create-opportunity.mjs"; From 58a5c640215f2ca97847baa3a7fb50f2450198e5 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Tue, 23 Jul 2024 03:27:38 -0300 Subject: [PATCH 085/106] Renames --- .../actions/create-record/create-record.mjs | 2 +- .../actions/delete-record/delete-record.mjs | 12 ++++++------ .../find-create-record/find-create-record.mjs | 12 ++++++------ .../actions/find-records/find-records.mjs | 10 +++++----- .../post-feed-to-chatter/post-feed-to-chatter.mjs | 10 +++++----- .../actions/search-string/search-string.mjs | 8 ++++---- 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/components/salesforce_rest_api/actions/create-record/create-record.mjs b/components/salesforce_rest_api/actions/create-record/create-record.mjs index 8d26edaf768a7..708d6240863a0 100644 --- a/components/salesforce_rest_api/actions/create-record/create-record.mjs +++ b/components/salesforce_rest_api/actions/create-record/create-record.mjs @@ -17,7 +17,7 @@ export default { salesforce, "objectType", ], - description: "SObject Type to create a record of", + description: "The type of object to create a record of", reloadProps: true, }, }, diff --git a/components/salesforce_rest_api/actions/delete-record/delete-record.mjs b/components/salesforce_rest_api/actions/delete-record/delete-record.mjs index 5214062d754ad..0f3365bdd0bf3 100644 --- a/components/salesforce_rest_api/actions/delete-record/delete-record.mjs +++ b/components/salesforce_rest_api/actions/delete-record/delete-record.mjs @@ -1,4 +1,4 @@ -import salesForceRestApi from "../../salesforce_rest_api.app.mjs"; +import salesforce from "../../salesforce_rest_api.app.mjs"; export default { key: "salesforce_rest_api-delete-record", @@ -8,17 +8,17 @@ export default { version: "0.2.{{ts}}", type: "action", props: { - salesForceRestApi, + salesforce, sobjectType: { propDefinition: [ - salesForceRestApi, + salesforce, "objectType", ], - description: "The type of object to delete a record from.", + description: "The type of object to delete a record of.", }, recordId: { propDefinition: [ - salesForceRestApi, + salesforce, "recordId", (c) => ({ objType: c.sobjectType, @@ -33,7 +33,7 @@ export default { sobjectType, recordId, } = this; - const response = await this.salesForceRestApi.deleteObject({ + const response = await this.salesforce.deleteObject({ $, sobjectType, recordId, diff --git a/components/salesforce_rest_api/actions/find-create-record/find-create-record.mjs b/components/salesforce_rest_api/actions/find-create-record/find-create-record.mjs index 69042b9d47f42..df7701737ef8e 100644 --- a/components/salesforce_rest_api/actions/find-create-record/find-create-record.mjs +++ b/components/salesforce_rest_api/actions/find-create-record/find-create-record.mjs @@ -1,5 +1,5 @@ import { ConfigurationError } from "@pipedream/platform"; -import salesForceRestApi from "../../salesforce_rest_api.app.mjs"; +import salesforce from "../../salesforce_rest_api.app.mjs"; export default { key: "salesforce_rest_api-find-create-record", @@ -9,16 +9,16 @@ export default { version: "0.2.0", type: "action", props: { - salesForceRestApi, + salesforce, sobjectType: { propDefinition: [ - salesForceRestApi, + salesforce, "objectType", ], }, sobjectId: { propDefinition: [ - salesForceRestApi, + salesforce, "sobjectId", (c) => ({ objectType: c.sobjectType, @@ -60,7 +60,7 @@ export default { } = this; let data; try { - data = await this.salesForceRestApi.getSObject( + data = await this.salesforce.getSObject( sobjectType, sobjectId, sobjectFields && { @@ -72,7 +72,7 @@ export default { } if (createIfNotFound && !data) { - const response = await this.salesForceRestApi.createObject({ + const response = await this.salesforce.createObject({ $, objectType: sobjectType, data: sobject, diff --git a/components/salesforce_rest_api/actions/find-records/find-records.mjs b/components/salesforce_rest_api/actions/find-records/find-records.mjs index 33d4cf3fcce59..67b4c82732c5e 100644 --- a/components/salesforce_rest_api/actions/find-records/find-records.mjs +++ b/components/salesforce_rest_api/actions/find-records/find-records.mjs @@ -1,4 +1,4 @@ -import salesForceRestApi from "../../salesforce_rest_api.app.mjs"; +import salesforce from "../../salesforce_rest_api.app.mjs"; export default { key: "salesforce_rest_api-find-records", @@ -8,16 +8,16 @@ export default { version: "0.2.0", type: "action", props: { - salesForceRestApi, + salesforce, sobjectType: { propDefinition: [ - salesForceRestApi, + salesforce, "objectType", ], }, ids: { propDefinition: [ - salesForceRestApi, + salesforce, "sobjectId", (c) => ({ objectType: c.sobjectType, @@ -38,7 +38,7 @@ export default { fields, ids, } = this; - const response = await this.salesForceRestApi.getRecords({ + const response = await this.salesforce.getRecords({ $, sobjectType, params: { diff --git a/components/salesforce_rest_api/actions/post-feed-to-chatter/post-feed-to-chatter.mjs b/components/salesforce_rest_api/actions/post-feed-to-chatter/post-feed-to-chatter.mjs index 48c0b16be00d9..293564e00ee65 100644 --- a/components/salesforce_rest_api/actions/post-feed-to-chatter/post-feed-to-chatter.mjs +++ b/components/salesforce_rest_api/actions/post-feed-to-chatter/post-feed-to-chatter.mjs @@ -1,4 +1,4 @@ -import salesForceRestApi from "../../salesforce_rest_api.app.mjs"; +import salesforce from "../../salesforce_rest_api.app.mjs"; export default { key: "salesforce_rest_api-post-feed-to-chatter", @@ -8,17 +8,17 @@ export default { version: "0.1.{{ts}}", type: "action", props: { - salesForceRestApi, + salesforce, sobjectType: { propDefinition: [ - salesForceRestApi, + salesforce, "objectType", ], description: "The type of object to select a record from.", }, subjectId: { propDefinition: [ - salesForceRestApi, + salesforce, "recordId", (c) => ({ objType: c.sobjectType, @@ -54,7 +54,7 @@ export default { }), }, }; - const response = await this.salesForceRestApi.postFeed({ + const response = await this.salesforce.postFeed({ $, data, }); diff --git a/components/salesforce_rest_api/actions/search-string/search-string.mjs b/components/salesforce_rest_api/actions/search-string/search-string.mjs index 9290c1df0bdb8..8334379494a3d 100644 --- a/components/salesforce_rest_api/actions/search-string/search-string.mjs +++ b/components/salesforce_rest_api/actions/search-string/search-string.mjs @@ -1,4 +1,4 @@ -import salesForceRestApi from "../../salesforce_rest_api.app.mjs"; +import salesforce from "../../salesforce_rest_api.app.mjs"; export default { key: "salesforce_rest_api-search-string", @@ -8,7 +8,7 @@ export default { version: "0.1.{{ts}}", type: "action", props: { - salesForceRestApi, + salesforce, infoBox: { type: "alert", alertType: "info", @@ -16,7 +16,7 @@ export default { }, sobjectType: { propDefinition: [ - salesForceRestApi, + salesforce, "objectType", ], description: "The type of object to search for records.", @@ -40,7 +40,7 @@ export default { fields, } = this; - const response = await this.salesForceRestApi.parameterizedSearch({ + const response = await this.salesforce.parameterizedSearch({ $, params: { q: searchTerm, From 5f8360bb21cbdcddedef68e0247f2fe7d2b63d45 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Tue, 23 Jul 2024 03:52:46 -0300 Subject: [PATCH 086/106] Update Record + several adjustments --- .../actions/create-record/create-record.mjs | 8 +- .../actions/delete-record/delete-record.mjs | 2 +- .../actions/update-record/update-record.mjs | 86 ++++++++++++++----- .../common/props-utils.mjs | 4 +- .../salesforce_rest_api.app.mjs | 22 +++-- 5 files changed, 89 insertions(+), 33 deletions(-) diff --git a/components/salesforce_rest_api/actions/create-record/create-record.mjs b/components/salesforce_rest_api/actions/create-record/create-record.mjs index 708d6240863a0..5c6366f0face3 100644 --- a/components/salesforce_rest_api/actions/create-record/create-record.mjs +++ b/components/salesforce_rest_api/actions/create-record/create-record.mjs @@ -50,23 +50,21 @@ export default { const { salesforce, objectType, - getAdditionalFields, + getAdditionalFields: getData, convertFieldsToProps, docsInfo, - dateInfo, additionalFields, ...data } = this; /* eslint-enable no-unused-vars */ - $.export("data", data); const response = await salesforce.createRecord(objectType, { $, data: { ...data, - ...getAdditionalFields(), + ...getData(), }, }); - $.export("$summary", `Successfully created ${this.objectType} record (ID: ${response.id})`); + $.export("$summary", `Successfully created ${objectType} record (ID: ${response.id})`); return response; }, }; diff --git a/components/salesforce_rest_api/actions/delete-record/delete-record.mjs b/components/salesforce_rest_api/actions/delete-record/delete-record.mjs index 0f3365bdd0bf3..d0c5ebb2d0597 100644 --- a/components/salesforce_rest_api/actions/delete-record/delete-record.mjs +++ b/components/salesforce_rest_api/actions/delete-record/delete-record.mjs @@ -33,7 +33,7 @@ export default { sobjectType, recordId, } = this; - const response = await this.salesforce.deleteObject({ + const response = await this.salesforce.deleteRecord({ $, sobjectType, recordId, diff --git a/components/salesforce_rest_api/actions/update-record/update-record.mjs b/components/salesforce_rest_api/actions/update-record/update-record.mjs index dd7b6836763ba..22f152cae3983 100644 --- a/components/salesforce_rest_api/actions/update-record/update-record.mjs +++ b/components/salesforce_rest_api/actions/update-record/update-record.mjs @@ -1,46 +1,92 @@ +import { + convertFieldsToProps, getAdditionalFields, +} from "../../common/props-utils.mjs"; import salesforce from "../../salesforce_rest_api.app.mjs"; -import { toSingleLineString } from "../../common/utils.mjs"; +import { additionalFields } from "../common/base-create-update.mjs"; export default { key: "salesforce_rest_api-update-record", name: "Update Record", - description: toSingleLineString(` - Updates a record of a given resource. - [See docs here](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_update_fields.htm) - `), - version: "0.3.0", + description: "Update fields of a record. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_update_fields.htm)", + version: "0.3.{{ts}}", type: "action", props: { salesforce, - objectType: { + sobjectType: { propDefinition: [ salesforce, "objectType", ], - description: "SObject Type of record to be updated", + description: "The type of object to update a record of.", + }, - sobjectId: { + recordId: { propDefinition: [ salesforce, - "sobjectId", + "recordId", (c) => ({ - objectType: c.objectType, + objType: c.sobjectType, }), ], - description: "ID of the SObject record to be updated", + description: + "The record to update.", }, - sobject: { - type: "object", - label: "SObject fields and values", - description: "SObject record data to patch", + fieldsToUpdate: { + propDefinition: [ + salesforce, + "fieldsToUpdate", + (c) => ({ + objType: c.sobjectType, + }), + ], }, }, + methods: { + getAdditionalFields, + convertFieldsToProps, + }, + async additionalProps() { + const { + objectType, fieldsToUpdate, + } = this; + const fields = await this.salesforce.getFieldsForObjectType(objectType); + + const selectedFields = fields.filter(({ name }) => fieldsToUpdate.includes(name)); + const selectedFieldProps = this.convertFieldsToProps(selectedFields); + + return { + docsInfo: { + type: "alert", + alertType: "info", + content: `[See the documentation](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_${objectType.toLowerCase()}.htm) for information on all available fields.`, + }, + ...selectedFieldProps, + additionalFields, + }; + }, async run({ $ }) { - await this.salesforce.updateRecord(this.objectType, { + /* eslint-disable no-unused-vars */ + const { + salesforce, + sobjectType, + recordId, + fieldsToUpdate, + getAdditionalFields: getData, + convertFieldsToProps, + docsInfo, + additionalFields, + ...data + } = this; + /* eslint-enable no-unused-vars */ + const response = await this.salesforce.updateRecord(sobjectType, { $, - id: this.sobjectId, - data: this.sobject, + id: recordId, + data: { + ...data, + ...getData(), + }, }); - $.export("$summary", `Updated record ${this.objectType}`); + $.export("$summary", `Successfully updated ${sobjectType} record (ID: ${recordId})`); + return response; }, }; diff --git a/components/salesforce_rest_api/common/props-utils.mjs b/components/salesforce_rest_api/common/props-utils.mjs index 86b16e1c80441..c9b2a869c309e 100644 --- a/components/salesforce_rest_api/common/props-utils.mjs +++ b/components/salesforce_rest_api/common/props-utils.mjs @@ -64,7 +64,7 @@ export function getAdditionalFields() { } export const convertFieldsToProps = (fields) => { - function getFieldPropType(fieldType) { + const getFieldPropType = (fieldType) => { // https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/field_types.htm switch (fieldType) { case "boolean": @@ -76,7 +76,7 @@ export const convertFieldsToProps = (fields) => { default: return "string"; } - } + }; return fields .map((field) => { diff --git a/components/salesforce_rest_api/salesforce_rest_api.app.mjs b/components/salesforce_rest_api/salesforce_rest_api.app.mjs index 85e11b5647d41..77193ba574b62 100644 --- a/components/salesforce_rest_api/salesforce_rest_api.app.mjs +++ b/components/salesforce_rest_api/salesforce_rest_api.app.mjs @@ -75,11 +75,23 @@ export default { "If provided, the trigger will only fire when the updated field is an EXACT MATCH (including spacing and casing) to the value you provide in this field", optional: true, }, - fieldSelector: { + fieldsToUpdate: { type: "string[]", - label: "Field Selector", - description: "Select fields for the Standard Object", - options: () => [], // override options for each object, e.g., () => Object.keys(account) + label: "Fields to Update", + description: "Select which fields you want to update for this record.", + async options({ objectType }) { + const fields = await this.getFieldsForObjectType(objectType); + return fields.filter((field) => field.updateable).map(({ name }) => name); + }, + }, + fieldsToQuery: { + type: "string[]", + label: "Fields to Return", + description: "Select which fields you want to obtain for this record.", + async options({ objectType }) { + const fields = await this.getFieldsForObjectType(objectType); + return fields.map(({ name }) => name); + }, }, AcceptedEventInviteeIds: { type: "string[]", @@ -263,7 +275,7 @@ export default { ...args, }); }, - async deleteObject({ + async deleteRecord({ sobjectType, recordId, ...args }) { const url = `${this._sObjectsApiUrl()}/${sobjectType}/${recordId}`; From d7b797790b4e08c1f1803010c6ad08c52dbd4b83 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Tue, 23 Jul 2024 03:56:27 -0300 Subject: [PATCH 087/106] Update Record adjustments --- .../actions/update-record/update-record.mjs | 7 ++++--- components/salesforce_rest_api/salesforce_rest_api.app.mjs | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/components/salesforce_rest_api/actions/update-record/update-record.mjs b/components/salesforce_rest_api/actions/update-record/update-record.mjs index 22f152cae3983..a8412181f0c00 100644 --- a/components/salesforce_rest_api/actions/update-record/update-record.mjs +++ b/components/salesforce_rest_api/actions/update-record/update-record.mjs @@ -39,6 +39,7 @@ export default { objType: c.sobjectType, }), ], + reloadProps: true, }, }, methods: { @@ -47,9 +48,9 @@ export default { }, async additionalProps() { const { - objectType, fieldsToUpdate, + sobjectType, fieldsToUpdate, } = this; - const fields = await this.salesforce.getFieldsForObjectType(objectType); + const fields = await this.salesforce.getFieldsForObjectType(sobjectType); const selectedFields = fields.filter(({ name }) => fieldsToUpdate.includes(name)); const selectedFieldProps = this.convertFieldsToProps(selectedFields); @@ -58,7 +59,7 @@ export default { docsInfo: { type: "alert", alertType: "info", - content: `[See the documentation](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_${objectType.toLowerCase()}.htm) for information on all available fields.`, + content: `[See the documentation](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_${sobjectType.toLowerCase()}.htm) for information on all available fields.`, }, ...selectedFieldProps, additionalFields, diff --git a/components/salesforce_rest_api/salesforce_rest_api.app.mjs b/components/salesforce_rest_api/salesforce_rest_api.app.mjs index 77193ba574b62..d56ef23d6f60c 100644 --- a/components/salesforce_rest_api/salesforce_rest_api.app.mjs +++ b/components/salesforce_rest_api/salesforce_rest_api.app.mjs @@ -79,8 +79,8 @@ export default { type: "string[]", label: "Fields to Update", description: "Select which fields you want to update for this record.", - async options({ objectType }) { - const fields = await this.getFieldsForObjectType(objectType); + async options({ objType }) { + const fields = await this.getFieldsForObjectType(objType); return fields.filter((field) => field.updateable).map(({ name }) => name); }, }, From 338672933cb6f219b71117ff733478bb77531f15 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Tue, 23 Jul 2024 18:02:05 -0300 Subject: [PATCH 088/106] Find Records + adjustments --- .../actions/find-records/find-records.mjs | 57 ++++++++++++------- .../salesforce_rest_api.app.mjs | 12 ++-- 2 files changed, 41 insertions(+), 28 deletions(-) diff --git a/components/salesforce_rest_api/actions/find-records/find-records.mjs b/components/salesforce_rest_api/actions/find-records/find-records.mjs index 67b4c82732c5e..558e83ddf2d69 100644 --- a/components/salesforce_rest_api/actions/find-records/find-records.mjs +++ b/components/salesforce_rest_api/actions/find-records/find-records.mjs @@ -4,8 +4,8 @@ export default { key: "salesforce_rest_api-find-records", name: "Find Records", description: - "Retrieves all records in an object or a record in an object by the given ID or criteria. [API Doc](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_get_field_values.htm)", - version: "0.2.0", + "Retrieves selected fields for some or all records of a selected object. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_get_field_values.htm)", + version: "0.2.{{ts}}", type: "action", props: { salesforce, @@ -14,41 +14,54 @@ export default { salesforce, "objectType", ], + description: "The type of object to obtain records of.", }, - ids: { + fieldsToObtain: { propDefinition: [ salesforce, - "sobjectId", + "fieldsToObtain", (c) => ({ - objectType: c.sobjectType, + objType: c.sobjectType, }), ], - type: "string[]", }, - fields: { + recordIds: { + propDefinition: [ + salesforce, + "recordId", + (c) => ({ + objType: c.sobjectType, + }), + ], + label: "Record ID(s)", type: "string[]", - label: "Fields to get values from", + optional: true, description: - "list of the Salesforce standard object's fields to get values from.", + "The record(s) to retrieve. If not specified, all records will be retrieved.", }, }, async run({ $ }) { - const { + let { sobjectType, - fields, - ids, + recordIds, + fieldsToObtain, } = this; - const response = await this.salesforce.getRecords({ + + if (typeof recordIds === "string") recordIds = recordIds.split(","); + if (typeof fieldsToObtain === "string") fieldsToObtain = fieldsToObtain.split(","); + + let query = `SELECT ${fieldsToObtain.join(", ")} FROM ${sobjectType}`; + + if (recordIds?.length) { + query += ` WHERE Id IN ('${recordIds.join("','")}')`; + } + + const { records } = await this.salesforce.query({ $, - sobjectType, - params: { - fields: Array.isArray(fields) && fields.join(",") || fields, - ids: Array.isArray(ids) && ids.join(",") || ids, - }, + query, }); - if (response) { - $.export("$summary", "Record found successfully"); - } - return response; + + $.export("$summary", `Sucessfully retrieved ${records.length} records`); + return records; }, }; diff --git a/components/salesforce_rest_api/salesforce_rest_api.app.mjs b/components/salesforce_rest_api/salesforce_rest_api.app.mjs index d56ef23d6f60c..28b069e45d275 100644 --- a/components/salesforce_rest_api/salesforce_rest_api.app.mjs +++ b/components/salesforce_rest_api/salesforce_rest_api.app.mjs @@ -78,18 +78,18 @@ export default { fieldsToUpdate: { type: "string[]", label: "Fields to Update", - description: "Select which fields you want to update for this record.", + description: "Select the field(s) you want to update for this record.", async options({ objType }) { const fields = await this.getFieldsForObjectType(objType); return fields.filter((field) => field.updateable).map(({ name }) => name); }, }, - fieldsToQuery: { + fieldsToObtain: { type: "string[]", - label: "Fields to Return", - description: "Select which fields you want to obtain for this record.", - async options({ objectType }) { - const fields = await this.getFieldsForObjectType(objectType); + label: "Fields to Obtain", + description: "Select the field(s) to obtain for the selected record(s) (or all records).", + async options({ objType }) { + const fields = await this.getFieldsForObjectType(objType); return fields.map(({ name }) => name); }, }, From 684f7a4244450864473557b0f1e245a0a8e40644 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Tue, 23 Jul 2024 18:13:32 -0300 Subject: [PATCH 089/106] Removing deprecated actions --- .../find-create-record/find-create-record.mjs | 90 ------------------- .../get-sobject-fields-values.mjs | 57 ------------ .../salesforce_rest_api.app.mjs | 10 --- 3 files changed, 157 deletions(-) delete mode 100644 components/salesforce_rest_api/actions/find-create-record/find-create-record.mjs delete mode 100644 components/salesforce_rest_api/actions/get-sobject-fields-values/get-sobject-fields-values.mjs diff --git a/components/salesforce_rest_api/actions/find-create-record/find-create-record.mjs b/components/salesforce_rest_api/actions/find-create-record/find-create-record.mjs deleted file mode 100644 index df7701737ef8e..0000000000000 --- a/components/salesforce_rest_api/actions/find-create-record/find-create-record.mjs +++ /dev/null @@ -1,90 +0,0 @@ -import { ConfigurationError } from "@pipedream/platform"; -import salesforce from "../../salesforce_rest_api.app.mjs"; - -export default { - key: "salesforce_rest_api-find-create-record", - name: "Get Field Values from Object Record and optionally create one is none is found. ", - description: - "Finds a specified Salesforce record by a field. Optionally, create one if none is found. [API Docs](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_get_field_values.htm)", - version: "0.2.0", - type: "action", - props: { - salesforce, - sobjectType: { - propDefinition: [ - salesforce, - "objectType", - ], - }, - sobjectId: { - propDefinition: [ - salesforce, - "sobjectId", - (c) => ({ - objectType: c.sobjectType, - }), - ], - description: - "ID of the Salesforce standard object to get field values from.", - }, - sobjectFields: { - type: "string[]", - label: "Fields to get values from", - description: - "list of the Salesforce standard object's fields to get values from.", - }, - createIfNotFound: { - type: "boolean", - label: "Create new object", - description: "Create a new object if none is found", - reloadProps: true, - }, - }, - async additionalProps() { - return { - sobject: { - type: "object", - label: "Salesforce standard object", - description: `Data of the Salesforce standard object record to create. - Salesforce standard objects are described in [Standard Objects](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_list.htm) section of the [SOAP API Developer Guide](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_quickstart_intro.htm).`, - }, - }; - }, - async run({ $ }) { - const { - sobjectType, - sobjectId, - sobjectFields, - sobject, - createIfNotFound, - } = this; - let data; - try { - data = await this.salesforce.getSObject( - sobjectType, - sobjectId, - sobjectFields && { - fields: sobjectFields.join(","), - }, - ); - } catch (error) { - if (!createIfNotFound) throw new ConfigurationError("Record not found"); - } - - if (createIfNotFound && !data) { - const response = await this.salesforce.createObject({ - $, - objectType: sobjectType, - data: sobject, - }); - response && $.export( - "$summary", "Record successfully created", - ); - return response; - } - if (data) { - $.export("$summary", "Record found!"); - } - return data; - }, -}; diff --git a/components/salesforce_rest_api/actions/get-sobject-fields-values/get-sobject-fields-values.mjs b/components/salesforce_rest_api/actions/get-sobject-fields-values/get-sobject-fields-values.mjs deleted file mode 100644 index a523e94eb4c92..0000000000000 --- a/components/salesforce_rest_api/actions/get-sobject-fields-values/get-sobject-fields-values.mjs +++ /dev/null @@ -1,57 +0,0 @@ -import salesforce from "../../salesforce_rest_api.app.mjs"; -import { toSingleLineString } from "../../common/utils.mjs"; - -export default { - key: "salesforce_rest_api-get-sobject-fields-values", - name: "Get Field Values from a Standard Object Record", - description: toSingleLineString(` - Retrieve field values from a record. You can specify the fields you want to retrieve. - See [docs](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_get_field_values.htm) - `), - version: "0.3.0", - type: "action", - props: { - salesforce, - objectType: { - propDefinition: [ - salesforce, - "objectType", - ], - }, - sobjectId: { - propDefinition: [ - salesforce, - "sobjectId", - (c) => ({ - objectType: c.objectType, - }), - ], - }, - fields: { - type: "string[]", - label: "SObject Fields", - description: "List of fields of the Standard object to get values from", - propDefinition: [ - salesforce, - "field", - (c) => ({ - objectType: c.objectType, - }), - ], - optional: true, - }, - }, - async run({ $ }) { - const params = {}; - if (this.fields?.length > 0) { - params.fields = this.fields.join(","); - } - const response = await this.salesforce.getRecordFieldValues(this.objectType, { - $, - id: this.sobjectId, - params, - }); - $.export("$summary", `Successfully retrieved ${this.objectType} field values`); - return response; - }, -}; diff --git a/components/salesforce_rest_api/salesforce_rest_api.app.mjs b/components/salesforce_rest_api/salesforce_rest_api.app.mjs index 28b069e45d275..75ea9d486d3c4 100644 --- a/components/salesforce_rest_api/salesforce_rest_api.app.mjs +++ b/components/salesforce_rest_api/salesforce_rest_api.app.mjs @@ -476,16 +476,6 @@ export default { data, }); }, - async getRecordFieldValues(sobjectName, { - $, id, params, - }) { - const url = this._sObjectDetailsApiUrl(sobjectName, id); - return this._makeRequest({ - $, - url, - params, - }); - }, async createRecord(sobjectName, { $, data, }) { From 5f42c2a6c94125294a8e3892d275cef301f53b7f Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Tue, 23 Jul 2024 18:35:54 -0300 Subject: [PATCH 090/106] Removing unused stuff --- .../insert-blob-data/insert-blob-data.mjs | 6 +-- .../common/props-utils.mjs | 42 --------------- .../salesforce_rest_api/common/utils.mjs | 51 ------------------- .../salesforce_rest_api.app.mjs | 11 ---- 4 files changed, 1 insertion(+), 109 deletions(-) delete mode 100644 components/salesforce_rest_api/common/utils.mjs diff --git a/components/salesforce_rest_api/actions/insert-blob-data/insert-blob-data.mjs b/components/salesforce_rest_api/actions/insert-blob-data/insert-blob-data.mjs index 4089c6eccdc36..9d4797bfccb55 100644 --- a/components/salesforce_rest_api/actions/insert-blob-data/insert-blob-data.mjs +++ b/components/salesforce_rest_api/actions/insert-blob-data/insert-blob-data.mjs @@ -1,13 +1,9 @@ import salesforce from "../../salesforce_rest_api.app.mjs"; -import { toSingleLineString } from "../../common/utils.mjs"; export default { key: "salesforce_rest_api-insert-blob-data", name: "Insert Blob Data", - description: toSingleLineString(` - Inserts blob data in Salesforce standard objects. - See [docs](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_insert_update_blob.htm) - `), + description: "Inserts blob data in Salesforce standard objects. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_insert_update_blob.htm)", version: "0.3.0", type: "action", props: { diff --git a/components/salesforce_rest_api/common/props-utils.mjs b/components/salesforce_rest_api/common/props-utils.mjs index c9b2a869c309e..731bfcc477344 100644 --- a/components/salesforce_rest_api/common/props-utils.mjs +++ b/components/salesforce_rest_api/common/props-utils.mjs @@ -1,47 +1,5 @@ import allSobjects from "./all-sobjects.mjs"; -function toCapitalCase(str) { - return str - .split(" ") - .map((word) => word.charAt(0).toUpperCase() + word.slice(1)) - .join(""); -} - -function filterProps(props) { - if (!props) { - return; - } - return Object.fromEntries( - Object.entries(props).filter( - ([ - key, - value, - ]) => - typeof value !== "function" && ![ - "app", - "salesforce", - ].includes(key), - ), - ); -} - -function keysToCapitalCase(data = {}) { - return Object.entries(filterProps(data)).reduce( - (acc, [ - key, - value, - ]) => ({ - ...acc, - [toCapitalCase(key)]: value, - }), - {}, - ); -} - -export default { - keysToCapitalCase, -}; - export function getAdditionalFields() { return Object.fromEntries( Object.entries(this.additionalFields ?? {}).map(([ diff --git a/components/salesforce_rest_api/common/utils.mjs b/components/salesforce_rest_api/common/utils.mjs deleted file mode 100644 index 78d8967d318a5..0000000000000 --- a/components/salesforce_rest_api/common/utils.mjs +++ /dev/null @@ -1,51 +0,0 @@ -/** - * A utility function that accepts a string as an argument and reformats it in - * order to remove newline characters and consecutive spaces. Useful when - * dealing with very long templated strings that are split into multiple lines. - * - * @example - * // returns "This is a much cleaner string" - * toSingleLineString(` - * This is a much - * cleaner string - * `); - * - * @param {string} multiLineString the input string to reformat - * @returns a formatted string based on the content of the input argument, - * without newlines and multiple spaces - * Source: {@linkcode ../aws/sources/common/utils.mjs utils.mjs} - */ -function toSingleLineString(multiLineString) { - return multiLineString - .trim() - .replace(/\n/g, " ") - .replace(/\s{2,}/g, " "); -} - -const removeNullEntries = (obj) => - obj && Object.entries(obj).reduce((acc, [ - key, - value, - ]) => { - const isNumber = typeof value === "number"; - const isBoolean = typeof value === "boolean"; - const isNotEmpyString = typeof value === "string" && value.trim() !== ""; - const isNotEmptyArray = Array.isArray(value) && value.length; - const isNotEmptyObject = - typeof value === "object" && - value !== null && - !Array.isArray(value) && - Object.keys(value).length !== 0; - isNotEmptyObject && (value = removeNullEntries(value)); - return ((value || value === false) && - (isNotEmpyString || isNotEmptyArray || isNotEmptyObject || isBoolean || isNumber)) - ? { - ...acc, - [key]: value, - } - : acc; - }, {}); - -export { - toSingleLineString, removeNullEntries, -}; diff --git a/components/salesforce_rest_api/salesforce_rest_api.app.mjs b/components/salesforce_rest_api/salesforce_rest_api.app.mjs index 75ea9d486d3c4..60f7512bc655b 100644 --- a/components/salesforce_rest_api/salesforce_rest_api.app.mjs +++ b/components/salesforce_rest_api/salesforce_rest_api.app.mjs @@ -301,17 +301,6 @@ export default { params, }); }, - async getUpdatedForObjectType(objectType, start, end) { - const url = this._sObjectTypeUpdatedApiUrl(objectType); - const params = { - start: this._formatDateString(start), - end: this._formatDateString(end), - }; - return this._makeRequest({ - url, - params, - }); - }, async getDeletedForObjectType(objectType, start, end) { const url = this._sObjectTypeDeletedApiUrl(objectType); const params = { From d469705643cf635dbc79fb692a37956579b92dd6 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Tue, 23 Jul 2024 18:54:37 -0300 Subject: [PATCH 091/106] Version bumps --- .../actions/add-contact-to-campaign/add-contact-to-campaign.mjs | 2 +- .../convert-soap-xml-to-json/convert-soap-xml-to-json.mjs | 2 +- .../actions/create-account/create-account.mjs | 2 +- .../actions/create-attachment/create-attachment.mjs | 2 +- .../actions/create-campaign/create-campaign.mjs | 2 +- .../actions/create-casecomment/create-casecomment.mjs | 2 +- .../actions/create-contact/create-contact.mjs | 2 +- .../salesforce_rest_api/actions/create-event/create-event.mjs | 2 +- .../salesforce_rest_api/actions/create-lead/create-lead.mjs | 2 +- .../salesforce_rest_api/actions/create-note/create-note.mjs | 2 +- .../actions/create-opportunity/create-opportunity.mjs | 2 +- .../salesforce_rest_api/actions/create-record/create-record.mjs | 2 +- .../salesforce_rest_api/actions/create-task/create-task.mjs | 2 +- .../salesforce_rest_api/actions/create-user/create-user.mjs | 2 +- .../actions/delete-opportunity/delete-opportunity.mjs | 2 +- .../salesforce_rest_api/actions/delete-record/delete-record.mjs | 2 +- .../salesforce_rest_api/actions/find-records/find-records.mjs | 2 +- .../actions/insert-blob-data/insert-blob-data.mjs | 2 +- .../actions/post-feed-to-chatter/post-feed-to-chatter.mjs | 2 +- .../salesforce_rest_api/actions/search-string/search-string.mjs | 2 +- .../salesforce_rest_api/actions/soql-search/soql-search.mjs | 2 +- .../salesforce_rest_api/actions/sosl-search/sosl-search.mjs | 2 +- .../actions/update-account/update-account.mjs | 2 +- .../actions/update-contact/update-contact.mjs | 2 +- .../actions/update-opportunity/update-opportunity.mjs | 2 +- .../salesforce_rest_api/actions/update-record/update-record.mjs | 2 +- .../sources/new-outbound-message/new-outbound-message.mjs | 2 +- .../sources/new-record-instant/new-record-instant.mjs | 2 +- .../sources/record-deleted-instant/record-deleted-instant.mjs | 2 +- .../sources/record-updated-instant/record-updated-instant.mjs | 2 +- 30 files changed, 30 insertions(+), 30 deletions(-) diff --git a/components/salesforce_rest_api/actions/add-contact-to-campaign/add-contact-to-campaign.mjs b/components/salesforce_rest_api/actions/add-contact-to-campaign/add-contact-to-campaign.mjs index e4b530aac9678..e34e0fbf29b30 100644 --- a/components/salesforce_rest_api/actions/add-contact-to-campaign/add-contact-to-campaign.mjs +++ b/components/salesforce_rest_api/actions/add-contact-to-campaign/add-contact-to-campaign.mjs @@ -5,7 +5,7 @@ export default { key: "salesforce_rest_api-add-contact-to-campaign", name: "Add Contact to Campaign", description: "Adds an existing contact to an existing campaign. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_campaignmember.htm)", - version: "0.1.{{ts}}", + version: "0.1.0", type: "action", props: { salesforce, diff --git a/components/salesforce_rest_api/actions/convert-soap-xml-to-json/convert-soap-xml-to-json.mjs b/components/salesforce_rest_api/actions/convert-soap-xml-to-json/convert-soap-xml-to-json.mjs index e6eca981d09c6..076f0e9979af2 100644 --- a/components/salesforce_rest_api/actions/convert-soap-xml-to-json/convert-soap-xml-to-json.mjs +++ b/components/salesforce_rest_api/actions/convert-soap-xml-to-json/convert-soap-xml-to-json.mjs @@ -5,7 +5,7 @@ export default { key: "salesforce_rest_api-convert-soap-xml-to-json", name: "Convert SOAP XML Object to JSON", description: "Converts a SOAP XML Object received from Salesforce to JSON", - version: "0.1.0", + version: "0.0.6", type: "action", props: { salesforce_rest_api, diff --git a/components/salesforce_rest_api/actions/create-account/create-account.mjs b/components/salesforce_rest_api/actions/create-account/create-account.mjs index 830c87be8920f..dde8031c59c0d 100644 --- a/components/salesforce_rest_api/actions/create-account/create-account.mjs +++ b/components/salesforce_rest_api/actions/create-account/create-account.mjs @@ -8,7 +8,7 @@ export default { key: "salesforce_rest_api-create-account", name: "Create Account", description: `Creates a Salesforce account. [See the documentation](${docsLink})`, - version: "0.3.{{ts}}", + version: "0.3.0", type: "action", methods: { ...common.methods, diff --git a/components/salesforce_rest_api/actions/create-attachment/create-attachment.mjs b/components/salesforce_rest_api/actions/create-attachment/create-attachment.mjs index 2f407b14db082..53c28ffa8860a 100644 --- a/components/salesforce_rest_api/actions/create-attachment/create-attachment.mjs +++ b/components/salesforce_rest_api/actions/create-attachment/create-attachment.mjs @@ -18,7 +18,7 @@ export default { key: "salesforce_rest_api-create-attachment", name: "Create Attachment", description: `Creates an Attachment on a parent object. [See the documentation](${docsLink})`, - version: "0.4.{{ts}}", + version: "0.4.0", type: "action", props, async run({ $ }) { diff --git a/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs b/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs index e3e6b6e98f3c5..f7998f853bbb7 100644 --- a/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs +++ b/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs @@ -8,7 +8,7 @@ export default { key: "salesforce_rest_api-create-campaign", name: "Create Campaign", description: `Creates a marketing campaign. [See the documentation](${docsLink})`, - version: "0.3.{{ts}}", + version: "0.3.0", type: "action", methods: { ...common.methods, diff --git a/components/salesforce_rest_api/actions/create-casecomment/create-casecomment.mjs b/components/salesforce_rest_api/actions/create-casecomment/create-casecomment.mjs index fa33e3eecc442..bd3a8922aaf0f 100644 --- a/components/salesforce_rest_api/actions/create-casecomment/create-casecomment.mjs +++ b/components/salesforce_rest_api/actions/create-casecomment/create-casecomment.mjs @@ -17,7 +17,7 @@ export default { key: "salesforce_rest_api-create-casecomment", name: "Create Case Comment", description: `Creates a Case Comment on a selected Case. [See the documentation](${docsLink})`, - version: "0.3.{{ts}}", + version: "0.3.0", type: "action", props, async run({ $ }) { diff --git a/components/salesforce_rest_api/actions/create-contact/create-contact.mjs b/components/salesforce_rest_api/actions/create-contact/create-contact.mjs index b78f99dc3e18e..f122878e18d2a 100644 --- a/components/salesforce_rest_api/actions/create-contact/create-contact.mjs +++ b/components/salesforce_rest_api/actions/create-contact/create-contact.mjs @@ -8,7 +8,7 @@ export default { key: "salesforce_rest_api-create-contact", name: "Create Contact", description: `Creates a contact. [See the documentation](${docsLink})`, - version: "0.3.{{ts}}", + version: "0.3.0", type: "action", methods: { ...common.methods, diff --git a/components/salesforce_rest_api/actions/create-event/create-event.mjs b/components/salesforce_rest_api/actions/create-event/create-event.mjs index a8f741ef1b130..27e376af88025 100644 --- a/components/salesforce_rest_api/actions/create-event/create-event.mjs +++ b/components/salesforce_rest_api/actions/create-event/create-event.mjs @@ -8,7 +8,7 @@ export default { key: "salesforce_rest_api-create-event", name: "Create Event", description: `Creates an event. [See the documentation](${docsLink})`, - version: "0.3.{{ts}}", + version: "0.3.0", type: "action", methods: { ...common.methods, diff --git a/components/salesforce_rest_api/actions/create-lead/create-lead.mjs b/components/salesforce_rest_api/actions/create-lead/create-lead.mjs index ca954eebb85c9..37b57d480c798 100644 --- a/components/salesforce_rest_api/actions/create-lead/create-lead.mjs +++ b/components/salesforce_rest_api/actions/create-lead/create-lead.mjs @@ -8,7 +8,7 @@ export default { key: "salesforce_rest_api-create-lead", name: "Create Lead", description: `Creates a lead. [See the documentation](${docsLink})`, - version: "0.3.{{ts}}", + version: "0.3.0", type: "action", methods: { ...common.methods, diff --git a/components/salesforce_rest_api/actions/create-note/create-note.mjs b/components/salesforce_rest_api/actions/create-note/create-note.mjs index 7e1f0571d6272..eb34387c389e1 100644 --- a/components/salesforce_rest_api/actions/create-note/create-note.mjs +++ b/components/salesforce_rest_api/actions/create-note/create-note.mjs @@ -17,7 +17,7 @@ export default { key: "salesforce_rest_api-create-note", name: "Create Note", description: `Creates a note. [See the documentation](${docsLink})`, - version: "0.3.{{ts}}", + version: "0.3.0", type: "action", props, async run({ $ }) { diff --git a/components/salesforce_rest_api/actions/create-opportunity/create-opportunity.mjs b/components/salesforce_rest_api/actions/create-opportunity/create-opportunity.mjs index 16182831e29b2..8ba9c41ca589f 100644 --- a/components/salesforce_rest_api/actions/create-opportunity/create-opportunity.mjs +++ b/components/salesforce_rest_api/actions/create-opportunity/create-opportunity.mjs @@ -8,7 +8,7 @@ export default { key: "salesforce_rest_api-create-opportunity", name: "Create Opportunity", description: `Creates an opportunity. [See the documentation](${docsLink})`, - version: "0.3.{{ts}}", + version: "0.3.0", type: "action", methods: { ...common.methods, diff --git a/components/salesforce_rest_api/actions/create-record/create-record.mjs b/components/salesforce_rest_api/actions/create-record/create-record.mjs index 5c6366f0face3..490b1d066547e 100644 --- a/components/salesforce_rest_api/actions/create-record/create-record.mjs +++ b/components/salesforce_rest_api/actions/create-record/create-record.mjs @@ -8,7 +8,7 @@ export default { key: "salesforce_rest_api-create-record", name: "Create Record", description: "Create a record of a given object. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_create.htm)", - version: "0.3.{{ts}}", + version: "0.3.0", type: "action", props: { salesforce, diff --git a/components/salesforce_rest_api/actions/create-task/create-task.mjs b/components/salesforce_rest_api/actions/create-task/create-task.mjs index a2a4cffd76654..15819b26d9cac 100644 --- a/components/salesforce_rest_api/actions/create-task/create-task.mjs +++ b/components/salesforce_rest_api/actions/create-task/create-task.mjs @@ -9,7 +9,7 @@ export default { key: "salesforce_rest_api-create-task", name: "Create Task", description: `Creates a task. [See the documentation](${docsLink})`, - version: "0.4.{{ts}}", + version: "0.4.0", type: "action", methods: { ...common.methods, diff --git a/components/salesforce_rest_api/actions/create-user/create-user.mjs b/components/salesforce_rest_api/actions/create-user/create-user.mjs index bfe9d21abb7c2..8c67a45d48d5d 100644 --- a/components/salesforce_rest_api/actions/create-user/create-user.mjs +++ b/components/salesforce_rest_api/actions/create-user/create-user.mjs @@ -9,7 +9,7 @@ export default { key: "salesforce_rest_api-create-user", name: "Create User", description: `Creates a Salesforce user. [See the documentation](${docsLink})`, - version: "0.1.{{ts}}", + version: "0.1.0", type: "action", methods: { ...common.methods, diff --git a/components/salesforce_rest_api/actions/delete-opportunity/delete-opportunity.mjs b/components/salesforce_rest_api/actions/delete-opportunity/delete-opportunity.mjs index 4813d599c62ab..9390e68902255 100644 --- a/components/salesforce_rest_api/actions/delete-opportunity/delete-opportunity.mjs +++ b/components/salesforce_rest_api/actions/delete-opportunity/delete-opportunity.mjs @@ -4,7 +4,7 @@ export default { key: "salesforce_rest_api-delete-opportunity", name: "Delete Opportunity", description: "Deletes an opportunity. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_delete_record.htm)", - version: "0.3.{{ts}}", + version: "0.3.0", type: "action", props: { salesforce, diff --git a/components/salesforce_rest_api/actions/delete-record/delete-record.mjs b/components/salesforce_rest_api/actions/delete-record/delete-record.mjs index d0c5ebb2d0597..4ea946d854315 100644 --- a/components/salesforce_rest_api/actions/delete-record/delete-record.mjs +++ b/components/salesforce_rest_api/actions/delete-record/delete-record.mjs @@ -5,7 +5,7 @@ export default { name: "Delete Record", description: "Deletes an existing record in an object. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_sobject_retrieve_delete.htm)", - version: "0.2.{{ts}}", + version: "0.2.0", type: "action", props: { salesforce, diff --git a/components/salesforce_rest_api/actions/find-records/find-records.mjs b/components/salesforce_rest_api/actions/find-records/find-records.mjs index 558e83ddf2d69..813f662dc9e65 100644 --- a/components/salesforce_rest_api/actions/find-records/find-records.mjs +++ b/components/salesforce_rest_api/actions/find-records/find-records.mjs @@ -5,7 +5,7 @@ export default { name: "Find Records", description: "Retrieves selected fields for some or all records of a selected object. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_get_field_values.htm)", - version: "0.2.{{ts}}", + version: "0.2.0", type: "action", props: { salesforce, diff --git a/components/salesforce_rest_api/actions/insert-blob-data/insert-blob-data.mjs b/components/salesforce_rest_api/actions/insert-blob-data/insert-blob-data.mjs index 9d4797bfccb55..ab9050fae8a14 100644 --- a/components/salesforce_rest_api/actions/insert-blob-data/insert-blob-data.mjs +++ b/components/salesforce_rest_api/actions/insert-blob-data/insert-blob-data.mjs @@ -4,7 +4,7 @@ export default { key: "salesforce_rest_api-insert-blob-data", name: "Insert Blob Data", description: "Inserts blob data in Salesforce standard objects. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_insert_update_blob.htm)", - version: "0.3.0", + version: "0.2.8", type: "action", props: { salesforce, diff --git a/components/salesforce_rest_api/actions/post-feed-to-chatter/post-feed-to-chatter.mjs b/components/salesforce_rest_api/actions/post-feed-to-chatter/post-feed-to-chatter.mjs index 293564e00ee65..99a221ffddba5 100644 --- a/components/salesforce_rest_api/actions/post-feed-to-chatter/post-feed-to-chatter.mjs +++ b/components/salesforce_rest_api/actions/post-feed-to-chatter/post-feed-to-chatter.mjs @@ -5,7 +5,7 @@ export default { name: "Post a Message to Chatter Feed", description: "Post a feed item in Chatter. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/quickreference_post_feed_item.htm)", - version: "0.1.{{ts}}", + version: "0.1.0", type: "action", props: { salesforce, diff --git a/components/salesforce_rest_api/actions/search-string/search-string.mjs b/components/salesforce_rest_api/actions/search-string/search-string.mjs index 8334379494a3d..a04a990e92c42 100644 --- a/components/salesforce_rest_api/actions/search-string/search-string.mjs +++ b/components/salesforce_rest_api/actions/search-string/search-string.mjs @@ -5,7 +5,7 @@ export default { name: "Search Object Records", description: "Searches for records in an object using a parameterized search. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_search_parameterized_get.htm)", - version: "0.1.{{ts}}", + version: "0.0.2", type: "action", props: { salesforce, diff --git a/components/salesforce_rest_api/actions/soql-search/soql-search.mjs b/components/salesforce_rest_api/actions/soql-search/soql-search.mjs index fcb6fed8b09f6..5d9297b9e6c70 100644 --- a/components/salesforce_rest_api/actions/soql-search/soql-search.mjs +++ b/components/salesforce_rest_api/actions/soql-search/soql-search.mjs @@ -7,7 +7,7 @@ export default { key: "salesforce_rest_api-soql-search", name: "SOQL Query (Object Query)", description: `Executes a [Salesforce Object Query Language (SOQL)](${docsLink}) query-based, SQL-like search.`, - version: "0.3.{{ts}}", + version: "0.2.9", type: "action", props: { salesforce, diff --git a/components/salesforce_rest_api/actions/sosl-search/sosl-search.mjs b/components/salesforce_rest_api/actions/sosl-search/sosl-search.mjs index a123960fd36aa..f3bb9f143e549 100644 --- a/components/salesforce_rest_api/actions/sosl-search/sosl-search.mjs +++ b/components/salesforce_rest_api/actions/sosl-search/sosl-search.mjs @@ -12,7 +12,7 @@ export default { key: "salesforce_rest_api-sosl-search", name: "SOSL Search (Object Search)", description: `Executes a [Salesforce Object Search Language (SOSL)](${docsLink}) text-based search query.`, - version: "0.3.{{ts}}", + version: "0.2.8", type: "action", props: { salesforce, diff --git a/components/salesforce_rest_api/actions/update-account/update-account.mjs b/components/salesforce_rest_api/actions/update-account/update-account.mjs index 4bbfb20ffe260..b942f9686b7b2 100644 --- a/components/salesforce_rest_api/actions/update-account/update-account.mjs +++ b/components/salesforce_rest_api/actions/update-account/update-account.mjs @@ -15,7 +15,7 @@ export default { key: "salesforce_rest_api-update-account", name: "Update Account", description: `Updates a Salesforce account. [See the documentation](${docsLink})`, - version: "0.3.{{ts}}", + version: "0.3.0", type: "action", methods: { ...common.methods, diff --git a/components/salesforce_rest_api/actions/update-contact/update-contact.mjs b/components/salesforce_rest_api/actions/update-contact/update-contact.mjs index ab8541e87fff8..8014e3a6c76c5 100644 --- a/components/salesforce_rest_api/actions/update-contact/update-contact.mjs +++ b/components/salesforce_rest_api/actions/update-contact/update-contact.mjs @@ -16,7 +16,7 @@ export default { key: "salesforce_rest_api-update-contact", name: "Update Contact", description: `Updates a contact. [See the documentation](${docsLink})`, - version: "0.3.{{ts}}", + version: "0.3.0", type: "action", methods: { ...common.methods, diff --git a/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs b/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs index 7d0cac503366e..2d9fca2a50de2 100644 --- a/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs +++ b/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs @@ -16,7 +16,7 @@ export default { key: "salesforce_rest_api-update-opportunity", name: "Update Opportunity", description: `Updates an opportunity. [See the documentation](${docsLink})`, - version: "0.3.{{ts}}", + version: "0.3.0", type: "action", methods: { ...common.methods, diff --git a/components/salesforce_rest_api/actions/update-record/update-record.mjs b/components/salesforce_rest_api/actions/update-record/update-record.mjs index a8412181f0c00..3beeda564b6ac 100644 --- a/components/salesforce_rest_api/actions/update-record/update-record.mjs +++ b/components/salesforce_rest_api/actions/update-record/update-record.mjs @@ -8,7 +8,7 @@ export default { key: "salesforce_rest_api-update-record", name: "Update Record", description: "Update fields of a record. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_update_fields.htm)", - version: "0.3.{{ts}}", + version: "0.3.0", type: "action", props: { salesforce, diff --git a/components/salesforce_rest_api/sources/new-outbound-message/new-outbound-message.mjs b/components/salesforce_rest_api/sources/new-outbound-message/new-outbound-message.mjs index e45c3f7b9f68e..a0d232dcbb309 100644 --- a/components/salesforce_rest_api/sources/new-outbound-message/new-outbound-message.mjs +++ b/components/salesforce_rest_api/sources/new-outbound-message/new-outbound-message.mjs @@ -15,7 +15,7 @@ export default { customResponse: true, }, salesforce, - alertTest: { + infoBox: { type: "alert", alertType: "info", content: `See Salesforce's guide on [setting up Outbound Messaging](https://sforce.co/3JbZJom). diff --git a/components/salesforce_rest_api/sources/new-record-instant/new-record-instant.mjs b/components/salesforce_rest_api/sources/new-record-instant/new-record-instant.mjs index 07cbd649143ca..b512834263831 100644 --- a/components/salesforce_rest_api/sources/new-record-instant/new-record-instant.mjs +++ b/components/salesforce_rest_api/sources/new-record-instant/new-record-instant.mjs @@ -7,7 +7,7 @@ export default { name: "New Record (Instant, of Selectable Type)", key: "salesforce_rest_api-new-record-instant", description: "Emit new event when a record of the selected object type is created. [See the documentation](https://sforce.co/3yPSJZy)", - version: "0.0.{{ts}}", + version: "0.1.0", hooks: { ...common.hooks, async deploy() { diff --git a/components/salesforce_rest_api/sources/record-deleted-instant/record-deleted-instant.mjs b/components/salesforce_rest_api/sources/record-deleted-instant/record-deleted-instant.mjs index ad53ec3d49406..46cd9b7485fdc 100644 --- a/components/salesforce_rest_api/sources/record-deleted-instant/record-deleted-instant.mjs +++ b/components/salesforce_rest_api/sources/record-deleted-instant/record-deleted-instant.mjs @@ -7,7 +7,7 @@ export default { name: "New Deleted Record (Instant, of Selectable Type)", key: "salesforce_rest_api-record-deleted-instant", description: "Emit new event when a record of the selected object type is deleted. [See the documentation](https://sforce.co/3msDDEE)", - version: "0.0.{{ts}}", + version: "0.1.0", methods: { ...common.methods, generateWebhookMeta(data) { diff --git a/components/salesforce_rest_api/sources/record-updated-instant/record-updated-instant.mjs b/components/salesforce_rest_api/sources/record-updated-instant/record-updated-instant.mjs index 1796df4aa9c56..46db6b7992e6f 100644 --- a/components/salesforce_rest_api/sources/record-updated-instant/record-updated-instant.mjs +++ b/components/salesforce_rest_api/sources/record-updated-instant/record-updated-instant.mjs @@ -9,7 +9,7 @@ export default { name: "New Updated Record (Instant, of Selectable Type)", key: "salesforce_rest_api-record-updated-instant", description: "Emit new event when a record of the selected type is updated. [See the documentation](https://sforce.co/3yPSJZy)", - version: "0.1.{{ts}}", + version: "0.2.0", props: { ...common.props, fields: { From e9df6f73f3805f350e14d73ee403221acf773aa9 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Tue, 23 Jul 2024 19:03:59 -0300 Subject: [PATCH 092/106] removing unused props/methods --- .../salesforce_rest_api.app.mjs | 52 ------------------- 1 file changed, 52 deletions(-) diff --git a/components/salesforce_rest_api/salesforce_rest_api.app.mjs b/components/salesforce_rest_api/salesforce_rest_api.app.mjs index 60f7512bc655b..8821ed3a134d7 100644 --- a/components/salesforce_rest_api/salesforce_rest_api.app.mjs +++ b/components/salesforce_rest_api/salesforce_rest_api.app.mjs @@ -4,19 +4,6 @@ export default { type: "app", app: "salesforce_rest_api", propDefinitions: { - sobjectId: { - type: "string", - label: "Object Type", - description: "ID of the Standard object to get field values from", - async options(context) { - const { objectType } = context; - const { recentItems } = await this.listSObjectTypeIds(objectType); - return recentItems.map((item) => ({ - label: item.Name, - value: item.Id, - })); - }, - }, objectType: { type: "string", label: "SObject Type", @@ -68,13 +55,6 @@ export default { return fields.filter(filter).map(({ name }) => name); }, }, - fieldUpdatedTo: { - type: "string", - label: "Field Updated to", - description: - "If provided, the trigger will only fire when the updated field is an EXACT MATCH (including spacing and casing) to the value you provide in this field", - optional: true, - }, fieldsToUpdate: { type: "string[]", label: "Fields to Update", @@ -93,25 +73,6 @@ export default { return fields.map(({ name }) => name); }, }, - AcceptedEventInviteeIds: { - type: "string[]", - label: "Accepted Event Invitee IDs", - async options() { - const { recentItems: contacts } = await this.listSObjectTypeIds("Contact"); - const { recentItems: leads } = await this.listSObjectTypeIds("Lead"); - const allContacts = [ - ...contacts, - ...leads, - ]; - return allContacts.map(({ - Name, Id, - }) => ({ - label: Name, - value: Id, - })); - }, - description: "A string array of contact or lead IDs who accepted this event. This JunctionIdList is linked to the AcceptedEventRelation child relationship. Warning Adding a JunctionIdList field name to the fieldsToNull property deletes all related junction records. This action can't be undone.", - }, useAdvancedProps: { type: "boolean", label: "See All Props", @@ -172,10 +133,6 @@ export default { const baseUrl = this._sObjectTypeApiUrl(sObjectType); return `${baseUrl}/describe`; }, - _sObjectTypeUpdatedApiUrl(sObjectType) { - const baseUrl = this._sObjectTypeApiUrl(sObjectType); - return `${baseUrl}/updated`; - }, _sObjectTypeDeletedApiUrl(sObjectType) { const baseUrl = this._sObjectTypeApiUrl(sObjectType); return `${baseUrl}/deleted`; @@ -257,15 +214,6 @@ export default { }); return data.fields; }, - async getHistorySObjectForObjectType(objectType) { - const { sobjects } = await this.listSObjectTypes(); - const historyObject = sobjects.find( - (sobject) => - sobject.associateParentEntity === objectType && - this.isHistorySObject(sobject), - ); - return historyObject; - }, async createObject({ objectType, ...args }) { From 9b875d5abb0a1e65fe1449a6580cdb9c6ac96863 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Tue, 23 Jul 2024 21:23:18 -0300 Subject: [PATCH 093/106] Reusing generic record method for individual creates --- .../actions/create-account/create-account.mjs | 2 +- .../create-attachment/create-attachment.mjs | 2 +- .../create-campaign/create-campaign.mjs | 2 +- .../actions/create-case/create-case.mjs | 2 +- .../create-casecomment/create-casecomment.mjs | 2 +- .../actions/create-contact/create-contact.mjs | 2 +- .../actions/create-event/create-event.mjs | 2 +- .../actions/create-lead/create-lead.mjs | 2 +- .../actions/create-note/create-note.mjs | 2 +- .../create-opportunity/create-opportunity.mjs | 2 +- .../actions/create-task/create-task.mjs | 2 +- .../actions/create-user/create-user.mjs | 10 +- .../salesforce_rest_api.app.mjs | 121 ------------------ 13 files changed, 12 insertions(+), 141 deletions(-) diff --git a/components/salesforce_rest_api/actions/create-account/create-account.mjs b/components/salesforce_rest_api/actions/create-account/create-account.mjs index dde8031c59c0d..4c7584defd342 100644 --- a/components/salesforce_rest_api/actions/create-account/create-account.mjs +++ b/components/salesforce_rest_api/actions/create-account/create-account.mjs @@ -34,7 +34,7 @@ export default { ...data } = this; /* eslint-enable no-unused-vars */ - const response = await salesforce.createAccount({ + const response = await salesforce.createRecord("Account", { $, data: { ...data, diff --git a/components/salesforce_rest_api/actions/create-attachment/create-attachment.mjs b/components/salesforce_rest_api/actions/create-attachment/create-attachment.mjs index 53c28ffa8860a..2293a7a6e1383 100644 --- a/components/salesforce_rest_api/actions/create-attachment/create-attachment.mjs +++ b/components/salesforce_rest_api/actions/create-attachment/create-attachment.mjs @@ -40,7 +40,7 @@ export default { }) : filePathOrContent; - const response = await salesforce.createAttachment({ + const response = await salesforce.createRecord("Attachment", { $, data: { Body: body, diff --git a/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs b/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs index f7998f853bbb7..b8604be4ee729 100644 --- a/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs +++ b/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs @@ -37,7 +37,7 @@ export default { ...data } = this; /* eslint-enable no-unused-vars, max-len */ - const response = await salesforce.createCampaign({ + const response = await salesforce.createRecord("Campaign", { $, data: { ...data, diff --git a/components/salesforce_rest_api/actions/create-case/create-case.mjs b/components/salesforce_rest_api/actions/create-case/create-case.mjs index 4dcb564724486..1a6d957ea26f9 100644 --- a/components/salesforce_rest_api/actions/create-case/create-case.mjs +++ b/components/salesforce_rest_api/actions/create-case/create-case.mjs @@ -36,7 +36,7 @@ export default { ...data } = this; /* eslint-enable no-unused-vars */ - const response = await salesforce.createCase({ + const response = await salesforce.createRecord("Case", { $, data: { ...data, diff --git a/components/salesforce_rest_api/actions/create-casecomment/create-casecomment.mjs b/components/salesforce_rest_api/actions/create-casecomment/create-casecomment.mjs index bd3a8922aaf0f..08aa657d0313c 100644 --- a/components/salesforce_rest_api/actions/create-casecomment/create-casecomment.mjs +++ b/components/salesforce_rest_api/actions/create-casecomment/create-casecomment.mjs @@ -31,7 +31,7 @@ export default { ...data } = this; /* eslint-enable no-unused-vars */ - const response = await salesforce.createCaseComment({ + const response = await salesforce.createRecord("CaseComment", { $, data, }); diff --git a/components/salesforce_rest_api/actions/create-contact/create-contact.mjs b/components/salesforce_rest_api/actions/create-contact/create-contact.mjs index f122878e18d2a..755cc8907ac2c 100644 --- a/components/salesforce_rest_api/actions/create-contact/create-contact.mjs +++ b/components/salesforce_rest_api/actions/create-contact/create-contact.mjs @@ -36,7 +36,7 @@ export default { ...data } = this; /* eslint-enable no-unused-vars */ - const response = await salesforce.createContact({ + const response = await salesforce.createRecord("Contact", { $, data: { ...data, diff --git a/components/salesforce_rest_api/actions/create-event/create-event.mjs b/components/salesforce_rest_api/actions/create-event/create-event.mjs index 27e376af88025..c2e4f29ca2d7f 100644 --- a/components/salesforce_rest_api/actions/create-event/create-event.mjs +++ b/components/salesforce_rest_api/actions/create-event/create-event.mjs @@ -42,7 +42,7 @@ export default { ...data } = this; /* eslint-enable no-unused-vars */ - const response = await salesforce.createEvent({ + const response = await salesforce.createRecord("Event", { $, data: { ...data, diff --git a/components/salesforce_rest_api/actions/create-lead/create-lead.mjs b/components/salesforce_rest_api/actions/create-lead/create-lead.mjs index 37b57d480c798..690483ac68f3e 100644 --- a/components/salesforce_rest_api/actions/create-lead/create-lead.mjs +++ b/components/salesforce_rest_api/actions/create-lead/create-lead.mjs @@ -34,7 +34,7 @@ export default { ...data } = this; /* eslint-enable no-unused-vars */ - const response = await salesforce.createLead({ + const response = await salesforce.createRecord("Lead", { $, data: { ...data, diff --git a/components/salesforce_rest_api/actions/create-note/create-note.mjs b/components/salesforce_rest_api/actions/create-note/create-note.mjs index eb34387c389e1..cadeb6a4a996a 100644 --- a/components/salesforce_rest_api/actions/create-note/create-note.mjs +++ b/components/salesforce_rest_api/actions/create-note/create-note.mjs @@ -30,7 +30,7 @@ export default { docsInfo, ...data } = this; /* eslint-enable no-unused-vars */ - const response = await salesforce.createNote({ + const response = await salesforce.createRecord("Note", { $, data, }); diff --git a/components/salesforce_rest_api/actions/create-opportunity/create-opportunity.mjs b/components/salesforce_rest_api/actions/create-opportunity/create-opportunity.mjs index 8ba9c41ca589f..543b5f9b58b83 100644 --- a/components/salesforce_rest_api/actions/create-opportunity/create-opportunity.mjs +++ b/components/salesforce_rest_api/actions/create-opportunity/create-opportunity.mjs @@ -36,7 +36,7 @@ export default { ...data } = this; /* eslint-enable no-unused-vars */ - const response = await salesforce.createOpportunity({ + const response = await salesforce.createRecord("Opportunity", { $, data: { ...data, diff --git a/components/salesforce_rest_api/actions/create-task/create-task.mjs b/components/salesforce_rest_api/actions/create-task/create-task.mjs index 15819b26d9cac..0237b05995626 100644 --- a/components/salesforce_rest_api/actions/create-task/create-task.mjs +++ b/components/salesforce_rest_api/actions/create-task/create-task.mjs @@ -41,7 +41,7 @@ export default { ...data } = this; /* eslint-enable no-unused-vars */ - const response = await salesforce.createTask({ + const response = await salesforce.createRecord("Task", { $, data: { ...data, diff --git a/components/salesforce_rest_api/actions/create-user/create-user.mjs b/components/salesforce_rest_api/actions/create-user/create-user.mjs index 8c67a45d48d5d..e290e9bb8060e 100644 --- a/components/salesforce_rest_api/actions/create-user/create-user.mjs +++ b/components/salesforce_rest_api/actions/create-user/create-user.mjs @@ -16,13 +16,6 @@ export default { getAdvancedProps() { return user.extraProps; }, - createUser(args = {}) { - return this.salesforce._makeRequest({ - method: "POST", - url: this.salesforce._sObjectTypeApiUrl("User"), - ...args, - }); - }, }, props: getProps({ objType: user, @@ -32,7 +25,6 @@ export default { /* eslint-disable no-unused-vars */ const { salesforce, - createUser, getAdvancedProps, getAdditionalFields, formatDateTimeProps, @@ -43,7 +35,7 @@ export default { ...data } = this; /* eslint-enable no-unused-vars */ - const response = await createUser({ + const response = await salesforce.createRecord("User", { $, data: { ...data, diff --git a/components/salesforce_rest_api/salesforce_rest_api.app.mjs b/components/salesforce_rest_api/salesforce_rest_api.app.mjs index 8821ed3a134d7..0c63aec8cb544 100644 --- a/components/salesforce_rest_api/salesforce_rest_api.app.mjs +++ b/components/salesforce_rest_api/salesforce_rest_api.app.mjs @@ -270,17 +270,6 @@ export default { }, }); }, - async createAccount({ - $, data, - }) { - const url = this._sObjectTypeApiUrl("Account"); - return this._makeRequest({ - $, - url, - method: "POST", - data, - }); - }, async updateAccount({ $, id, data, }) { @@ -292,61 +281,6 @@ export default { data, }); }, - async createAttachment({ - $, data, - }) { - const url = this._sObjectTypeApiUrl("Attachment"); - return this._makeRequest({ - $, - url, - method: "POST", - data, - }); - }, - async createCampaign({ - $, data, - }) { - const url = this._sObjectTypeApiUrl("Campaign"); - return this._makeRequest({ - $, - url, - method: "POST", - data, - }); - }, - async createCase({ - $, data, - }) { - const url = this._sObjectTypeApiUrl("Case"); - return this._makeRequest({ - $, - url, - method: "POST", - data, - }); - }, - async createCaseComment({ - $, data, - }) { - const url = this._sObjectTypeApiUrl("CaseComment"); - return this._makeRequest({ - $, - url, - method: "POST", - data, - }); - }, - async createContact({ - $, data, - }) { - const url = this._sObjectTypeApiUrl("Contact"); - return this._makeRequest({ - $, - url, - method: "POST", - data, - }); - }, async updateContact({ $, id, data, }) { @@ -358,50 +292,6 @@ export default { data, }); }, - async createEvent({ - $, data, - }) { - const url = this._sObjectTypeApiUrl("Event"); - return this._makeRequest({ - $, - url, - method: "POST", - data, - }); - }, - async createLead({ - $, data, - }) { - const url = this._sObjectTypeApiUrl("Lead"); - return this._makeRequest({ - $, - url, - method: "POST", - data, - }); - }, - async createNote({ - $, data, - }) { - const url = this._sObjectTypeApiUrl("Note"); - return this._makeRequest({ - $, - url, - method: "POST", - data, - }); - }, - async createOpportunity({ - $, data, - }) { - const url = this._sObjectTypeApiUrl("Opportunity"); - return this._makeRequest({ - $, - url, - method: "POST", - data, - }); - }, async updateOpportunity({ $, id, data, }) { @@ -435,17 +325,6 @@ export default { data, }); }, - async createTask({ - $, data, - }) { - const url = this._sObjectTypeApiUrl("Task"); - return this._makeRequest({ - $, - url, - method: "POST", - data, - }); - }, async deleteOpportunity({ $, id, }) { From 3c779926c3567d13a14a1000f4a4a14b37dd843c Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Tue, 23 Jul 2024 21:49:08 -0300 Subject: [PATCH 094/106] Reusing record methods for update/delete actions --- .../delete-opportunity/delete-opportunity.mjs | 3 +- .../actions/update-account/update-account.mjs | 2 +- .../actions/update-contact/update-contact.mjs | 2 +- .../update-opportunity/update-opportunity.mjs | 2 +- .../salesforce_rest_api.app.mjs | 43 ------------------- 5 files changed, 5 insertions(+), 47 deletions(-) diff --git a/components/salesforce_rest_api/actions/delete-opportunity/delete-opportunity.mjs b/components/salesforce_rest_api/actions/delete-opportunity/delete-opportunity.mjs index 9390e68902255..dc863e0edd8c9 100644 --- a/components/salesforce_rest_api/actions/delete-opportunity/delete-opportunity.mjs +++ b/components/salesforce_rest_api/actions/delete-opportunity/delete-opportunity.mjs @@ -22,7 +22,8 @@ export default { }, }, async run({ $ }) { - const response = await this.salesforce.deleteOpportunity({ + const response = await this.salesforce.deleteRecord({ + sobjectType: "Opportunity", $, id: this.opportunityId, }); diff --git a/components/salesforce_rest_api/actions/update-account/update-account.mjs b/components/salesforce_rest_api/actions/update-account/update-account.mjs index b942f9686b7b2..c8a0fb1fe0381 100644 --- a/components/salesforce_rest_api/actions/update-account/update-account.mjs +++ b/components/salesforce_rest_api/actions/update-account/update-account.mjs @@ -54,7 +54,7 @@ export default { ...data } = this; /* eslint-enable no-unused-vars */ - const response = await salesforce.updateAccount({ + const response = await salesforce.updateRecord("Account", { $, id: accountId, data: { diff --git a/components/salesforce_rest_api/actions/update-contact/update-contact.mjs b/components/salesforce_rest_api/actions/update-contact/update-contact.mjs index 8014e3a6c76c5..ab0b80b24974c 100644 --- a/components/salesforce_rest_api/actions/update-contact/update-contact.mjs +++ b/components/salesforce_rest_api/actions/update-contact/update-contact.mjs @@ -56,7 +56,7 @@ export default { ...data } = this; /* eslint-enable no-unused-vars */ - const response = await salesforce.updateContact({ + const response = await salesforce.updateRecord("Contact", { $, id: contactId, data: { diff --git a/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs b/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs index 2d9fca2a50de2..c82760ab818e1 100644 --- a/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs +++ b/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs @@ -56,7 +56,7 @@ export default { ...data } = this; /* eslint-enable no-unused-vars */ - const response = await salesforce.updateOpportunity({ + const response = await salesforce.updateRecord("Opportunity", { $, id: opportunityId, data: { diff --git a/components/salesforce_rest_api/salesforce_rest_api.app.mjs b/components/salesforce_rest_api/salesforce_rest_api.app.mjs index 0c63aec8cb544..cdf27c39ea0fc 100644 --- a/components/salesforce_rest_api/salesforce_rest_api.app.mjs +++ b/components/salesforce_rest_api/salesforce_rest_api.app.mjs @@ -270,39 +270,6 @@ export default { }, }); }, - async updateAccount({ - $, id, data, - }) { - const url = this._sObjectDetailsApiUrl("Account", id); - return this._makeRequest({ - $, - url, - method: "PATCH", - data, - }); - }, - async updateContact({ - $, id, data, - }) { - const url = this._sObjectDetailsApiUrl("Contact", id); - return this._makeRequest({ - $, - url, - method: "PATCH", - data, - }); - }, - async updateOpportunity({ - $, id, data, - }) { - const url = this._sObjectDetailsApiUrl("Opportunity", id); - return this._makeRequest({ - $, - url, - method: "PATCH", - data, - }); - }, async createRecord(sobjectName, { $, data, }) { @@ -325,16 +292,6 @@ export default { data, }); }, - async deleteOpportunity({ - $, id, - }) { - const url = this._sObjectDetailsApiUrl("Opportunity", id); - return this._makeRequest({ - $, - url, - method: "DELETE", - }); - }, async query({ $, query, }) { From efbf92462892f7059d6043d7079667f30721c5ad Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Tue, 23 Jul 2024 23:06:56 -0300 Subject: [PATCH 095/106] Syntax improvement --- .../salesforce_rest_api/actions/common/base-create-update.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/salesforce_rest_api/actions/common/base-create-update.mjs b/components/salesforce_rest_api/actions/common/base-create-update.mjs index 1c85ceb2ccfc2..3546e73f5c74a 100644 --- a/components/salesforce_rest_api/actions/common/base-create-update.mjs +++ b/components/salesforce_rest_api/actions/common/base-create-update.mjs @@ -72,10 +72,10 @@ export default { value, ]) => { const numValue = Number(value); - const date = new Date(isNaN(numValue) + const date = new Date(Number.isNaN(numValue) ? value : numValue); - if (isNaN(date.valueOf())) { + if (Number.isNaN(date.valueOf())) { throw new ConfigurationError(`Invalid date format for prop \`${key}\`. Please provide a valid date format.`); } return [ From 47cd9737b32ed366f9c3608014527a7833dff478 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Thu, 25 Jul 2024 22:20:51 -0300 Subject: [PATCH 096/106] Adjustments --- .../actions/common/base-create-update.mjs | 33 ++++++++++--------- .../common/sobjects/contact.mjs | 6 ---- 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/components/salesforce_rest_api/actions/common/base-create-update.mjs b/components/salesforce_rest_api/actions/common/base-create-update.mjs index 3546e73f5c74a..a19bf893edbbd 100644 --- a/components/salesforce_rest_api/actions/common/base-create-update.mjs +++ b/components/salesforce_rest_api/actions/common/base-create-update.mjs @@ -67,22 +67,25 @@ export default { getAdditionalFields, formatDateTimeProps(props = {}) { // https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_valid_date_formats.htm - return Object.fromEntries(Object.entries(props).map(([ - key, - value, - ]) => { - const numValue = Number(value); - const date = new Date(Number.isNaN(numValue) - ? value - : numValue); - if (Number.isNaN(date.valueOf())) { - throw new ConfigurationError(`Invalid date format for prop \`${key}\`. Please provide a valid date format.`); - } - return [ + return Object.fromEntries(Object.entries(props).filter(([ + , value, + ]) => value !== undefined) + .map(([ key, - date.toISOString(), - ]; - })); + value, + ]) => { + const numValue = Number(value); + const date = new Date(Number.isNaN(numValue) + ? value + : numValue); + if (Number.isNaN(date.valueOf())) { + throw new ConfigurationError(`Invalid date format for prop \`${key}\`. Please provide a valid date format.`); + } + return [ + key, + date.toISOString(), + ]; + })); }, }, additionalProps() { diff --git a/components/salesforce_rest_api/common/sobjects/contact.mjs b/components/salesforce_rest_api/common/sobjects/contact.mjs index 4d10801587895..2e56c608c6c84 100644 --- a/components/salesforce_rest_api/common/sobjects/contact.mjs +++ b/components/salesforce_rest_api/common/sobjects/contact.mjs @@ -73,12 +73,6 @@ export default { description: "The contact's department.", optional: true, }, - DoNotCall: { - type: "boolean", - label: "Do Not Call", - description: "Indicates that the contact doesn't want to receive calls.", - optional: true, - }, Fax: { type: "string", label: "Business Fax", From 2c51bb840ce798827148b64d20a19ace627ea4ab Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Thu, 25 Jul 2024 22:25:52 -0300 Subject: [PATCH 097/106] Fixing 'create event' --- .../salesforce_rest_api/actions/create-event/create-event.mjs | 1 + 1 file changed, 1 insertion(+) diff --git a/components/salesforce_rest_api/actions/create-event/create-event.mjs b/components/salesforce_rest_api/actions/create-event/create-event.mjs index c2e4f29ca2d7f..38d9e40c80fc8 100644 --- a/components/salesforce_rest_api/actions/create-event/create-event.mjs +++ b/components/salesforce_rest_api/actions/create-event/create-event.mjs @@ -5,6 +5,7 @@ const docsLink = "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_event.htm"; export default { + ...common, key: "salesforce_rest_api-create-event", name: "Create Event", description: `Creates an event. [See the documentation](${docsLink})`, From a5be19fa14149445179c4f42a72dd05ba8ebc86d Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Thu, 25 Jul 2024 22:33:29 -0300 Subject: [PATCH 098/106] Removing other fields --- components/salesforce_rest_api/common/sobjects/lead.mjs | 7 ------- .../salesforce_rest_api/common/sobjects/opportunity.mjs | 6 ------ components/salesforce_rest_api/common/sobjects/user.mjs | 6 ------ 3 files changed, 19 deletions(-) diff --git a/components/salesforce_rest_api/common/sobjects/lead.mjs b/components/salesforce_rest_api/common/sobjects/lead.mjs index a30dbf758bd28..b0206eb0d0556 100644 --- a/components/salesforce_rest_api/common/sobjects/lead.mjs +++ b/components/salesforce_rest_api/common/sobjects/lead.mjs @@ -105,13 +105,6 @@ export default { description: "The lead's fax number.", optional: true, }, - HasOptedOutOfEmail: { - type: "boolean", - label: "Email Opt Out", - description: - "Indicates whether the lead doesn't want to receive email from Salesforce (`true`) or not (`false`)", - optional: true, - }, HasOptedOutOfFax: { type: "boolean", label: "Fax Opt Out", diff --git a/components/salesforce_rest_api/common/sobjects/opportunity.mjs b/components/salesforce_rest_api/common/sobjects/opportunity.mjs index 1dc19b34df326..7f6e0dc55dc5e 100644 --- a/components/salesforce_rest_api/common/sobjects/opportunity.mjs +++ b/components/salesforce_rest_api/common/sobjects/opportunity.mjs @@ -74,12 +74,6 @@ export default { description: "ID of a related Campaign.", optional: true, }, - ContractId: { - ...commonProps.ContractId, - description: - "ID of the contract that's associated with this opportunity.", - optional: true, - }, ForecastCategoryName: { type: "string", label: "Forecast Category Name", diff --git a/components/salesforce_rest_api/common/sobjects/user.mjs b/components/salesforce_rest_api/common/sobjects/user.mjs index 423573ae48a24..cdc6e4f70550e 100644 --- a/components/salesforce_rest_api/common/sobjects/user.mjs +++ b/components/salesforce_rest_api/common/sobjects/user.mjs @@ -162,12 +162,6 @@ export default { "The country associated with the user. Up to 80 characters allowed.", optional: true, }, - CurrentStatus: { - type: "string", - label: "Current Status", - description: "Text that describes what the user is working on.", - optional: true, - }, DefaultGroupNotificationFrequency: { type: "string", label: "Default Notification Frequency when Joining Groups", From a095b27d7f2b1bbe827489dec08ada214087d8cf Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Thu, 25 Jul 2024 22:35:43 -0300 Subject: [PATCH 099/106] Fixed Delete Opportunity --- .../actions/delete-opportunity/delete-opportunity.mjs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/salesforce_rest_api/actions/delete-opportunity/delete-opportunity.mjs b/components/salesforce_rest_api/actions/delete-opportunity/delete-opportunity.mjs index dc863e0edd8c9..8d7ccec6c201e 100644 --- a/components/salesforce_rest_api/actions/delete-opportunity/delete-opportunity.mjs +++ b/components/salesforce_rest_api/actions/delete-opportunity/delete-opportunity.mjs @@ -8,7 +8,7 @@ export default { type: "action", props: { salesforce, - opportunityId: { + recordId: { propDefinition: [ salesforce, "recordId", @@ -22,12 +22,13 @@ export default { }, }, async run({ $ }) { + const { recordId } = this; const response = await this.salesforce.deleteRecord({ sobjectType: "Opportunity", $, - id: this.opportunityId, + recordId, }); - $.export("$summary", `Successfully deleted opportunity (ID: ${this.opportunityId})`); + $.export("$summary", `Successfully deleted opportunity (ID: ${recordId})`); return response; }, }; From a21a422c3bf803d0cd737ddca3f8771168a8bf98 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Thu, 25 Jul 2024 22:45:29 -0300 Subject: [PATCH 100/106] More fixes --- .../actions/sosl-search/sosl-search.mjs | 2 +- components/salesforce_rest_api/common/sobjects/account.mjs | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/components/salesforce_rest_api/actions/sosl-search/sosl-search.mjs b/components/salesforce_rest_api/actions/sosl-search/sosl-search.mjs index f3bb9f143e549..5ae3f484c16f0 100644 --- a/components/salesforce_rest_api/actions/sosl-search/sosl-search.mjs +++ b/components/salesforce_rest_api/actions/sosl-search/sosl-search.mjs @@ -33,7 +33,7 @@ export default { $, search: this.search, }); - $.export("$summary", `Successfully returned ${response.searchRecords} results for SOSL search`); + $.export("$summary", `Successfully returned ${response.searchRecords?.length} results for SOSL search`); return response; }, }; diff --git a/components/salesforce_rest_api/common/sobjects/account.mjs b/components/salesforce_rest_api/common/sobjects/account.mjs index 746504f7b370d..eeb2afe64dfea 100644 --- a/components/salesforce_rest_api/common/sobjects/account.mjs +++ b/components/salesforce_rest_api/common/sobjects/account.mjs @@ -12,13 +12,6 @@ export default { }, }, updateProps: { - IsCustomerPortal: { - type: "boolean", - label: "Is Customer Portal", - description: - "Indicates whether the account has at least one contact enabled to use the org's Experience Cloud site or Customer Portal.", - optional: true, - }, IsPartner: { type: "boolean", label: "Is Partner", From 1ad385edbe508004b47240adfcc6c7a872525c72 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Tue, 30 Jul 2024 01:50:45 -0300 Subject: [PATCH 101/106] Adding filtering props with describe call --- .../actions/common/base-create-update.mjs | 23 +++++++++++++------ .../actions/create-account/create-account.mjs | 4 ++++ .../create-campaign/create-campaign.mjs | 4 ++++ .../actions/create-case/create-case.mjs | 4 ++++ .../actions/create-contact/create-contact.mjs | 4 ++++ .../actions/create-event/create-event.mjs | 4 ++++ .../actions/create-lead/create-lead.mjs | 4 ++++ .../create-opportunity/create-opportunity.mjs | 4 ++++ .../actions/create-task/create-task.mjs | 4 ++++ .../actions/create-user/create-user.mjs | 4 ++++ .../actions/update-account/update-account.mjs | 4 ++++ .../actions/update-contact/update-contact.mjs | 4 ++++ .../update-opportunity/update-opportunity.mjs | 4 ++++ 13 files changed, 64 insertions(+), 7 deletions(-) diff --git a/components/salesforce_rest_api/actions/common/base-create-update.mjs b/components/salesforce_rest_api/actions/common/base-create-update.mjs index a19bf893edbbd..f105f80cad4b4 100644 --- a/components/salesforce_rest_api/actions/common/base-create-update.mjs +++ b/components/salesforce_rest_api/actions/common/base-create-update.mjs @@ -61,6 +61,9 @@ export function getProps({ export default { methods: { + getObjectType() { + return ""; + }, getAdvancedProps() { return {}; }, @@ -88,12 +91,18 @@ export default { })); }, }, - additionalProps() { - return this.useAdvancedProps - ? { - ...this.getAdvancedProps(), - additionalFields, - } - : {}; + async additionalProps() { + const objectType = this.getObjectType(); + if (!this.useAdvancedProps || !objectType) return {}; + + const fields = (await this.salesforce.getFieldsForObjectType(objectType)); + const fieldNames = fields.map((f) => f.name); + const filteredProps = Object.fromEntries(Object.entries(this.getAdvancedProps()).filter(([ + key, + ]) => fieldNames.includes(key) || key[0] === key[0].toLowerCase())); + return { + ...filteredProps, + additionalFields, + }; }, }; diff --git a/components/salesforce_rest_api/actions/create-account/create-account.mjs b/components/salesforce_rest_api/actions/create-account/create-account.mjs index 4c7584defd342..b538d25f29779 100644 --- a/components/salesforce_rest_api/actions/create-account/create-account.mjs +++ b/components/salesforce_rest_api/actions/create-account/create-account.mjs @@ -12,6 +12,9 @@ export default { type: "action", methods: { ...common.methods, + getObjectType() { + return "Account"; + }, getAdvancedProps() { return account.extraProps; }, @@ -25,6 +28,7 @@ export default { const { salesforce, getAdvancedProps, + getObjectType, getAdditionalFields, formatDateTimeProps, useAdvancedProps, diff --git a/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs b/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs index b8604be4ee729..1061faf292791 100644 --- a/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs +++ b/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs @@ -12,6 +12,9 @@ export default { type: "action", methods: { ...common.methods, + getObjectType() { + return "Campaign"; + }, getAdvancedProps() { return campaign.extraProps; }, @@ -26,6 +29,7 @@ export default { const { salesforce, getAdvancedProps, + getObjectType, getAdditionalFields, formatDateTimeProps, useAdvancedProps, diff --git a/components/salesforce_rest_api/actions/create-case/create-case.mjs b/components/salesforce_rest_api/actions/create-case/create-case.mjs index 1a6d957ea26f9..b18f25f93bbfc 100644 --- a/components/salesforce_rest_api/actions/create-case/create-case.mjs +++ b/components/salesforce_rest_api/actions/create-case/create-case.mjs @@ -12,6 +12,9 @@ export default { type: "action", methods: { ...common.methods, + getObjectType() { + return "Case"; + }, getAdvancedProps() { return caseObj.extraProps; }, @@ -26,6 +29,7 @@ export default { const { salesforce, getAdvancedProps, + getObjectType, getAdditionalFields, formatDateTimeProps, useAdvancedProps, diff --git a/components/salesforce_rest_api/actions/create-contact/create-contact.mjs b/components/salesforce_rest_api/actions/create-contact/create-contact.mjs index 755cc8907ac2c..a2bd4fc321d45 100644 --- a/components/salesforce_rest_api/actions/create-contact/create-contact.mjs +++ b/components/salesforce_rest_api/actions/create-contact/create-contact.mjs @@ -12,6 +12,9 @@ export default { type: "action", methods: { ...common.methods, + getObjectType() { + return "Contact"; + }, getAdvancedProps() { return contact.extraProps; }, @@ -26,6 +29,7 @@ export default { const { salesforce, getAdvancedProps, + getObjectType, getAdditionalFields, formatDateTimeProps, useAdvancedProps, diff --git a/components/salesforce_rest_api/actions/create-event/create-event.mjs b/components/salesforce_rest_api/actions/create-event/create-event.mjs index 38d9e40c80fc8..372d73e6a6b14 100644 --- a/components/salesforce_rest_api/actions/create-event/create-event.mjs +++ b/components/salesforce_rest_api/actions/create-event/create-event.mjs @@ -13,6 +13,9 @@ export default { type: "action", methods: { ...common.methods, + getObjectType() { + return "Event"; + }, getAdvancedProps() { return event.extraProps; }, @@ -27,6 +30,7 @@ export default { const { salesforce, getAdvancedProps, + getObjectType, getAdditionalFields, formatDateTimeProps, useAdvancedProps, diff --git a/components/salesforce_rest_api/actions/create-lead/create-lead.mjs b/components/salesforce_rest_api/actions/create-lead/create-lead.mjs index 690483ac68f3e..1049b3f2e1d37 100644 --- a/components/salesforce_rest_api/actions/create-lead/create-lead.mjs +++ b/components/salesforce_rest_api/actions/create-lead/create-lead.mjs @@ -12,6 +12,9 @@ export default { type: "action", methods: { ...common.methods, + getObjectType() { + return "Lead"; + }, getAdvancedProps() { return lead.extraProps; }, @@ -25,6 +28,7 @@ export default { const { salesforce, getAdvancedProps, + getObjectType, getAdditionalFields, formatDateTimeProps, useAdvancedProps, diff --git a/components/salesforce_rest_api/actions/create-opportunity/create-opportunity.mjs b/components/salesforce_rest_api/actions/create-opportunity/create-opportunity.mjs index 543b5f9b58b83..f66f9ab2c0350 100644 --- a/components/salesforce_rest_api/actions/create-opportunity/create-opportunity.mjs +++ b/components/salesforce_rest_api/actions/create-opportunity/create-opportunity.mjs @@ -12,6 +12,9 @@ export default { type: "action", methods: { ...common.methods, + getObjectType() { + return "Opportunity"; + }, getAdvancedProps() { return opportunity.extraProps; }, @@ -26,6 +29,7 @@ export default { const { salesforce, getAdvancedProps, + getObjectType, getAdditionalFields, formatDateTimeProps, useAdvancedProps, diff --git a/components/salesforce_rest_api/actions/create-task/create-task.mjs b/components/salesforce_rest_api/actions/create-task/create-task.mjs index 0237b05995626..a8b3581dd8735 100644 --- a/components/salesforce_rest_api/actions/create-task/create-task.mjs +++ b/components/salesforce_rest_api/actions/create-task/create-task.mjs @@ -13,6 +13,9 @@ export default { type: "action", methods: { ...common.methods, + getObjectType() { + return "Task"; + }, getAdvancedProps() { return task.extraProps; }, @@ -27,6 +30,7 @@ export default { const { salesforce, getAdvancedProps, + getObjectType, getAdditionalFields, formatDateTimeProps, useAdvancedProps, diff --git a/components/salesforce_rest_api/actions/create-user/create-user.mjs b/components/salesforce_rest_api/actions/create-user/create-user.mjs index e290e9bb8060e..e84dbc18fb37c 100644 --- a/components/salesforce_rest_api/actions/create-user/create-user.mjs +++ b/components/salesforce_rest_api/actions/create-user/create-user.mjs @@ -13,6 +13,9 @@ export default { type: "action", methods: { ...common.methods, + getObjectType() { + return "User"; + }, getAdvancedProps() { return user.extraProps; }, @@ -26,6 +29,7 @@ export default { const { salesforce, getAdvancedProps, + getObjectType, getAdditionalFields, formatDateTimeProps, useAdvancedProps, diff --git a/components/salesforce_rest_api/actions/update-account/update-account.mjs b/components/salesforce_rest_api/actions/update-account/update-account.mjs index c8a0fb1fe0381..0c3debcf634c8 100644 --- a/components/salesforce_rest_api/actions/update-account/update-account.mjs +++ b/components/salesforce_rest_api/actions/update-account/update-account.mjs @@ -19,6 +19,9 @@ export default { type: "action", methods: { ...common.methods, + getObjectType() { + return "Account"; + }, getAdvancedProps() { return account.extraProps; }, @@ -44,6 +47,7 @@ export default { const { salesforce, getAdvancedProps, + getObjectType, getAdditionalFields, formatDateTimeProps, accountId, diff --git a/components/salesforce_rest_api/actions/update-contact/update-contact.mjs b/components/salesforce_rest_api/actions/update-contact/update-contact.mjs index ab0b80b24974c..e1a92d9d10c4d 100644 --- a/components/salesforce_rest_api/actions/update-contact/update-contact.mjs +++ b/components/salesforce_rest_api/actions/update-contact/update-contact.mjs @@ -20,6 +20,9 @@ export default { type: "action", methods: { ...common.methods, + getObjectType() { + return "Contact"; + }, getAdvancedProps() { return contact.extraProps; }, @@ -45,6 +48,7 @@ export default { const { salesforce, getAdvancedProps, + getObjectType, getAdditionalFields, formatDateTimeProps, contactId, diff --git a/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs b/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs index c82760ab818e1..3e543bca42414 100644 --- a/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs +++ b/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs @@ -20,6 +20,9 @@ export default { type: "action", methods: { ...common.methods, + getObjectType() { + return "Opportunity"; + }, getAdvancedProps() { return opportunity.extraProps; }, @@ -45,6 +48,7 @@ export default { const { salesforce, getAdvancedProps, + getObjectType, getAdditionalFields, formatDateTimeProps, opportunityId, From c6cb43683d1548b12c7ff77f3076a1c8a77ce376 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Tue, 30 Jul 2024 02:32:32 -0300 Subject: [PATCH 102/106] Fix encoding typo --- .../actions/create-attachment/create-attachment.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/salesforce_rest_api/actions/create-attachment/create-attachment.mjs b/components/salesforce_rest_api/actions/create-attachment/create-attachment.mjs index 2293a7a6e1383..934d6d063c2d9 100644 --- a/components/salesforce_rest_api/actions/create-attachment/create-attachment.mjs +++ b/components/salesforce_rest_api/actions/create-attachment/create-attachment.mjs @@ -36,7 +36,7 @@ export default { const body = filePathOrContent.includes("tmp/") ? fs.createReadStream(filePathOrContent, { - encoding: "base64 ", + encoding: "base64", }) : filePathOrContent; From a973a4be6d837147210a8a77c638331d790ffe11 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Tue, 30 Jul 2024 02:58:58 -0300 Subject: [PATCH 103/106] Moving async options props to the top --- .../common/sobjects/account.mjs | 42 ++++++------ .../common/sobjects/campaign.mjs | 32 ++++----- .../common/sobjects/case.mjs | 64 ++++++++--------- .../common/sobjects/contact.mjs | 37 +++++----- .../common/sobjects/event.mjs | 24 +++---- .../common/sobjects/lead.mjs | 68 +++++++++---------- .../common/sobjects/opportunity.mjs | 40 +++++------ .../common/sobjects/task.mjs | 24 +++---- .../common/sobjects/user.mjs | 68 +++++++++---------- 9 files changed, 200 insertions(+), 199 deletions(-) diff --git a/components/salesforce_rest_api/common/sobjects/account.mjs b/components/salesforce_rest_api/common/sobjects/account.mjs index eeb2afe64dfea..ab84380bf1703 100644 --- a/components/salesforce_rest_api/common/sobjects/account.mjs +++ b/components/salesforce_rest_api/common/sobjects/account.mjs @@ -48,6 +48,27 @@ export default { }, }, extraProps: { + OperatingHoursId: { + ...commonProps.OperatingHoursId, + description: "The operating hours associated with the account.", + optional: true, + }, + OwnerId: { + ...commonProps.UserId, + label: "Owner ID", + description: "The ID of the user who currently owns this account (defaults to the user logged in).", + optional: true, + }, + ParentId: { + ...commonProps.AccountId, + label: "Parent Account ID", + description: "ID of the parent account, if any.", + optional: true, + }, + RecordTypeId: { + ...commonProps.RecordTypeId, + optional: true, + }, AccountSource: { type: "string", label: "Account Source", @@ -175,17 +196,6 @@ export default { max: 99999999, optional: true, }, - OperatingHoursId: { - ...commonProps.OperatingHoursId, - description: "The operating hours associated with the account.", - optional: true, - }, - OwnerId: { - ...commonProps.UserId, - label: "Owner ID", - description: "The ID of the user who currently owns this account (defaults to the user logged in).", - optional: true, - }, Ownership: { type: "string", label: "Ownership", @@ -198,12 +208,6 @@ export default { "Other", ], }, - ParentId: { - ...commonProps.AccountId, - label: "Parent Account ID", - description: "ID of the parent account, if any.", - optional: true, - }, PersonIndividualId: { type: "string", label: "Person Individual ID", @@ -221,10 +225,6 @@ export default { "Cold", ], }, - RecordTypeId: { - ...commonProps.RecordTypeId, - optional: true, - }, ShippingCity: { type: "string", label: "Shipping City", diff --git a/components/salesforce_rest_api/common/sobjects/campaign.mjs b/components/salesforce_rest_api/common/sobjects/campaign.mjs index 6d0b7de8d0f8c..e8c19631317e5 100644 --- a/components/salesforce_rest_api/common/sobjects/campaign.mjs +++ b/components/salesforce_rest_api/common/sobjects/campaign.mjs @@ -48,6 +48,22 @@ export default { }, }, extraProps: { + OwnerId: { + ...commonProps.UserId, + label: "Owner ID", + description: "The ID of the user who owns this campaign (defaults to the user logged in).", + optional: true, + }, + ParentCampaign: { + ...commonProps.CampaignId, + label: "Parent Campaign ID", + description: "The campaign above this one in the campaign hierarchy.", + optional: true, + }, + RecordTypeId: { + ...commonProps.RecordTypeId, + optional: true, + }, StartDate: { type: "string", label: "Start Date", @@ -109,21 +125,5 @@ export default { description: "Number of individuals targeted by the campaign. For example, the number of emails sent.", optional: true, }, - OwnerId: { - ...commonProps.UserId, - label: "Owner ID", - description: "The ID of the user who owns this campaign (defaults to the user logged in).", - optional: true, - }, - ParentCampaign: { - ...commonProps.CampaignId, - label: "Parent Campaign ID", - description: "The campaign above this one in the campaign hierarchy.", - optional: true, - }, - RecordTypeId: { - ...commonProps.RecordTypeId, - optional: true, - }, }, }; diff --git a/components/salesforce_rest_api/common/sobjects/case.mjs b/components/salesforce_rest_api/common/sobjects/case.mjs index 57275071b6872..f49c87482dfd0 100644 --- a/components/salesforce_rest_api/common/sobjects/case.mjs +++ b/components/salesforce_rest_api/common/sobjects/case.mjs @@ -3,18 +3,6 @@ import salesforce from "../../salesforce_rest_api.app.mjs"; export default { initialProps: { - ServiceContractId: { - propDefinition: [ - salesforce, - "recordId", - () => ({ - objType: "ServiceContract", - nameField: "Name", - }), - ], - label: "Service Contract ID", - description: "ID of the ServiceContract associated with the entitlement.", - }, Description: { type: "string", label: "Description", @@ -73,6 +61,38 @@ export default { description: "ID of the question in Chatter associated with the case.", optional: true, }, + OwnerId: { + ...commonProps.ContactId, + description: "ID of the contact who owns the case.", + optional: true, + }, + ParentId: { + ...commonProps.CaseId, + description: "The ID of the parent case in the hierarchy.", + optional: true, + }, + QuestionId: { + ...commonProps.QuestionId, + description: + "The question in the answers community that is associated with the case.", + optional: true, + }, + RecordTypeId: { + ...commonProps.RecordTypeId, + optional: true, + }, + ServiceContractId: { + propDefinition: [ + salesforce, + "recordId", + () => ({ + objType: "ServiceContract", + nameField: "Name", + }), + ], + label: "Service Contract ID", + description: "ID of the ServiceContract associated with the entitlement.", + }, IsEscalated: { type: "boolean", label: "Escalated", @@ -104,16 +124,6 @@ export default { "Web", ], }, - OwnerId: { - ...commonProps.ContactId, - description: "ID of the contact who owns the case.", - optional: true, - }, - ParentId: { - ...commonProps.CaseId, - description: "The ID of the parent case in the hierarchy.", - optional: true, - }, Priority: { type: "string", label: "Priority", @@ -125,12 +135,6 @@ export default { "Low", ], }, - QuestionId: { - ...commonProps.QuestionId, - description: - "The question in the answers community that is associated with the case.", - optional: true, - }, Reason: { type: "string", label: "Reason", @@ -146,10 +150,6 @@ export default { "Other", ], }, - RecordTypeId: { - ...commonProps.RecordTypeId, - optional: true, - }, SlaStartDate: { type: "string", label: "SLA Start Date", diff --git a/components/salesforce_rest_api/common/sobjects/contact.mjs b/components/salesforce_rest_api/common/sobjects/contact.mjs index 2e56c608c6c84..7b2254399a895 100644 --- a/components/salesforce_rest_api/common/sobjects/contact.mjs +++ b/components/salesforce_rest_api/common/sobjects/contact.mjs @@ -41,6 +41,25 @@ export default { description: "ID of the account that's the parent of this contact.", optional: true, }, + IndividualId: { + ...commonProps.IndividualId, + optional: true, + }, + OwnerId: { + ...commonProps.UserId, + description: + "The ID of the owner of the account associated with this contact.", + optional: true, + }, + RecordTypeId: { + ...commonProps.RecordTypeId, + optional: true, + }, + ReportsToId: { + ...commonProps.ContactId, + label: "Reports To ID", + optional: true, + }, AssistantName: { type: "string", label: "Assistant's Name", @@ -98,10 +117,6 @@ export default { description: "The contact's home phone number.", optional: true, }, - IndividualId: { - ...commonProps.IndividualId, - optional: true, - }, LeadSource: { type: "string", label: "Lead Source", @@ -166,20 +181,6 @@ export default { description: "The contact's mobile phone number.", optional: true, }, - OwnerId: { - ...commonProps.UserId, - description: - "The ID of the owner of the account associated with this contact.", - optional: true, - }, - RecordTypeId: { - ...commonProps.RecordTypeId, - optional: true, - }, - ReportsToId: { - ...commonProps.ContactId, - optional: true, - }, Salutation: { type: "string", label: "Salutation", diff --git a/components/salesforce_rest_api/common/sobjects/event.mjs b/components/salesforce_rest_api/common/sobjects/event.mjs index 56cdcc168a52a..5ec46534a039b 100644 --- a/components/salesforce_rest_api/common/sobjects/event.mjs +++ b/components/salesforce_rest_api/common/sobjects/event.mjs @@ -69,6 +69,18 @@ export default { description: "One or more Contact or Lead IDs who declined this event.", optional: true, }, + UndecidedEventInviteeIds: { + ...commonProps.ContactOrLeadIds, + label: "Undecided Event Invitee IDs", + description: "One or more Contact or Lead IDs who are undecided about this event.", + optional: true, + }, + OwnerId: { + ...commonProps.UserId, + label: "Assigned to ID", + description: "ID of the user or public calendar who owns the event.", + optional: true, + }, IsPrivate: { type: "boolean", label: "Private", @@ -96,12 +108,6 @@ export default { "Indicates whether an event associated with an object can be viewed in the Customer Portal.", optional: true, }, - OwnerId: { - ...commonProps.UserId, - label: "Assigned to ID", - description: "ID of the user or public calendar who owns the event.", - optional: true, - }, RecurrenceDayOfMonth: { type: "integer", label: "Recurrence Day of Month", @@ -212,11 +218,5 @@ export default { "Other", ], }, - UndecidedEventInviteeIds: { - ...commonProps.ContactOrLeadIds, - label: "Undecided Event Invitee IDs", - description: "One or more Contact or Lead IDs who are undecided about this event.", - optional: true, - }, }, }; diff --git a/components/salesforce_rest_api/common/sobjects/lead.mjs b/components/salesforce_rest_api/common/sobjects/lead.mjs index b0206eb0d0556..cef42c876a6f2 100644 --- a/components/salesforce_rest_api/common/sobjects/lead.mjs +++ b/components/salesforce_rest_api/common/sobjects/lead.mjs @@ -49,6 +49,40 @@ export default { }, }, extraProps: { + ConvertedAccountId: { + ...commonProps.AccountId, + label: "Converted Account ID", + description: "The account into which the lead converted.", + optional: true, + }, + ConvertedContactId: { + ...commonProps.ContactId, + label: "Converted Contact ID", + description: "The contact into which the lead converted.", + optional: true, + }, + ConvertedOpportunityId: { + ...commonProps.OpportunityId, + label: "Converted Opportunity ID", + description: "The opportunity into which the lead converted.", + optional: true, + }, + IndividualId: { + ...commonProps.IndividualId, + label: "Individual ID", + description: "ID of the data privacy record associated with this lead.", + optional: true, + }, + OwnerId: { + ...commonProps.UserId, + label: "Owner ID", + description: "ID of the lead's owner.", + optional: true, + }, + RecordTypeId: { + ...commonProps.RecordTypeId, + optional: true, + }, AnnualRevenue: { type: "string", label: "Annual Revenue", @@ -75,24 +109,6 @@ export default { "The Data Universal Numbering System (D-U-N-S) number (max 9 characters).", optional: true, }, - ConvertedAccountId: { - ...commonProps.AccountId, - label: "Converted Account ID", - description: "The account into which the lead converted.", - optional: true, - }, - ConvertedContactId: { - ...commonProps.ContactId, - label: "Converted Contact ID", - description: "The contact into which the lead converted.", - optional: true, - }, - ConvertedOpportunityId: { - ...commonProps.OpportunityId, - label: "Converted Opportunity ID", - description: "The opportunity into which the lead converted.", - optional: true, - }, Country: { type: "string", label: "Country", @@ -119,12 +135,6 @@ export default { optional: true, options: GEOCODE_ACCURACY_OPTIONS, }, - IndividualId: { - ...commonProps.IndividualId, - label: "Individual ID", - description: "ID of the data privacy record associated with this lead.", - optional: true, - }, Industry: { type: "string", label: "Industry", @@ -176,12 +186,6 @@ export default { description: "Number of employees at the lead's company.", optional: true, }, - OwnerId: { - ...commonProps.UserId, - label: "Owner ID", - description: "ID of the lead's owner.", - optional: true, - }, PostalCode: { type: "string", label: "Zip/Postal Code", @@ -199,10 +203,6 @@ export default { "Cold", ], }, - RecordTypeId: { - ...commonProps.RecordTypeId, - optional: true, - }, State: { type: "string", label: "State/Province", diff --git a/components/salesforce_rest_api/common/sobjects/opportunity.mjs b/components/salesforce_rest_api/common/sobjects/opportunity.mjs index 7f6e0dc55dc5e..6f281f2d02f27 100644 --- a/components/salesforce_rest_api/common/sobjects/opportunity.mjs +++ b/components/salesforce_rest_api/common/sobjects/opportunity.mjs @@ -62,6 +62,26 @@ export default { description: "ID of the account associated with this opportunity.", optional: true, }, + CampaignId: { + ...commonProps.CampaignId, + description: "ID of a related Campaign.", + optional: true, + }, + OwnerId: { + ...commonProps.UserId, + description: + "ID of the User who has been assigned to work this opportunity.", + optional: true, + }, + Pricebook2Id: { + ...commonProps.Pricebook2Id, + description: "ID of a related Pricebook2 object.", + optional: true, + }, + RecordTypeId: { + ...commonProps.RecordTypeId, + optional: true, + }, Amount: { type: "string", label: "Amount", @@ -69,11 +89,6 @@ export default { "Estimated total sale amount. For opportunities with products, the amount is the sum of the related products.", optional: true, }, - CampaignId: { - ...commonProps.CampaignId, - description: "ID of a related Campaign.", - optional: true, - }, ForecastCategoryName: { type: "string", label: "Forecast Category Name", @@ -109,17 +124,6 @@ export default { "Description of next task in closing opportunity. Limit: 255 characters.", optional: true, }, - OwnerId: { - ...commonProps.UserId, - description: - "ID of the User who has been assigned to work this opportunity.", - optional: true, - }, - Pricebook2Id: { - ...commonProps.Pricebook2Id, - description: "ID of a related Pricebook2 object.", - optional: true, - }, Probability: { type: "string", label: "Probability (%)", @@ -127,10 +131,6 @@ export default { "Percentage of estimated confidence in closing the opportunity.", optional: true, }, - RecordTypeId: { - ...commonProps.RecordTypeId, - optional: true, - }, TotalOpportunityQuantity: { type: "integer", label: "Quantity", diff --git a/components/salesforce_rest_api/common/sobjects/task.mjs b/components/salesforce_rest_api/common/sobjects/task.mjs index 926734530246d..1e7fa27da4e8d 100644 --- a/components/salesforce_rest_api/common/sobjects/task.mjs +++ b/components/salesforce_rest_api/common/sobjects/task.mjs @@ -75,6 +75,18 @@ export default { }, }, extraProps: { + OwnerId: { + ...commonProps.UserId, + label: "Owner ID", + description: "ID of the User or Group who owns the record.", + optional: true, + }, + TaskWhoIds: { + ...commonProps.ContactOrLeadIds, + label: "Related IDs", + description: "One or more Contact or Lead IDs related to this task.", + optional: true, + }, CallDisposition: { type: "string", label: "Call Result", @@ -119,12 +131,6 @@ export default { "Indicates whether a task associated with an object can be viewed in the Customer Portal.", optional: true, }, - OwnerId: { - ...commonProps.UserId, - label: "Owner ID", - description: "ID of the User or Group who owns the record.", - optional: true, - }, RecurrenceDayOfMonth: { type: "integer", label: "Recurrence Day of Month", @@ -236,11 +242,5 @@ export default { "Other", ], }, - TaskWhoIds: { - ...commonProps.ContactOrLeadIds, - label: "Related IDs", - description: "One or more Contact or Lead IDs related to this task.", - optional: true, - }, }, }; diff --git a/components/salesforce_rest_api/common/sobjects/user.mjs b/components/salesforce_rest_api/common/sobjects/user.mjs index cdc6e4f70550e..12a379dcb01fe 100644 --- a/components/salesforce_rest_api/common/sobjects/user.mjs +++ b/components/salesforce_rest_api/common/sobjects/user.mjs @@ -119,13 +119,6 @@ export default { }, }, extraProps: { - AboutMe: { - type: "string", - label: "About Me", - description: - "Information about the user, such as areas of interest or skills.", - optional: true, - }, AccountId: { ...commonProps.AccountId, description: "ID of the Account associated with a Customer Portal user.", @@ -137,6 +130,40 @@ export default { "If Salesforce CRM Call Center is enabled, represents the call center that this user is assigned to.", optional: true, }, + ContactId: { + ...commonProps.ContactId, + description: "ID of the Contact associated with this account.", + optional: true, + }, + DelegatedApproverId: { + ...commonProps.UserId, + label: "Delegated Approver ID", + description: "ID of the user who is a delegated approver for this user.", + optional: true, + }, + IndividualId: { + ...commonProps.IndividualId, + description: "ID of the data privacy record associated with this user.", + optional: true, + }, + ManagerId: { + ...commonProps.UserId, + label: "Manager ID", + description: "The ID of the user who manages this user.", + optional: true, + }, + UserRoleId: { + ...commonProps.AccountId, + description: "ID of the user's UserRole.", + optional: true, + }, + AboutMe: { + type: "string", + label: "About Me", + description: + "Information about the user, such as areas of interest or skills.", + optional: true, + }, City: { type: "string", label: "City", @@ -150,11 +177,6 @@ export default { description: "The name of the user's company.", optional: true, }, - ContactId: { - ...commonProps.ContactId, - description: "ID of the Contact associated with this account.", - optional: true, - }, Country: { type: "string", label: "Country", @@ -187,12 +209,6 @@ export default { }, ], }, - DelegatedApproverId: { - ...commonProps.UserId, - label: "Delegated Approver ID", - description: "ID of the user who is a delegated approver for this user.", - optional: true, - }, Department: { type: "string", label: "Department", @@ -257,11 +273,6 @@ export default { optional: true, options: GEOCODE_ACCURACY_OPTIONS, }, - IndividualId: { - ...commonProps.IndividualId, - description: "ID of the data privacy record associated with this user.", - optional: true, - }, IsActive: { type: "boolean", label: "Active", @@ -289,12 +300,6 @@ export default { "A number between -180 and 180 with up to 15 decimal places. Use with `Latitude` to specify the precise geolocation of an address.", optional: true, }, - ManagerId: { - ...commonProps.UserId, - label: "Manager ID", - description: "The ID of the user who manages this user.", - optional: true, - }, MiddleName: { type: "string", label: "Middle Name", @@ -378,11 +383,6 @@ export default { description: "The user's business title, such as Vice President.", optional: true, }, - UserRoleId: { - ...commonProps.AccountId, - description: "ID of the user's UserRole.", - optional: true, - }, UserPermissionsCallCenterAutoLogin: { type: "boolean", label: "Auto-login To Call Center", From f02fbbbe79d206bc88f10ef066dc66adb630d1c3 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Thu, 1 Aug 2024 00:00:21 -0300 Subject: [PATCH 104/106] Fixed base64 encoding issue --- .../actions/create-attachment/create-attachment.mjs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/components/salesforce_rest_api/actions/create-attachment/create-attachment.mjs b/components/salesforce_rest_api/actions/create-attachment/create-attachment.mjs index 934d6d063c2d9..2951a9811ebef 100644 --- a/components/salesforce_rest_api/actions/create-attachment/create-attachment.mjs +++ b/components/salesforce_rest_api/actions/create-attachment/create-attachment.mjs @@ -35,9 +35,7 @@ export default { /* eslint-enable no-unused-vars */ const body = filePathOrContent.includes("tmp/") - ? fs.createReadStream(filePathOrContent, { - encoding: "base64", - }) + ? (await fs.promises.readFile(filePathOrContent)).toString("base64") : filePathOrContent; const response = await salesforce.createRecord("Attachment", { From 6e8fa83f4296b8db99578d25797b79f917ab790a Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Thu, 1 Aug 2024 23:14:30 -0300 Subject: [PATCH 105/106] Entity adjustments --- .../salesforce_rest_api/common/sobjects/account.mjs | 9 --------- components/salesforce_rest_api/common/sobjects/case.mjs | 4 ++-- .../salesforce_rest_api/common/sobjects/caseComment.mjs | 7 ------- components/salesforce_rest_api/common/sobjects/task.mjs | 2 +- components/salesforce_rest_api/common/sobjects/user.mjs | 2 +- 5 files changed, 4 insertions(+), 20 deletions(-) diff --git a/components/salesforce_rest_api/common/sobjects/account.mjs b/components/salesforce_rest_api/common/sobjects/account.mjs index ab84380bf1703..efa5d8d1c3c8d 100644 --- a/components/salesforce_rest_api/common/sobjects/account.mjs +++ b/components/salesforce_rest_api/common/sobjects/account.mjs @@ -11,15 +11,6 @@ export default { description: "Name of the account. Max 255 characters.", }, }, - updateProps: { - IsPartner: { - type: "boolean", - label: "Is Partner", - description: - "Indicates whether the account has at least one contact enabled to use the org's partner portal.", - optional: true, - }, - }, initialProps: { AccountNumber: { type: "string", diff --git a/components/salesforce_rest_api/common/sobjects/case.mjs b/components/salesforce_rest_api/common/sobjects/case.mjs index f49c87482dfd0..17544e4b6810f 100644 --- a/components/salesforce_rest_api/common/sobjects/case.mjs +++ b/components/salesforce_rest_api/common/sobjects/case.mjs @@ -62,8 +62,8 @@ export default { optional: true, }, OwnerId: { - ...commonProps.ContactId, - description: "ID of the contact who owns the case.", + ...commonProps.UserId, + description: "ID of the user who owns the case.", optional: true, }, ParentId: { diff --git a/components/salesforce_rest_api/common/sobjects/caseComment.mjs b/components/salesforce_rest_api/common/sobjects/caseComment.mjs index 74857cb62e316..62edc5474c65b 100644 --- a/components/salesforce_rest_api/common/sobjects/caseComment.mjs +++ b/components/salesforce_rest_api/common/sobjects/caseComment.mjs @@ -20,13 +20,6 @@ export default { label: "Parent Case ID", description: "ID of the parent Case.", }, - IsNotificationSelected: { - type: "boolean", - label: "Is Notification Selected", - description: - "Indicates whether an email notification is sent to the case contact when a CaseComment is created or updated.", - optional: true, - }, IsPublished: { type: "boolean", label: "Is Published", diff --git a/components/salesforce_rest_api/common/sobjects/task.mjs b/components/salesforce_rest_api/common/sobjects/task.mjs index 1e7fa27da4e8d..1e842b4255b20 100644 --- a/components/salesforce_rest_api/common/sobjects/task.mjs +++ b/components/salesforce_rest_api/common/sobjects/task.mjs @@ -172,7 +172,7 @@ export default { }, RecurrenceRegeneratedType: { type: "string", - label: "Recurrence Regenerated Type", + label: "Repeat This Task", description: "Represents what triggers a repeating task to repeat.", optional: true, options: [ diff --git a/components/salesforce_rest_api/common/sobjects/user.mjs b/components/salesforce_rest_api/common/sobjects/user.mjs index 12a379dcb01fe..e77a6f9e2f1df 100644 --- a/components/salesforce_rest_api/common/sobjects/user.mjs +++ b/components/salesforce_rest_api/common/sobjects/user.mjs @@ -153,7 +153,7 @@ export default { optional: true, }, UserRoleId: { - ...commonProps.AccountId, + ...commonProps.UserRoleId, description: "ID of the user's UserRole.", optional: true, }, From cb198d42311fa263f191e45927658ecd8fae5d0c Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Thu, 1 Aug 2024 23:15:06 -0300 Subject: [PATCH 106/106] Summary fix --- .../actions/update-opportunity/update-opportunity.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs b/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs index 3e543bca42414..c2792aa5038d3 100644 --- a/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs +++ b/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs @@ -71,7 +71,7 @@ export default { ...getAdditionalFields(), }, }); - $.export("$summary", `Successfully updated opportunity (ID: ${this.OpportunityId})`); + $.export("$summary", `Successfully updated opportunity (ID: ${opportunityId})`); return response; }, };