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..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 @@ -1,52 +1,52 @@ -import salesForceRestApi from "../../salesforce_rest_api.app.mjs"; -import { - removeNullEntries, toSingleLineString, -} from "../../common/utils.mjs"; +import salesforce from "../../salesforce_rest_api.app.mjs"; import constants from "../../common/constants.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 [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", + 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.0", type: "action", props: { - salesForceRestApi, + salesforce, campaignId: { propDefinition: [ - salesForceRestApi, - "sobjectId", + salesforce, + "recordId", () => ({ - objectType: constants.OBJECT_TYPE.CAMPAIGN, + objType: "Campaign", + nameField: "Name", }), ], label: "Campaign ID", - description: "ID of the Campaign to which this Lead is associated.", + description: "The Campaign to add a Contact to.", }, contactId: { propDefinition: [ - salesForceRestApi, - "sobjectId", + salesforce, + "recordId", () => ({ - objectType: constants.OBJECT_TYPE.CONTACT, + objType: "Contact", + nameField: "Name", }), ], 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({ $ }) { - const data = removeNullEntries({ - CampaignId: this.campaignId, - ContactId: this.contactId, + const { + salesforce, campaignId, contactId, + } = this; + const response = await salesforce.createObject({ + $, + objectType: constants.OBJECT_TYPE.CAMPAIGN_MEMBER, + data: { + CampaignId: campaignId, + ContactId: contactId, + }, }); - const response = await this.salesForceRestApi - .createObject(constants.OBJECT_TYPE.CAMPAIGN_MEMBER, data); - response && $.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 15bedd89e365a..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,51 +1,52 @@ -import salesForceRestApi from "../../salesforce_rest_api.app.mjs"; -import { - removeNullEntries, toSingleLineString, -} from "../../common/utils.mjs"; +import salesforce from "../../salesforce_rest_api.app.mjs"; import constants from "../../common/constants.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) - `), - version: "0.0.6", + 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", + salesforce, + "recordId", () => ({ - objectType: constants.OBJECT_TYPE.CAMPAIGN, + objType: "Campaign", + nameField: "Name", }), ], label: "Campaign ID", - description: "ID of the Campaign to which this Lead is associated.", + description: "The Campaign to add a Lead to.", }, leadId: { propDefinition: [ - salesForceRestApi, - "sobjectId", + salesforce, + "recordId", () => ({ - objectType: constants.OBJECT_TYPE.LEAD, + objType: "Lead", + nameField: "Name", }), ], label: "Lead ID", - description: "ID of the Lead who is associated with a Campaign.", + description: "The Lead to add to the selected Campaign.", }, }, async run({ $ }) { - const data = removeNullEntries({ - CampaignId: this.campaignId, - LeadId: this.leadId, + const { + salesforce, campaignId, leadId, + } = this; + const response = await salesforce.createObject({ + $, + objectType: constants.OBJECT_TYPE.CAMPAIGN_MEMBER, + data: { + CampaignId: campaignId, + LeadId: leadId, + }, }); - const response = await this.salesForceRestApi.createObject("CampaignMember", data); - response && $.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/actions/common/base-create-update.mjs b/components/salesforce_rest_api/actions/common/base-create-update.mjs new file mode 100644 index 0000000000000..f105f80cad4b4 --- /dev/null +++ b/components/salesforce_rest_api/actions/common/base-create-update.mjs @@ -0,0 +1,108 @@ +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, + 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") { + initialProps = Object.fromEntries( + Object.entries(initialProps).map(([ + key, + value, + ]) => [ + key, + { + ...value, + optional: true, + }, + ]), + ); + } + + return { + salesforce, + ...showDateInfo && { + dateInfo: { + type: "alert", + 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`.", + }, + }, + ...objType[createOrUpdate === "create" + ? "createProps" + : "updateProps"], + ...initialProps, + docsInfo: { + type: "alert", + alertType: "info", + content: `[See the documentation](${docsLink}) for more information on available fields.`, + }, + useAdvancedProps: { + propDefinition: [ + salesforce, + "useAdvancedProps", + ], + }, + }; +} + +export default { + methods: { + getObjectType() { + return ""; + }, + getAdvancedProps() { + return {}; + }, + 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).filter(([ + , value, + ]) => value !== undefined) + .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 [ + key, + date.toISOString(), + ]; + })); + }, + }, + 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/common/base.mjs b/components/salesforce_rest_api/actions/common/base.mjs deleted file mode 100644 index 251cd3f8200a6..0000000000000 --- a/components/salesforce_rest_api/actions/common/base.mjs +++ /dev/null @@ -1,18 +0,0 @@ -import salesforce from "../../salesforce_rest_api.app.mjs"; - -export default { - props: { - salesforce, - }, - methods: { - additionalProps(selector, sobject) { - if (!selector || !sobject) { - return {}; - } - return selector.reduce((props, prop) => ({ - ...props, - [prop]: sobject[prop], - }), {}); - }, - }, -}; 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..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,10 +5,17 @@ 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.0.6", 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, }, @@ -44,6 +51,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-account/create-account.mjs b/components/salesforce_rest_api/actions/create-account/create-account.mjs index 892c38806ab0c..b538d25f29779 100644 --- a/components/salesforce_rest_api/actions/create-account/create-account.mjs +++ b/components/salesforce_rest_api/actions/create-account/create-account.mjs @@ -1,52 +1,49 @@ -import common from "../common/base.mjs"; +import common, { getProps } from "../common/base-create-update.mjs"; import account from "../../common/sobjects/account.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_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). - 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", + description: `Creates a Salesforce account. [See the documentation](${docsLink})`, + version: "0.3.0", type: "action", - props: { - salesforce, - Name: { - type: "string", - label: "Name", - description: "Name of the account.", + methods: { + ...common.methods, + getObjectType() { + return "Account"; }, - selector: { - propDefinition: [ - salesforce, - "fieldSelector", - ], - description: `${salesforce.propDefinitions.fieldSelector.description} Account`, - options: () => Object.keys(account), - reloadProps: true, + getAdvancedProps() { + return account.extraProps; }, }, - additionalProps() { - return this.additionalProps(this.selector, account); - }, + props: getProps({ + objType: account, + docsLink, + }), async run({ $ }) { - const data = pickBy(pick(this, [ - "Name", - ...this.selector, - ])); - const response = await this.salesforce.createAccount({ + /* eslint-disable no-unused-vars */ + const { + salesforce, + getAdvancedProps, + getObjectType, + getAdditionalFields, + formatDateTimeProps, + useAdvancedProps, + docsInfo, + dateInfo, + additionalFields, + ...data + } = this; + /* eslint-enable no-unused-vars */ + const response = await salesforce.createRecord("Account", { $, - data, + data: { + ...data, + ...getAdditionalFields(), + }, }); $.export("$summary", `Successfully created account "${this.Name}"`); return response; 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..2951a9811ebef 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,49 @@ -import common from "../common/base.mjs"; +import common, { getProps } from "../common/base-create-update.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.3.7", + description: `Creates an Attachment on a parent object. [See the documentation](${docsLink})`, + version: "0.4.0", 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/") + ? (await fs.promises.readFile(filePathOrContent)).toString("base64") + : filePathOrContent; + + const response = await salesforce.createRecord("Attachment", { $, - data, + data: { + Body: body, + ...data, + }, }); $.export("$summary", `Successfully created attachment "${this.Name}"`); return response; 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..1061faf292791 100644 --- a/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs +++ b/components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs @@ -1,54 +1,58 @@ -import common from "../common/base.mjs"; +import common, { getProps } from "../common/base-create-update.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.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.2.7", + description: `Creates a marketing campaign. [See the documentation](${docsLink})`, + version: "0.3.0", type: "action", - props: { - salesforce, - Name: { - type: "string", - label: "Name", - description: "Required. Name of the campaign. Limit: is 80 characters.", + methods: { + ...common.methods, + getObjectType() { + return "Campaign"; }, - selector: { - propDefinition: [ - salesforce, - "fieldSelector", - ], - description: `${salesforce.propDefinitions.fieldSelector.description} Campaign`, - options: () => Object.keys(campaign), - reloadProps: true, - optional: true, + getAdvancedProps() { + return campaign.extraProps; }, }, - additionalProps() { - return this.additionalProps(this.selector, campaign); - }, + props: getProps({ + objType: campaign, + docsLink, + showDateInfo: true, + }), async run({ $ }) { - const data = pickBy(pick(this, [ - "Name", - ...this.selector, - ])); - const response = await this.salesforce.createCampaign({ + /* eslint-disable no-unused-vars, max-len */ + const { + salesforce, + getAdvancedProps, + getObjectType, + getAdditionalFields, + formatDateTimeProps, + useAdvancedProps, + docsInfo, + dateInfo, + additionalFields, + StartDate, + EndDate, + ...data + } = this; + /* eslint-enable no-unused-vars, max-len */ + const response = await salesforce.createRecord("Campaign", { $, - data, + data: { + ...data, + ...formatDateTimeProps({ + StartDate, + EndDate, + }), + ...getAdditionalFields(), + }, }); - $.export("$summary", `Created campaign "${this.Name}"`); + $.export("$summary", `Successfully created campaign "${this.Name}"`); return response; }, }; 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..b18f25f93bbfc 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,57 @@ -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-create-update.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) - `), - version: "0.2.7", + 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, + getObjectType() { + return "Case"; }, - selector: { - propDefinition: [ - salesforce, - "fieldSelector", - ], - description: `${salesforce.propDefinitions.fieldSelector.description} Case`, - options: () => Object.keys(salesforceCase), - reloadProps: true, + getAdvancedProps() { + return caseObj.extraProps; }, }, - additionalProps() { - return this.additionalProps(this.selector, salesforceCase); - }, + props: getProps({ + objType: caseObj, + docsLink, + showDateInfo: true, + }), async run({ $ }) { - const data = pickBy(pick(this, [ - "SuppliedEmail", - ...this.selector, - ])); - const response = await this.salesforce.createCase({ + /* eslint-disable no-unused-vars */ + const { + salesforce, + getAdvancedProps, + getObjectType, + getAdditionalFields, + formatDateTimeProps, + useAdvancedProps, + docsInfo, + dateInfo, + additionalFields, + SlaStartDate, + ...data + } = this; + /* eslint-enable no-unused-vars */ + const response = await salesforce.createRecord("Case", { $, - data, + data: { + ...data, + ...formatDateTimeProps({ + SlaStartDate, + }), + ...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/actions/create-casecomment/create-casecomment.mjs b/components/salesforce_rest_api/actions/create-casecomment/create-casecomment.mjs index b382c01377675..08aa657d0313c 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,37 @@ -import common from "../common/base.mjs"; +import common, { getProps } from "../common/base-create-update.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.2.7", + name: "Create Case Comment", + description: `Creates a Case Comment on a selected Case. [See the documentation](${docsLink})`, + version: "0.3.0", 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, + getAdvancedProps, + getAdditionalFields, + formatDateTimeProps, + docsInfo, + ...data + } = this; + /* eslint-enable no-unused-vars */ + 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 ac56612e98dbc..a2bd4fc321d45 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,54 @@ -import common from "../common/base.mjs"; +import common, { getProps } from "../common/base-create-update.mjs"; import contact from "../../common/sobjects/contact.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_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.2.7", + description: `Creates a contact. [See the documentation](${docsLink})`, + version: "0.3.0", type: "action", - props: { - salesforce, - LastName: { - type: "string", - label: "Last name", - description: "Last name of the contact up to 80 characters.", + methods: { + ...common.methods, + getObjectType() { + return "Contact"; }, - selector: { - propDefinition: [ - salesforce, - "fieldSelector", - ], - description: `${salesforce.propDefinitions.fieldSelector.description} Contact`, - options: () => Object.keys(contact), - reloadProps: true, + getAdvancedProps() { + return contact.extraProps; }, }, - additionalProps() { - return this.additionalProps(this.selector, contact); - }, + props: getProps({ + objType: contact, + docsLink, + showDateInfo: true, + }), async run({ $ }) { - const data = pickBy(pick(this, [ - "LastName", - ...this.selector, - ])); - const response = await this.salesforce.createContact({ + /* eslint-disable no-unused-vars */ + const { + salesforce, + getAdvancedProps, + getObjectType, + getAdditionalFields, + formatDateTimeProps, + useAdvancedProps, + docsInfo, + dateInfo, + additionalFields, + Birthdate, + ...data + } = this; + /* eslint-enable no-unused-vars */ + const response = await salesforce.createRecord("Contact", { $, - data, + data: { + ...data, + ...formatDateTimeProps({ + Birthdate, + }), + ...getAdditionalFields(), + }, }); $.export("$summary", `Successfully created contact "${this.LastName}"`); 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 fb233f865f7e5..372d73e6a6b14 100644 --- a/components/salesforce_rest_api/actions/create-event/create-event.mjs +++ b/components/salesforce_rest_api/actions/create-event/create-event.mjs @@ -1,80 +1,71 @@ -import salesforce from "../../salesforce_rest_api.app.mjs"; -import { - removeNullEntries, toSingleLineString, -} from "../../common/utils.mjs"; +import common, { getProps } from "../common/base-create-update.mjs"; +import event from "../../common/sobjects/event.mjs"; + +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: 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.2.7", + description: `Creates an event. [See the documentation](${docsLink})`, + version: "0.3.0", 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, + getObjectType() { + return "Event"; }, - Subject: { - type: "string", - label: "Subject", - description: "The subject line of the event, such as Call, Email, or Meeting. Limit: 255 characters.", + getAdvancedProps() { + return event.extraProps; }, }, - 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, + showDateInfo: true, + }), 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, - }); - const response = await this.salesforce.createEvent({ + /* eslint-disable no-unused-vars */ + const { + salesforce, + getAdvancedProps, + getObjectType, + getAdditionalFields, + formatDateTimeProps, + useAdvancedProps, + docsInfo, + dateInfo, + additionalFields, + ActivityDate, + EndDateTime, + RecurrenceEndDateOnly, + RecurrenceStartDateTime, + ReminderDateTime, + StartDateTime, + RecurrenceDayOfWeekMask, + ...data + } = this; + /* eslint-enable no-unused-vars */ + const response = await salesforce.createRecord("Event", { $, - data, + data: { + ...data, + ...formatDateTimeProps({ + ActivityDate, + EndDateTime, + RecurrenceEndDateOnly, + RecurrenceStartDateTime, + ReminderDateTime, + StartDateTime, + }), + RecurrenceDayOfWeekMask: RecurrenceDayOfWeekMask?.reduce?.((acc, val) => acc + val, 0), + ...getAdditionalFields(), + }, }); - $.export("$summary", "Succcessfully created event"); + $.export("$summary", `Succcessfully created event${this.Subject + ? ` "${this.Subject}"` + : ""}`); return response; }, }; 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..1049b3f2e1d37 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,51 @@ -import common from "../common/base.mjs"; +import common, { getProps } from "../common/base-create-update.mjs"; import lead from "../../common/sobjects/lead.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_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.2.7", + description: `Creates a lead. [See the documentation](${docsLink})`, + version: "0.3.0", 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, + getObjectType() { + return "Lead"; }, - LastName: { - type: "string", - label: "Last name", - description: "Required. Last name of the lead up to 80 characters.", + getAdvancedProps() { + return lead.extraProps; }, - 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, + getAdvancedProps, + getObjectType, + getAdditionalFields, + formatDateTimeProps, + useAdvancedProps, + docsInfo, + dateInfo, + additionalFields, + ...data + } = this; + /* eslint-enable no-unused-vars */ + const response = await salesforce.createRecord("Lead", { $, - data, + data: { + ...data, + ...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/actions/create-note/create-note.mjs b/components/salesforce_rest_api/actions/create-note/create-note.mjs index 47b167281d580..cadeb6a4a996a 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,36 @@ -import common from "../common/base.mjs"; +import common, { getProps } from "../common/base-create-update.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.2.7", + description: `Creates a note. [See the documentation](${docsLink})`, + version: "0.3.0", 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, + getAdvancedProps, + getAdditionalFields, + formatDateTimeProps, + docsInfo, ...data + } = this; + /* eslint-enable no-unused-vars */ + 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 6d0f561d47a5f..f66f9ab2c0350 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,54 @@ -import common from "../common/base.mjs"; +import common, { getProps } from "../common/base-create-update.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) - `), - version: "0.2.7", + 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, + getObjectType() { + return "Opportunity"; }, - Name: { - type: "string", - label: "Name", - description: "A name for this opportunity. Limit: 120 characters.", + getAdvancedProps() { + return opportunity.extraProps; }, - 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, + getAdvancedProps, + getObjectType, + getAdditionalFields, + formatDateTimeProps, + useAdvancedProps, + docsInfo, + dateInfo, + additionalFields, + CloseDate, + ...data + } = this; + /* eslint-enable no-unused-vars */ + const response = await salesforce.createRecord("Opportunity", { $, - data, + data: { + ...data, + ...formatDateTimeProps({ + CloseDate, + }), + ...getAdditionalFields(), + }, }); $.export("$summary", `Successfully created opportunity "${this.Name}"`); 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 8e22d0d271869..490b1d066547e 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,14 @@ +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-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.2.7", + 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.0", type: "action", props: { salesforce, @@ -17,20 +17,54 @@ export default { salesforce, "objectType", ], - description: "SObject Type for this record", - }, - sobject: { - type: "object", - label: "SObject fields and values", - description: "Data of the SObject record to create", + description: "The type of object to create a record of", + reloadProps: true, }, }, + methods: { + getAdditionalFields, + convertFieldsToProps, + }, + 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 = this.convertFieldsToProps(requiredFields); + + 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: getData, + convertFieldsToProps, + docsInfo, + additionalFields, + ...data + } = this; + /* eslint-enable no-unused-vars */ + const response = await salesforce.createRecord(objectType, { $, - data: this.sobject, + data: { + ...data, + ...getData(), + }, }); - $.export("$summary", `Created record "${this.objectType}"`); + $.export("$summary", `Successfully created ${objectType} record (ID: ${response.id})`); 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 54b10bdbf2dc7..a8b3581dd8735 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,67 @@ -import common from "../common/base.mjs"; +import common, { getProps } from "../common/base-create-update.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.3.7", + description: `Creates a task. [See the documentation](${docsLink})`, + version: "0.4.0", 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, + getObjectType() { + return "Task"; }, - 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).", + getAdvancedProps() { + return task.extraProps; }, - 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, - ])); - const response = await this.salesforce.createTask({ + /* eslint-disable no-unused-vars */ + const { + salesforce, + getAdvancedProps, + getObjectType, + getAdditionalFields, + formatDateTimeProps, + useAdvancedProps, + docsInfo, + dateInfo, + additionalFields, + ActivityDate, + RecurrenceEndDateOnly, + RecurrenceStartDateOnly, + ReminderDateTime, + RecurrenceDayOfWeekMask, + ...data + } = this; + /* eslint-enable no-unused-vars */ + const response = await salesforce.createRecord("Task", { $, - data, + data: { + ...data, + ...formatDateTimeProps({ + ActivityDate, + RecurrenceEndDateOnly, + RecurrenceStartDateOnly, + ReminderDateTime, + }), + RecurrenceDayOfWeekMask: RecurrenceDayOfWeekMask?.reduce?.((acc, val) => acc + val, 0), + ...getAdditionalFields(), + }, }); - $.export("$summary", "Successfully created task"); + $.export("$summary", `Succcessfully created task${this.Subject + ? ` "${this.Subject}"` + : ""}`); 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 8d0a33718dd70..e84dbc18fb37c 100644 --- a/components/salesforce_rest_api/actions/create-user/create-user.mjs +++ b/components/salesforce_rest_api/actions/create-user/create-user.mjs @@ -1,215 +1,52 @@ -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-create-update.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) - `), - version: "0.0.1", + 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: { - createUser(args = {}) { - return this.salesforce._makeRequest({ - method: "POST", - url: this.salesforce._sObjectTypeApiUrl("User"), - ...args, - }); + ...common.methods, + getObjectType() { + return "User"; + }, + getAdvancedProps() { + return user.extraProps; }, }, + props: getProps({ + objType: user, + docsLink, + }), async run({ $ }) { + /* eslint-disable no-unused-vars */ const { - createUser, + salesforce, + getAdvancedProps, + getObjectType, + getAdditionalFields, + formatDateTimeProps, + useAdvancedProps, + docsInfo, + dateInfo, + additionalFields, ...data } = this; - - const response = await createUser({ + /* eslint-enable no-unused-vars */ + const response = await salesforce.createRecord("User", { $, - data: utils.keysToCapitalCase(data), + data: { + ...data, + ...getAdditionalFields(), + }, }); - $.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 3a79d64fddd5c..8d7ccec6c201e 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,34 @@ 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.2.7", + 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.0", type: "action", props: { salesforce, - OpportunityId: { - type: "string", + recordId: { + propDefinition: [ + salesforce, + "recordId", + () => ({ + objType: "Opportunity", + nameField: "Name", + }), + ], label: "Opportunity ID", - description: "ID of the Opportunity to delete", + description: "ID of the opportunity to delete.", }, }, async run({ $ }) { - const response = await this.salesforce.deleteOpportunity({ + const { recordId } = this; + const response = await this.salesforce.deleteRecord({ + sobjectType: "Opportunity", $, - id: this.OpportunityId, + recordId, }); - $.export("$summary", "Successfully deleted opportunity"); + $.export("$summary", `Successfully deleted opportunity (ID: ${recordId})`); 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 db7f508eb6e62..4ea946d854315 100644 --- a/components/salesforce_rest_api/actions/delete-record/delete-record.mjs +++ b/components/salesforce_rest_api/actions/delete-record/delete-record.mjs @@ -1,42 +1,44 @@ -import salesForceRestApi from "../../salesforce_rest_api.app.mjs"; +import salesforce 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.1.5", + "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.0", type: "action", props: { - salesForceRestApi, + salesforce, sobjectType: { propDefinition: [ - salesForceRestApi, + salesforce, "objectType", ], + description: "The type of object to delete a record of.", }, - sobjectId: { + recordId: { propDefinition: [ - salesForceRestApi, - "sobjectId", + salesforce, + "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( + const response = await this.salesforce.deleteRecord({ + $, sobjectType, - sobjectId, - ); - response && $.export("$summary", `Successfully deleted record with ID ${sobjectId}`); + recordId, + }); + $.export("$summary", `Successfully deleted record (ID: ${recordId})`); 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 deleted file mode 100644 index e4e947bb79709..0000000000000 --- a/components/salesforce_rest_api/actions/find-create-record/find-create-record.mjs +++ /dev/null @@ -1,89 +0,0 @@ -import { ConfigurationError } from "@pipedream/platform"; -import salesForceRestApi 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.1.5", - type: "action", - props: { - salesForceRestApi, - sobjectType: { - propDefinition: [ - salesForceRestApi, - "objectType", - ], - }, - sobjectId: { - propDefinition: [ - salesForceRestApi, - "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.salesForceRestApi.getSObject( - sobjectType, - sobjectId, - sobjectFields && { - fields: sobjectFields.join(","), - }, - ); - } catch (error) { - if (!createIfNotFound) throw new ConfigurationError("Record not found"); - } - - if (createIfNotFound && !data) { - const response = await this.salesForceRestApi.createObject( - sobjectType, - 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/find-records/find-records.mjs b/components/salesforce_rest_api/actions/find-records/find-records.mjs index 53df0cba502fd..813f662dc9e65 100644 --- a/components/salesforce_rest_api/actions/find-records/find-records.mjs +++ b/components/salesforce_rest_api/actions/find-records/find-records.mjs @@ -1,52 +1,67 @@ -import salesForceRestApi from "../../salesforce_rest_api.app.mjs"; +import salesforce 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.1.5", + "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.0", type: "action", props: { - salesForceRestApi, + salesforce, sobjectType: { propDefinition: [ - salesForceRestApi, + salesforce, "objectType", ], + description: "The type of object to obtain records of.", }, - ids: { + fieldsToObtain: { propDefinition: [ - salesForceRestApi, - "sobjectId", + salesforce, + "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.salesForceRestApi.getRecords( - sobjectType, { - fields: Array.isArray(fields) && fields.join(",") || fields, - ids: Array.isArray(ids) && ids.join(",") || ids, - }, - ); - if (response) { - $.export("$summary", "Record found successfully"); + + 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("','")}')`; } - return response; + + const { records } = await this.salesforce.query({ + $, + query, + }); + + $.export("$summary", `Sucessfully retrieved ${records.length} records`); + return records; }, }; 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 741ae8451d889..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.2.7", - 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", `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 e870dc6ed2af3..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 @@ -1,14 +1,10 @@ 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) - `), - version: "0.2.7", + 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.2.8", type: "action", props: { salesforce, @@ -71,7 +67,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/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..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 @@ -1,39 +1,64 @@ -import salesForceRestApi from "../../salesforce_rest_api.app.mjs"; -import { toSingleLineString } from "../../common/utils.mjs"; +import salesforce from "../../salesforce_rest_api.app.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.0.6", + 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.0", type: "action", props: { - salesForceRestApi, - text: { - label: "Text body", - description: "Text body.", - type: "string", + salesforce, + sobjectType: { + propDefinition: [ + salesforce, + "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: [ + salesforce, + "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({ + const response = await this.salesforce.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/actions/search-string/search-string.mjs b/components/salesforce_rest_api/actions/search-string/search-string.mjs index b490099f33c32..a04a990e92c42 100644 --- a/components/salesforce_rest_api/actions/search-string/search-string.mjs +++ b/components/salesforce_rest_api/actions/search-string/search-string.mjs @@ -1,19 +1,25 @@ -import salesForceRestApi from "../../salesforce_rest_api.app.mjs"; +import salesforce from "../../salesforce_rest_api.app.mjs"; 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.0.1", + "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.0.2", type: "action", props: { - salesForceRestApi, + salesforce, + 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, + salesforce, "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,21 +39,17 @@ export default { searchTerm, fields, } = this; - try { - const response = await this.salesForceRestApi.parameterizedSearch({ + + const response = await this.salesforce.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 resultsFound = response.searchRecords.length; + $.export("$summary", `Sucessfully found ${resultsFound} results`); + return response; }, }; 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..5d9297b9e6c70 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,26 @@ -import { toSingleLineString } from "../../common/utils.mjs"; 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"; 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.2.8", + name: "SOQL Query (Object Query)", + description: `Executes a [Salesforce Object Query Language (SOQL)](${docsLink}) query-based, SQL-like search.`, + version: "0.2.9", type: "action", props: { salesforce, + docsInfo, + 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 0e9f03c864e03..5ae3f484c16f0 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,31 @@ 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 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", - 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.2.7", + name: "SOSL Search (Object Search)", + description: `Executes a [Salesforce Object Search Language (SOSL)](${docsLink}) text-based search query.`, + version: "0.2.8", type: "action", props: { salesforce, + docsInfo, + exampleInfo: { + type: "alert", + alertType: "info", + content: "Example search: `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 +33,7 @@ export default { $, search: this.search, }); - $.export("$summary", "Successfully returned ${response.length} results for SOSL search"); + $.export("$summary", `Successfully returned ${response.searchRecords?.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 a28f044beb96d..0c3debcf634c8 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,75 @@ -import common from "../common/base.mjs"; +import common, { getProps } from "../common/base-create-update.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"; -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.2.7", + description: `Updates a Salesforce account. [See the documentation](${docsLink})`, + version: "0.3.0", type: "action", - props: { - salesforce, - AccountId: { - type: "string", - label: "Account ID", - description: "ID of the Account to modify.", + methods: { + ...common.methods, + getObjectType() { + return "Account"; }, - 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, + getAdvancedProps() { + return account.extraProps; }, - selector: { + }, + props: { + salesforce, + accountId: { propDefinition: [ salesforce, - "fieldSelector", + "recordId", + () => ({ + objType: "Account", + nameField: "Name", + }), ], - description: `${salesforce.propDefinitions.fieldSelector.description} Account`, - options: () => Object.keys(account), - reloadProps: true, + label: "Account ID", + description: "The Account to update.", }, - }, - 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, + getAdvancedProps, + getObjectType, + getAdditionalFields, + formatDateTimeProps, + accountId, + useAdvancedProps, + docsInfo, + dateInfo, + additionalFields, + ...data + } = this; + /* eslint-enable no-unused-vars */ + const response = await salesforce.updateRecord("Account", { $, - id: this.AccountId, - data, + id: accountId, + data: { + ...data, + ...getAdditionalFields(), + }, }); - $.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 5a51d07995fa0..e1a92d9d10c4d 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,80 @@ -import common from "../common/base.mjs"; +import common, { getProps } from "../common/base-create-update.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"; -const { salesforce } = common.props; +const { + salesforce, ...props +} = getProps({ + createOrUpdate: "update", + objType: contact, + docsLink, + showDateInfo: true, +}); 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.2.7", + description: `Updates a contact. [See the documentation](${docsLink})`, + version: "0.3.0", type: "action", - props: { - salesforce, - ContactId: { - type: "string", - label: "Contact ID", - description: "ID of the Contact to update.", + methods: { + ...common.methods, + getObjectType() { + return "Contact"; }, - LastName: { - type: "string", - label: "Last Name", - description: "Last name of the contact up to 80 characters.", - optional: true, + getAdvancedProps() { + return contact.extraProps; }, - selector: { + }, + props: { + salesforce, + contactId: { propDefinition: [ salesforce, - "fieldSelector", + "recordId", + () => ({ + objType: "Contact", + nameField: "Name", + }), ], - description: `${salesforce.propDefinitions.fieldSelector.description} Contact`, - options: () => Object.keys(contact), - reloadProps: true, + label: "Contact ID", + description: "The Contact to update.", }, - }, - 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, + getAdvancedProps, + getObjectType, + getAdditionalFields, + formatDateTimeProps, + contactId, + useAdvancedProps, + docsInfo, + dateInfo, + additionalFields, + Birthdate, + ...data + } = this; + /* eslint-enable no-unused-vars */ + const response = await salesforce.updateRecord("Contact", { $, - id: this.ContactId, - data, + id: contactId, + data: { + ...data, + ...formatDateTimeProps({ + Birthdate, + }), + ...getAdditionalFields(), + }, }); - $.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 684d3932ee586..c2792aa5038d3 100644 --- a/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs +++ b/components/salesforce_rest_api/actions/update-opportunity/update-opportunity.mjs @@ -1,75 +1,77 @@ -import common from "../common/base.mjs"; +import common, { getProps } from "../common/base-create-update.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"; -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.2.7", + description: `Updates an opportunity. [See the documentation](${docsLink})`, + version: "0.3.0", type: "action", - 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, + methods: { + ...common.methods, + getObjectType() { + return "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, + getAdvancedProps() { + return opportunity.extraProps; }, - selector: { + }, + props: { + salesforce, + opportunityId: { propDefinition: [ salesforce, - "fieldSelector", + "recordId", + () => ({ + objType: "Opportunity", + nameField: "Name", + }), ], - description: `${salesforce.propDefinitions.fieldSelector.description} Opportunity`, - options: () => Object.keys(opportunity), - reloadProps: true, + label: "Opportunity ID", + description: "The Opportunity to update.", }, - }, - 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, + getAdvancedProps, + getObjectType, + getAdditionalFields, + formatDateTimeProps, + opportunityId, + useAdvancedProps, + docsInfo, + dateInfo, + additionalFields, + CloseDate, + ...data + } = this; + /* eslint-enable no-unused-vars */ + const response = await salesforce.updateRecord("Opportunity", { $, - id: this.OpportunityId, - data, + id: opportunityId, + data: { + ...data, + ...formatDateTimeProps({ + CloseDate, + }), + ...getAdditionalFields(), + }, }); - $.export("$summary", `Successfully updated opportunity ${this.OpportunityId}`); + $.export("$summary", `Successfully updated opportunity (ID: ${opportunityId})`); return response; }, }; 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..3beeda564b6ac 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,93 @@ +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.2.7", + 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.0", 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, + }), + ], + reloadProps: true, }, }, + methods: { + getAdditionalFields, + convertFieldsToProps, + }, + async additionalProps() { + const { + sobjectType, fieldsToUpdate, + } = this; + const fields = await this.salesforce.getFieldsForObjectType(sobjectType); + + 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_${sobjectType.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/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/common/constants-props.mjs b/components/salesforce_rest_api/common/constants-props.mjs new file mode 100644 index 0000000000000..db777f8190e68 --- /dev/null +++ b/components/salesforce_rest_api/common/constants-props.mjs @@ -0,0 +1,1539 @@ +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 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", + }, +]; + +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", +]; + +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 new file mode 100644 index 0000000000000..3438a96a6d508 --- /dev/null +++ b/components/salesforce_rest_api/common/props-async-options.mjs @@ -0,0 +1,154 @@ +// 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. + +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: findSobjectOptions("Account"), + }, + BusinessHoursId: { + type: "string", + label: "Business Hours ID", + description: "The ID of a Business Hours record.", + options: findSobjectOptions("BusinessHours"), + }, + CallCenterId: { + type: "string", + label: "Call Center ID", + description: "The ID of a Call Center.", + options: findSobjectOptions("CallCenter"), + }, + CampaignId: { + type: "string", + label: "Campaign ID", + description: "The ID of a Campaign.", + options: findSobjectOptions("Campaign"), + }, + CaseId: { + type: "string", + label: "Case ID", + description: "The ID of a Case.", + options: findSobjectOptions("Case"), + }, + CommunityId: { + type: "string", + label: "Community ID", + description: "The ID of a Community (Zone) record.", + options: () => + this.salesforce.listRecordOptions({ + objType: "Community", + nameField: "Name", + }), + }, + ContactId: { + type: "string", + label: "Contact ID", + description: "The ID of a Contact.", + options: findSobjectOptions("Contact"), + }, + ContractId: { + type: "string", + label: "Contract ID", + description: "The ID of a Contract.", + options: findSobjectOptions("Contract"), + }, + ContactOrLeadIds: { + type: "string[]", + label: "Contact or Lead IDs", + description: "The IDs of Contacts or Leads.", + options: async () => { + const contacts = await this.salesforce.listRecordOptions({ + objType: "Contact", + nameField: "Name", + }); + const leads = await this.salesforce.listRecordOptions({ + objType: "Lead", + nameField: "Name", + }); + return [ + ...(contacts ?? []), + ...(leads ?? []), + ]; + }, + }, + IndividualId: { + type: "string", + label: "Individual ID", + description: "The ID of an Individual.", + options: findSobjectOptions("Individual"), + }, + LeadId: { + type: "string", + label: "Lead ID", + description: "The ID of a Lead.", + options: findSobjectOptions("Lead"), + }, + OperatingHoursId: { + type: "string", + label: "Operating Hours ID", + description: "The ID of an Operating Hours record.", + options: findSobjectOptions("OperatingHours"), + }, + OpportunityId: { + type: "string", + label: "Opportunity ID", + description: "The ID of an Opportunity.", + options: findSobjectOptions("Opportunity"), + }, + Pricebook2Id: { + type: "string", + label: "Pricebook2 ID", + description: "The ID of a Pricebook2 record.", + options: findSobjectOptions("Pricebook2"), + }, + ProfileId: { + type: "string", + label: "Profile ID", + description: "The ID of a Profile.", + options: findSobjectOptions("Profile"), + }, + ServiceContractId: { + type: "string", + label: "ServiceContract ID", + description: "The ID of a Service Contract record.", + options: findSobjectOptions("ServiceContract"), + }, + UserId: { + type: "string", + label: "User ID", + description: "The ID of a User in your organization.", + options: findSobjectOptions("User"), + }, + UserRoleId: { + type: "string", + label: "User Role ID", + description: "The ID of a User Role record.", + options: findSobjectOptions("UserRole"), + }, + QuestionId: { + type: "string", + label: "Question ID", + description: "The ID of a Question.", + 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: findSobjectOptions("RecordType"), + }, +}; diff --git a/components/salesforce_rest_api/common/props-utils.mjs b/components/salesforce_rest_api/common/props-utils.mjs index 49c6f718d3c66..731bfcc477344 100644 --- a/components/salesforce_rest_api/common/props-utils.mjs +++ b/components/salesforce_rest_api/common/props-utils.mjs @@ -1,38 +1,95 @@ -function toCapitalCase(str) { - return str - .split(" ") - .map((word) => word.charAt(0).toUpperCase() + word.slice(1)) - .join(""); -} +import allSobjects from "./all-sobjects.mjs"; -function filterProps(props) { - if (!props) { - return; - } +export function getAdditionalFields() { 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, [ + Object.entries(this.additionalFields ?? {}).map(([ key, value, - ]) => ({ - ...acc, - [toCapitalCase(key)]: value, - }), {}); + ]) => { + try { + return [ + key, + JSON.parse(value), + ]; + } catch (err) { + return [ + key, + value, + ]; + } + }), + ); } -export default { - keysToCapitalCase, +export const convertFieldsToProps = (fields) => { + const 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"; + } + }; + + 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 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; + }, {}); }; diff --git a/components/salesforce_rest_api/common/sobjects/account.mjs b/components/salesforce_rest_api/common/sobjects/account.mjs index 1db5c40635645..efa5d8d1c3c8d 100644 --- a/components/salesforce_rest_api/common/sobjects/account.mjs +++ b/components/salesforce_rest_api/common/sobjects/account.mjs @@ -1,27 +1,354 @@ +import { + CLEAN_STATUS_OPTIONS, GEOCODE_ACCURACY_OPTIONS, RECORD_SOURCE_OPTIONS, +} from "../constants-props.mjs"; +import commonProps from "../props-async-options.mjs"; + 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: "string", + 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.", + initialProps: { + 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, + }, + Description: { + type: "string", + label: "Description", + description: "Text description of the account. Limited to 32,000 KB.", + optional: true, + }, + Phone: { + type: "string", + label: "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, + }, }, - 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.", + 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", + description: + "The source of the account record. Available values are set by an administrator.", + optional: true, + options: RECORD_SOURCE_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, + }, + BillingGeocodeAccuracy: { + type: "string", + label: "Billing Geocode Accuracy", + description: "Accuracy level of the geocode for the billing address.", + optional: true, + options: GEOCODE_ACCURACY_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, + }, + 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: CLEAN_STATUS_OPTIONS, + }, + 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, + }, + 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", + description: + "An industry associated with this account. Max 40 characters.", + 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: "string", + 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, + }, + Ownership: { + type: "string", + label: "Ownership", + description: "Ownership type for the account.", + optional: true, + options: [ + "Public", + "Private", + "Subsidiary", + "Other", + ], + }, + 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", + description: "The account's prospect rating.", + optional: true, + options: [ + "Hot", + "Warm", + "Cold", + ], + }, + ShippingCity: { + type: "string", + label: "Shipping City", + description: "Max 40 characters.", + optional: true, + }, + ShippingCountry: { + type: "string", + label: "Shipping Country", + description: "Max 80 characters.", + optional: true, + }, + ShippingGeocodeAccuracy: { + type: "string", + label: "Shipping Geocode Accuracy", + description: "Accuracy level of the geocode for the shipping 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", + }, + ], + }, + 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, + }, + 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, + options: [ + "Prospect", + "Customer - Direct", + "Customer - Channel", + "Channel Partner / Reseller", + "Installation Partner", + "Technology Partner", + "Other", + ], + }, + YearStarted: { + type: "string", + label: "Year Started", + description: + "The year when an org was legally established. Max 4 characters", + optional: true, + }, }, }; diff --git a/components/salesforce_rest_api/common/sobjects/attachment.mjs b/components/salesforce_rest_api/common/sobjects/attachment.mjs index 1253504928220..fc01ea14726d8 100644 --- a/components/salesforce_rest_api/common/sobjects/attachment.mjs +++ b/components/salesforce_rest_api/common/sobjects/attachment.mjs @@ -1,22 +1,61 @@ +import salesforce from "../../salesforce_rest_api.app.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`.", + }, + 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.", + }, }, - 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.", + updateProps: { + 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: "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.", + initialProps: { + Description: { + type: "string", + label: "Description", + description: "Description of the attachment. Max 500 characters.", + 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: { + propDefinition: [ + salesforce, + "recordId", + () => ({ + objType: "User", + nameField: "Name", + }), + ], + label: "Owner ID", + description: "ID of the user who owns the attachment.", + optional: true, + }, }, }; diff --git a/components/salesforce_rest_api/common/sobjects/campaign.mjs b/components/salesforce_rest_api/common/sobjects/campaign.mjs index 229ae6dc7d6d0..e8c19631317e5 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-async-options.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: { + 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", + 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, + }, }, }; diff --git a/components/salesforce_rest_api/common/sobjects/case.mjs b/components/salesforce_rest_api/common/sobjects/case.mjs index 6a40093d57e38..17544e4b6810f 100644 --- a/components/salesforce_rest_api/common/sobjects/case.mjs +++ b/components/salesforce_rest_api/common/sobjects/case.mjs @@ -1,17 +1,197 @@ +import commonProps from "../props-async-options.mjs"; +import salesforce from "../../salesforce_rest_api.app.mjs"; + export default { - AccountId: { - type: "string", - label: "Account ID", - description: "ID of the account associated with this case.", + 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", + ], + }, + SuppliedEmail: { + type: "string", + 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, + }, }, - 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, + }, + 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, + }, + OwnerId: { + ...commonProps.UserId, + description: "ID of the user 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", + 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", + ], + }, + Priority: { + type: "string", + label: "Priority", + description: "The importance or urgency of the case.", + optional: true, + options: [ + "High", + "Medium", + "Low", + ], + }, + 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", + ], + }, + 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, + }, + Subject: { + type: "string", + label: "Subject", + description: "The subject of the case. Max 255 characters.", + optional: true, + }, + SuppliedCompany: { + type: "string", + label: "Company", + description: "The company 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", + ], + }, }, }; diff --git a/components/salesforce_rest_api/common/sobjects/caseComment.mjs b/components/salesforce_rest_api/common/sobjects/caseComment.mjs index faf33431e887a..62edc5474c65b 100644 --- a/components/salesforce_rest_api/common/sobjects/caseComment.mjs +++ b/components/salesforce_rest_api/common/sobjects/caseComment.mjs @@ -1,7 +1,31 @@ +import salesforce from "../../salesforce_rest_api.app.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: { + propDefinition: [ + salesforce, + "recordId", + () => ({ + objType: "Case", + nameField: "CaseNumber", + }), + ], + label: "Parent Case ID", + description: "ID of the parent Case.", + }, + IsPublished: { + type: "boolean", + label: "Is Published", + description: + "Indicates whether the CaseComment is visible to customers in the Self-Service portal.", + optional: true, + }, }, }; diff --git a/components/salesforce_rest_api/common/sobjects/contact.mjs b/components/salesforce_rest_api/common/sobjects/contact.mjs index 31eee067ba28f..7b2254399a895 100644 --- a/components/salesforce_rest_api/common/sobjects/contact.mjs +++ b/components/salesforce_rest_api/common/sobjects/contact.mjs @@ -1,47 +1,211 @@ +import { + CLEAN_STATUS_OPTIONS, GEOCODE_ACCURACY_OPTIONS, RECORD_SOURCE_OPTIONS, +} from "../constants-props.mjs"; +import commonProps from "../props-async-options.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, + }, + 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", + 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: CLEAN_STATUS_OPTIONS, + }, + Department: { + type: "string", + label: "Department", + description: "The contact's department.", + 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, + }, + LeadSource: { + type: "string", + label: "Lead Source", + description: "The source of the lead that was converted to this contact.", + optional: true, + options: RECORD_SOURCE_OPTIONS, + }, + 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: GEOCODE_ACCURACY_OPTIONS, + }, + 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, + }, + 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, + }, }, }; diff --git a/components/salesforce_rest_api/common/sobjects/event.mjs b/components/salesforce_rest_api/common/sobjects/event.mjs index 80405e519cb8f..5ec46534a039b 100644 --- a/components/salesforce_rest_api/common/sobjects/event.mjs +++ b/components/salesforce_rest_api/common/sobjects/event.mjs @@ -1,22 +1,222 @@ +import { // eslint-disable-next-line max-len + 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"; + 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, + async options() { + const contacts = await this.salesforce.listRecordOptions({ + objType: "Contact", + nameField: "Name", + }); + const leads = await this.salesforce.listRecordOptions({ + objType: "Lead", + nameField: "Name", + }); + return [ + ...(contacts ?? []), + ...(leads ?? []), + ]; + }, + }, + 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, + }, + 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", + 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, + }, + 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: WEEKDAY_MASK_OPTIONS, + }, + 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: RECURRENCE_INSTANCE_OPTIONS, + }, + 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: RECURRENCE_MONTH_OPTIONS, + }, + 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: TIMEZONE_OPTIONS, + }, + RecurrenceType: { + type: "string", + label: "Recurrence Type", + description: "Indicates how often the Salesforce Classic event 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, + }, + 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", + ], + }, }, }; diff --git a/components/salesforce_rest_api/common/sobjects/lead.mjs b/components/salesforce_rest_api/common/sobjects/lead.mjs index 10c4a6aa4ebab..cef42c876a6f2 100644 --- a/components/salesforce_rest_api/common/sobjects/lead.mjs +++ b/components/salesforce_rest_api/common/sobjects/lead.mjs @@ -1,27 +1,250 @@ +import { + CLEAN_STATUS_OPTIONS, GEOCODE_ACCURACY_OPTIONS, RECORD_SOURCE_OPTIONS, +} from "../constants-props.mjs"; +import commonProps from "../props-async-options.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.", + 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: { + 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", + 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: CLEAN_STATUS_OPTIONS, + }, + 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, + }, + 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, + }, + 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: GEOCODE_ACCURACY_OPTIONS, + }, + 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 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, + }, + LeadSource: { + type: "string", + label: "Lead Source", + description: "The lead's source.", + optional: true, + options: RECORD_SOURCE_OPTIONS, + }, + 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, + }, + 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", + ], + }, + 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, + }, }, }; diff --git a/components/salesforce_rest_api/common/sobjects/note.mjs b/components/salesforce_rest_api/common/sobjects/note.mjs index 3a19c81aec589..1016a567f7e21 100644 --- a/components/salesforce_rest_api/common/sobjects/note.mjs +++ b/components/salesforce_rest_api/common/sobjects/note.mjs @@ -1,17 +1,40 @@ +import salesforce from "../../salesforce_rest_api.app.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: { + propDefinition: [ + salesforce, + "recordId", + () => ({ + objType: "User", + nameField: "Name", + }), + ], + 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.", + }, + Title: { + type: "string", + label: "Title", + description: "Title of the note.", + }, }, }; diff --git a/components/salesforce_rest_api/common/sobjects/opportunity.mjs b/components/salesforce_rest_api/common/sobjects/opportunity.mjs index bdf96c354cfd7..6f281f2d02f27 100644 --- a/components/salesforce_rest_api/common/sobjects/opportunity.mjs +++ b/components/salesforce_rest_api/common/sobjects/opportunity.mjs @@ -1,27 +1,153 @@ +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 { - AccountId: { - type: "string", - label: "Account ID", - description: "ID of the account associated with this opportunity.", + createProps: { + 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, + }, }, - 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.", + 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, + }, + 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", + description: + "Estimated total sale amount. For opportunities with products, the amount is the sum of the related products.", + 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.", + optional: true, + options: RECORD_SOURCE_OPTIONS, + }, + NextStep: { + type: "string", + label: "Next Step", + description: + "Description of next task in closing opportunity. Limit: 255 characters.", + optional: true, + }, + Probability: { + type: "string", + label: "Probability (%)", + description: + "Percentage of estimated confidence in closing the opportunity.", + 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", + ], + }, }, }; diff --git a/components/salesforce_rest_api/common/sobjects/task.mjs b/components/salesforce_rest_api/common/sobjects/task.mjs index 931692972e552..1e842b4255b20 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, + 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: { + 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", + 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, + }, + 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: "Repeat This Task", + 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: 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", + ], + }, }, }; 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..e77a6f9e2f1df --- /dev/null +++ b/components/salesforce_rest_api/common/sobjects/user.mjs @@ -0,0 +1,965 @@ +import salesforce from "../../salesforce_rest_api.app.mjs"; +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 (max 8 characters).", + }, + CommunityNickname: { + type: "string", + label: "Nickname", + description: + "Name used to identify this user in the Experience Cloud site.", + }, + DigestFrequency: { + type: "string", + label: "Chatter Email Highlights Frequency", + 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.", + }, + EmailEncodingKey: { + type: "string", + label: "Email Encoding", + description: "The email encoding for the user.", + options: EMAIL_ENCODING_OPTIONS, + }, + 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: { + 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.", + }, + 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", + 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: { + 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, + }, + 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.UserRoleId, + 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", + 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, + }, + Country: { + type: "string", + label: "Country", + description: + "The country associated with the user. Up to 80 characters allowed.", + 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", + }, + ], + }, + 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, + }, + 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", + 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: "Geocode Accuracy", + description: + "The level of accuracy of a location's geographical coordinates compared with its physical address.", + optional: true, + options: GEOCODE_ACCURACY_OPTIONS, + }, + 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, + }, + 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, + }, + Title: { + type: "string", + label: "Title", + description: "The user's business title, such as Vice President.", + 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, + }, + }, +}; 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/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", diff --git a/components/salesforce_rest_api/salesforce_rest_api.app.mjs b/components/salesforce_rest_api/salesforce_rest_api.app.mjs index 432218f1b751d..cdf27c39ea0fc 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: "SObject ID", - 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", @@ -38,6 +25,21 @@ 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, + nameField, + }) { + if (!nameField) nameField = await this.getNameFieldForObjectType(objType); + return this.listRecordOptions({ + objType, + nameField, + }); + }, + }, field: { type: "string", label: "Field", @@ -53,37 +55,30 @@ 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, - }, - 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 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); + }, }, - AcceptedEventInviteeIds: { + fieldsToObtain: { 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, - })); + 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); }, - 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", + description: "Set to true to see all available props for this object.", + optional: true, + reloadProps: true, }, }, methods: { @@ -138,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`; @@ -223,35 +214,32 @@ 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, 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) { - const url = `${this._sObjectsApiUrl()}/${objectType}/${sobjectId}`; + async deleteRecord({ + sobjectType, recordId, ...args + }) { + const url = `${this._sObjectsApiUrl()}/${sobjectType}/${recordId}`; 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) { @@ -261,17 +249,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 = { @@ -293,159 +270,6 @@ export default { }, }); }, - async createAccount({ - $, data, - }) { - const url = this._sObjectTypeApiUrl("Account"); - return this._makeRequest({ - $, - url, - method: "POST", - data, - }); - }, - async updateAccount({ - $, id, data, - }) { - const url = this._sObjectDetailsApiUrl("Account", id); - return this._makeRequest({ - $, - url, - method: "PATCH", - 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, - }) { - const url = this._sObjectDetailsApiUrl("Contact", id); - return this._makeRequest({ - $, - url, - method: "PATCH", - 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, - }) { - const url = this._sObjectDetailsApiUrl("Opportunity", id); - return this._makeRequest({ - $, - url, - method: "PATCH", - data, - }); - }, - async getRecordFieldValues(sobjectName, { - $, id, params, - }) { - const url = this._sObjectDetailsApiUrl(sobjectName, id); - return this._makeRequest({ - $, - url, - params, - }); - }, async createRecord(sobjectName, { $, data, }) { @@ -468,27 +292,6 @@ export default { data, }); }, - async createTask({ - $, data, - }) { - const url = this._sObjectTypeApiUrl("Task"); - return this._makeRequest({ - $, - url, - method: "POST", - data, - }); - }, - async deleteOpportunity({ - $, id, - }) { - const url = this._sObjectDetailsApiUrl("Opportunity", id); - return this._makeRequest({ - $, - url, - method: "DELETE", - }); - }, async query({ $, query, }) { @@ -499,6 +302,26 @@ export default { url, }); }, + async listRecordOptions({ + objType, + nameField = "Id", + }) { + const fields = [ + "Id", + ...nameField === "Id" + ? [] + : [ + nameField, + ], + ]; + const { records } = await this.query({ + query: `SELECT ${fields.join(", ")} FROM ${objType}`, + }); + return records?.map?.((item) => ({ + label: item[nameField], + value: item.Id, + })) ?? []; + }, async search({ $, search, }) { @@ -509,14 +332,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, { @@ -534,7 +357,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({ 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..7e65d8842e129 --- /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; + }, + processWebhookEvent(event) { + const { body } = event; + const meta = this.generateWebhookMeta(event); + this.$emit(body, meta); + }, + generateWebhookMeta() { + throw new Error("generateWebhookMeta 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..38dbf81babe83 100644 --- a/components/salesforce_rest_api/sources/common.mjs +++ b/components/salesforce_rest_api/sources/common.mjs @@ -1,21 +1,26 @@ 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, db: "$.service.db", - // eslint-disable-next-line pipedream/props-label,pipedream/props-description + http: { + type: "$.interface.http", + customResponse: true, + }, timer: { type: "$.interface.timer", + description: "The timer is only used as a fallback if instant event delivery (webhook) is not available.", default: { intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL, }, }, objectType: { - type: "string", label: "Object Type", description: "The type of object for which to monitor events", propDefinition: [ @@ -26,17 +31,51 @@ export default { }, hooks: { async activate() { - const latestDateCovered = this.getLatestDateCovered(); - if (!latestDateCovered) { - const now = new Date().toISOString(); - this.setLatestDateCovered(now); + // 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 + }); + console.log("Webhook created successfully"); + } catch (err) { + console.log("Error creating webhook:", err); + console.log("The source will operate on the polling schedule instead."); + + const latestDateCovered = this.getLatestDateCovered(); + if (!latestDateCovered) { + const now = new Date().toISOString(); + this.setLatestDateCovered(now); + } + + 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 + const webhookData = this._getWebhookData(); + if (webhookData) { + await this.deleteWebhook(webhookData); + } + }, }, methods: { + ...commonWebhookMethods, + timerActivateHook() { + return null; + }, getObjectTypeColumns() { return this.db.get("columns") ?? []; }, @@ -55,8 +94,8 @@ 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"); }, getObjectTypeDescription(objectType) { const { salesforce } = this; @@ -120,21 +159,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 (already executed less than 60 seconds ago) + `); + return; + } + + await this.processTimerEvent({ + 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.processWebhookEvent(event); + } }, }; 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..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 @@ -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, + infoBox: { + 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) { 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..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 @@ -1,13 +1,13 @@ 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. [See the documentation](https://sforce.co/3yPSJZy)", + version: "0.1.0", hooks: { ...common.hooks, async deploy() { @@ -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)) { @@ -26,13 +26,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 +68,60 @@ export default { getEventType() { return "new"; }, + async processTimerEvent(eventData) { + const { + paginate, + objectType, + setLatestDateCovered, + getObjectTypeColumns, + getNameField, + generateTimerMeta, + $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 = generateTimerMeta(item, fieldName); + emit(item, meta); + }); + }, + async timerActivateHook() { + const { + objectType, + getObjectTypeDescription, + setObjectTypeColumns, + } = 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); - }); - }, - }, -}; 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..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 @@ -1,17 +1,16 @@ import startCase from "lodash/startCase.js"; - -import common from "../common-instant.mjs"; +import common from "../common.mjs"; export default { ...common, 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", - 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.1.0", 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.generateTimerMeta(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); - }); - }, - }, -}; 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..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 @@ -1,17 +1,35 @@ import startCase from "lodash/startCase.js"; - -import common from "../common-instant.mjs"; +import common from "../common.mjs"; +import constants from "../../common/constants.mjs"; +const { salesforce } = common.props; 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.2.0", + 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. This filter is only available when a webhook is created successfully.", + }, + }, methods: { ...common.methods, - generateMeta(data) { + generateWebhookMeta(data) { const nameField = this.getNameField(); const { New: newObject } = data.body; const { @@ -29,8 +47,122 @@ 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"; }, + 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, + getObjectTypeColumns, + paginate, + objectType, + setLatestDateCovered, + generateTimerMeta, + $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 = generateTimerMeta(item, fieldName); + emit(item, meta); + }); + }, + async timerActivateHook() { + const { + objectType, + getObjectTypeDescription, + setObjectTypeColumns, + } = 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); - }); - }, - }, -}; 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 d6bd6eeb7db5b..0000000000000 --- a/components/salesforce_rest_api/sources/updated-field-on-record-instant/updated-field-on-record-instant.mjs +++ /dev/null @@ -1,76 +0,0 @@ -import startCase from "lodash/startCase.js"; - -import common from "../common-instant.mjs"; -const { salesforce } = common.props; - -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", - props: { - ...common.props, - field: { - propDefinition: [ - salesforce, - "field", - ({ objectType }) => ({ - objectType, - }), - ], - }, - 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; - }, - generateMeta(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, - }; - }, - processEvent(event) { - const { body } = event; - if (!this.isEventRelevant(event)) { - return; - } - const meta = this.generateMeta(event); - this.$emit(body, meta); - }, - getEventType() { - return "updated"; - }, - getFieldsToCheck() { - return [ - this.field, - ]; - }, - }, -}; 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); - }); - }, - }, -}; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 43d3d3ece09a3..871fda34516cf 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -7918,7 +7918,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 @@ -7926,7 +7926,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