@pipedream/salesforce_rest_api 1.13.0 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/actions/add-contact-to-campaign/add-contact-to-campaign.mjs +7 -2
  2. package/actions/add-lead-to-campaign/add-lead-to-campaign.mjs +7 -2
  3. package/actions/convert-soap-xml-to-json/convert-soap-xml-to-json.mjs +7 -2
  4. package/actions/create-account/create-account.mjs +7 -2
  5. package/actions/create-accounts-batch/create-accounts-batch.mjs +8 -2
  6. package/actions/create-attachment/create-attachment.mjs +7 -2
  7. package/actions/create-campaign/create-campaign.mjs +7 -2
  8. package/actions/create-case/create-case.mjs +7 -2
  9. package/actions/create-casecomment/create-casecomment.mjs +7 -2
  10. package/actions/create-contact/create-contact.mjs +7 -2
  11. package/actions/create-content-note/create-content-note.mjs +9 -2
  12. package/actions/create-crm-record/create-crm-record.mjs +5 -3
  13. package/actions/create-event/create-event.mjs +7 -2
  14. package/actions/create-lead/create-lead.mjs +7 -2
  15. package/actions/create-note/create-note.mjs +7 -2
  16. package/actions/create-opportunities-batch/create-opportunities-batch.mjs +9 -2
  17. package/actions/create-opportunity/create-opportunity.mjs +7 -2
  18. package/actions/create-record/create-record.mjs +7 -2
  19. package/actions/create-task/create-task.mjs +7 -2
  20. package/actions/create-user/create-user.mjs +7 -2
  21. package/actions/delete-crm-record/delete-crm-record.mjs +6 -4
  22. package/actions/delete-note/delete-note.mjs +7 -2
  23. package/actions/delete-opportunity/delete-opportunity.mjs +7 -2
  24. package/actions/delete-record/delete-record.mjs +7 -2
  25. package/actions/describe-object/describe-object.mjs +5 -3
  26. package/actions/find-records/find-records.mjs +49 -12
  27. package/actions/get-case/get-case.mjs +7 -2
  28. package/actions/get-current-user/get-current-user.mjs +2 -1
  29. package/actions/get-knowledge-articles/get-knowledge-articles.mjs +7 -2
  30. package/actions/get-knowledge-data-category-groups/get-knowledge-data-category-groups.mjs +7 -2
  31. package/actions/get-record-by-id/get-record-by-id.mjs +7 -2
  32. package/actions/get-related-records/get-related-records.mjs +5 -3
  33. package/actions/get-user/get-user.mjs +7 -2
  34. package/actions/get-user-info/get-user-info.mjs +5 -3
  35. package/actions/insert-blob-data/insert-blob-data.mjs +7 -2
  36. package/actions/list-case-comments/list-case-comments.mjs +51 -7
  37. package/actions/list-case-feed-items/list-case-feed-items.mjs +73 -0
  38. package/actions/list-cases/list-cases.mjs +131 -0
  39. package/actions/list-email-messages/list-email-messages.mjs +57 -10
  40. package/actions/list-email-templates/list-email-templates.mjs +45 -6
  41. package/actions/list-knowledge-articles/list-knowledge-articles.mjs +45 -6
  42. package/actions/list-object-fields/list-object-fields.mjs +7 -2
  43. package/actions/list-objects/list-objects.mjs +5 -3
  44. package/actions/post-feed-to-chatter/post-feed-to-chatter.mjs +7 -2
  45. package/actions/search-string/search-string.mjs +7 -2
  46. package/actions/send-email/send-email.mjs +7 -2
  47. package/actions/soql-query/soql-query.mjs +5 -3
  48. package/actions/soql-search/soql-search.mjs +7 -2
  49. package/actions/sosl-search/sosl-search.mjs +7 -2
  50. package/actions/text-search/text-search.mjs +5 -3
  51. package/actions/update-account/update-account.mjs +7 -2
  52. package/actions/update-accounts-batch/update-accounts-batch.mjs +9 -2
  53. package/actions/update-contact/update-contact.mjs +7 -2
  54. package/actions/update-content-note/update-content-note.mjs +9 -2
  55. package/actions/update-crm-record/update-crm-record.mjs +5 -3
  56. package/actions/update-email-template/update-email-template.mjs +7 -2
  57. package/actions/update-note/update-note.mjs +7 -2
  58. package/actions/update-opportunities-batch/update-opportunities-batch.mjs +9 -2
  59. package/actions/update-opportunity/update-opportunity.mjs +7 -2
  60. package/actions/update-record/update-record.mjs +7 -2
  61. package/actions/upsert-record/upsert-record.mjs +7 -2
  62. package/common/constants.mjs +52 -0
  63. package/common/soql.mjs +96 -0
  64. package/package.json +1 -1
  65. package/sources/case-updated-instant/case-updated-instant.mjs +1 -1
  66. package/sources/email-template-updated-instant/email-template-updated-instant.mjs +1 -1
  67. package/sources/knowledge-article-updated-instant/knowledge-article-updated-instant.mjs +1 -1
  68. package/sources/new-case-instant/new-case-instant.mjs +1 -1
  69. package/sources/new-email-template-instant/new-email-template-instant.mjs +1 -1
  70. package/sources/new-feed-comment/new-feed-comment.mjs +1 -1
  71. package/sources/new-feed-item/new-feed-item.mjs +1 -1
  72. package/sources/new-knowledge-article-instant/new-knowledge-article-instant.mjs +1 -1
  73. package/sources/new-record-instant/new-record-instant.mjs +1 -1
  74. package/sources/record-deleted-instant/record-deleted-instant.mjs +1 -1
  75. package/sources/record-updated-instant/record-updated-instant.mjs +1 -1
@@ -1,11 +1,16 @@
1
+ // x-pd-ai: optimized
1
2
  import salesforce from "../../salesforce_rest_api.app.mjs";
2
3
  import constants from "../../common/constants.mjs";
3
4
 
4
5
  export default {
5
6
  key: "salesforce_rest_api-add-contact-to-campaign",
6
7
  name: "Add Contact to Campaign",
7
- 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)",
8
- version: "0.1.5",
8
+ description: "Add an existing contact to an existing campaign as a campaign member."
9
+ + " Use **Find Records** on `Contact` and on `Campaign` to look up the two IDs first."
10
+ + " The contact must already exist - use **Create Contact** if it does not."
11
+ + " "
12
+ + "[See the documentation](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_campaignmember.htm)",
13
+ version: "0.1.6",
9
14
  annotations: {
10
15
  destructiveHint: false,
11
16
  openWorldHint: true,
@@ -1,11 +1,16 @@
1
+ // x-pd-ai: optimized
1
2
  import salesforce from "../../salesforce_rest_api.app.mjs";
2
3
  import constants from "../../common/constants.mjs";
3
4
 
4
5
  export default {
5
6
  key: "salesforce_rest_api-add-lead-to-campaign",
6
7
  name: "Add Lead to Campaign",
7
- 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)",
8
- version: "0.1.5",
8
+ description: "Add an existing lead to an existing campaign as a campaign member."
9
+ + " Use **Find Records** on `Lead` and on `Campaign` to look up the two IDs first."
10
+ + " The lead must already exist - use **Create Lead** if it does not."
11
+ + " "
12
+ + "[See the documentation](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_campaignmember.htm)",
13
+ version: "0.1.6",
9
14
  annotations: {
10
15
  destructiveHint: false,
11
16
  openWorldHint: true,
@@ -1,11 +1,16 @@
1
+ // x-pd-ai: optimized
1
2
  import salesforce_rest_api from "../../salesforce_rest_api.app.mjs";
2
3
  import converter from "../../../helper_functions/actions/xml-to-json/xml-to-json.mjs";
3
4
 
4
5
  export default {
5
6
  key: "salesforce_rest_api-convert-soap-xml-to-json",
6
7
  name: "Convert SOAP XML Object to JSON",
7
- description: "Converts a SOAP XML Object received from Salesforce to JSON",
8
- version: "0.0.10",
8
+ description: "Convert a SOAP XML payload received from Salesforce into JSON."
9
+ + " Use this on the raw body delivered by an outbound-message trigger; it makes no API call."
10
+ + " Every other Salesforce action already returns JSON, so this is only needed for outbound-message workflows."
11
+ + " "
12
+ + "[See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_om_outboundmessaging.htm)",
13
+ version: "0.0.11",
9
14
  annotations: {
10
15
  destructiveHint: false,
11
16
  openWorldHint: true,
@@ -1,3 +1,4 @@
1
+ // x-pd-ai: optimized
1
2
  import common, { getProps } from "../common/base-create-update.mjs";
2
3
  import account from "../../common/sobjects/account.mjs";
3
4
 
@@ -7,8 +8,12 @@ export default {
7
8
  ...common,
8
9
  key: "salesforce_rest_api-create-account",
9
10
  name: "Create Account",
10
- description: `Creates a Salesforce account. [See the documentation](${docsLink})`,
11
- version: "0.3.6",
11
+ description: "Create a Salesforce account (a company or organization record)."
12
+ + " Use **Describe Object** on `Account` to discover which fields your org requires before calling."
13
+ + " For example, `Name` `Acme Corp` creates a minimal account and returns its new record ID."
14
+ + " "
15
+ + `[See the documentation](${docsLink})`,
16
+ version: "0.3.7",
12
17
  annotations: {
13
18
  destructiveHint: false,
14
19
  openWorldHint: true,
@@ -1,11 +1,17 @@
1
+ // x-pd-ai: optimized
1
2
  import common from "../common/batch-operation.mjs";
2
3
 
3
4
  export default {
4
5
  ...common,
5
6
  key: "salesforce_rest_api-create-accounts-batch",
6
7
  name: "Create Accounts (Batch)",
7
- description: "Create multiple Accounts in Salesforce using Bulk API 2.0. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/datafiles_understanding_bulk2_ingest.htm)",
8
- version: "0.0.5",
8
+ description: "Create many Salesforce accounts in one job using Bulk API 2.0."
9
+ + " Use this instead of **Create Account** when inserting more than roughly 200 records - it is asynchronous and returns a job ID, not the created records."
10
+ + " Poll the job in Salesforce to confirm completion; a successful response means the job was accepted, not that every row loaded."
11
+ + " Input is a CSV file - supply a path under `/tmp` or a URL to download it from, with a header row of Salesforce field API names."
12
+ + " "
13
+ + "[See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/datafiles_understanding_bulk2_ingest.htm)",
14
+ version: "0.0.6",
9
15
  annotations: {
10
16
  destructiveHint: false,
11
17
  openWorldHint: true,
@@ -1,3 +1,4 @@
1
+ // x-pd-ai: optimized
1
2
  import common, { getProps } from "../common/base-create-update.mjs";
2
3
  import attachment from "../../common/sobjects/attachment.mjs";
3
4
  import { getFileStream } from "@pipedream/platform";
@@ -17,8 +18,12 @@ export default {
17
18
  ...common,
18
19
  key: "salesforce_rest_api-create-attachment",
19
20
  name: "Create Attachment",
20
- description: `Creates an Attachment on a parent object. [See the documentation](${docsLink})`,
21
- version: "0.5.8",
21
+ description: "Attach a file to an existing Salesforce record (classic `Attachment` object)."
22
+ + " Use **Find Records** to get the parent record ID first."
23
+ + " For newer orgs prefer Salesforce Files - use **Insert Blob Data** with `ContentVersion` instead."
24
+ + " "
25
+ + `[See the documentation](${docsLink})`,
26
+ version: "0.5.9",
22
27
  annotations: {
23
28
  destructiveHint: false,
24
29
  openWorldHint: true,
@@ -1,3 +1,4 @@
1
+ // x-pd-ai: optimized
1
2
  import common, { getProps } from "../common/base-create-update.mjs";
2
3
  import campaign from "../../common/sobjects/campaign.mjs";
3
4
 
@@ -7,8 +8,12 @@ export default {
7
8
  ...common,
8
9
  key: "salesforce_rest_api-create-campaign",
9
10
  name: "Create Campaign",
10
- description: `Creates a marketing campaign. [See the documentation](${docsLink})`,
11
- version: "0.3.6",
11
+ description: "Create a Salesforce marketing campaign."
12
+ + " Use **Add Contact to Campaign** or **Add Lead to Campaign** afterwards to populate its members."
13
+ + " For example, `Name: \"Summer 2026 Webinar\"` creates the campaign and returns its ID."
14
+ + " "
15
+ + `[See the documentation](${docsLink})`,
16
+ version: "0.3.7",
12
17
  annotations: {
13
18
  destructiveHint: false,
14
19
  openWorldHint: true,
@@ -1,3 +1,4 @@
1
+ // x-pd-ai: optimized
1
2
  import common, { getProps } from "../common/base-create-update.mjs";
2
3
  import caseObj from "../../common/sobjects/case.mjs";
3
4
 
@@ -7,8 +8,12 @@ export default {
7
8
  ...common,
8
9
  key: "salesforce_rest_api-create-case",
9
10
  name: "Create Case",
10
- description: `Creates a Case, which represents a customer issue or problem. [See the documentation](${docsLink})`,
11
- version: "0.3.6",
11
+ description: "Create a Salesforce support case (a customer issue or request)."
12
+ + " Use **List Cases** to check whether a matching case already exists before creating a duplicate."
13
+ + " After creating, use **Create Case Comment** to add notes or **List Case Feed Items** to read its activity."
14
+ + " "
15
+ + `[See the documentation](${docsLink})`,
16
+ version: "0.3.7",
12
17
  annotations: {
13
18
  destructiveHint: false,
14
19
  openWorldHint: true,
@@ -1,3 +1,4 @@
1
+ // x-pd-ai: optimized
1
2
  import common, { getProps } from "../common/base-create-update.mjs";
2
3
  import caseComment from "../../common/sobjects/caseComment.mjs";
3
4
 
@@ -16,8 +17,12 @@ export default {
16
17
  ...common,
17
18
  key: "salesforce_rest_api-create-casecomment",
18
19
  name: "Create Case Comment",
19
- description: `Creates a Case Comment on a selected Case. [See the documentation](${docsLink})`,
20
- version: "0.3.6",
20
+ description: "Add a comment to an existing Salesforce case."
21
+ + " Use **List Cases** to find the case ID, and **List Case Comments** to read the existing thread first."
22
+ + " Comments are visible in the case feed - **List Case Feed Items** shows them as `CaseCommentPost` entries."
23
+ + " "
24
+ + `[See the documentation](${docsLink})`,
25
+ version: "0.3.7",
21
26
  annotations: {
22
27
  destructiveHint: false,
23
28
  openWorldHint: true,
@@ -1,3 +1,4 @@
1
+ // x-pd-ai: optimized
1
2
  import common, { getProps } from "../common/base-create-update.mjs";
2
3
  import contact from "../../common/sobjects/contact.mjs";
3
4
 
@@ -7,8 +8,12 @@ export default {
7
8
  ...common,
8
9
  key: "salesforce_rest_api-create-contact",
9
10
  name: "Create Contact",
10
- description: `Creates a contact. [See the documentation](${docsLink})`,
11
- version: "0.3.6",
11
+ description: "Create a Salesforce contact (a person associated with an account)."
12
+ + " Use **Find Records** on `Account` to get the `AccountId` that links this contact to a company."
13
+ + " Use **Describe Object** on `Contact` to discover which fields your org requires."
14
+ + " "
15
+ + `[See the documentation](${docsLink})`,
16
+ version: "0.3.7",
12
17
  annotations: {
13
18
  destructiveHint: false,
14
19
  openWorldHint: true,
@@ -1,3 +1,4 @@
1
+ // x-pd-ai: optimized
1
2
  /* eslint-disable no-unused-vars */
2
3
  import common, { getProps } from "../common/base-create-update.mjs";
3
4
  import contentNote from "../../common/sobjects/content-note.mjs";
@@ -27,8 +28,14 @@ export default {
27
28
  ...common,
28
29
  key: "salesforce_rest_api-create-content-note",
29
30
  name: "Create Content Note",
30
- description: `Creates a content note. [See the documentation](${docsLink}) and [Set Up Notes](https://help.salesforce.com/s/articleView?id=sales.notes_admin_setup.htm&type=5).`,
31
- version: "0.0.7",
31
+ description: "Create an enhanced Salesforce content note (rich text, stored in Salesforce Files)."
32
+ + " Use this rather than **Create Note** on modern orgs; **Create Note** writes the classic plain-text note object."
33
+ + " Use **Update Content Note** to edit one afterwards."
34
+ + " "
35
+ + "Notes must be enabled in the org first - see [Set Up Notes](https://help.salesforce.com/s/articleView?id=sales.notes_admin_setup.htm&type=5)."
36
+ + " "
37
+ + `[See the documentation](${docsLink})`,
38
+ version: "0.0.8",
32
39
  annotations: {
33
40
  destructiveHint: false,
34
41
  openWorldHint: true,
@@ -1,4 +1,4 @@
1
- // vandelay-test-dr
1
+ // x-pd-ai: optimized
2
2
  import salesforce from "../../salesforce_rest_api.app.mjs";
3
3
 
4
4
  export default {
@@ -19,8 +19,10 @@ export default {
19
19
  + "\n- Event: `Subject`, `StartDateTime`, `EndDateTime`"
20
20
  + "\n\n"
21
21
  + "To add a Contact/Lead to a Campaign, create a CampaignMember:"
22
- + " `{\"CampaignId\": \"701xxx\", \"ContactId\": \"003xxx\"}` or `{\"CampaignId\": \"701xxx\", \"LeadId\": \"00Qxxx\"}`.",
23
- version: "0.0.1",
22
+ + " `{\"CampaignId\": \"701xxx\", \"ContactId\": \"003xxx\"}` or `{\"CampaignId\": \"701xxx\", \"LeadId\": \"00Qxxx\"}`."
23
+ + " "
24
+ + "[See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_create.htm)",
25
+ version: "0.0.2",
24
26
  type: "action",
25
27
  annotations: {
26
28
  readOnlyHint: false,
@@ -1,3 +1,4 @@
1
+ // x-pd-ai: optimized
1
2
  import common, { getProps } from "../common/base-create-update.mjs";
2
3
  import event from "../../common/sobjects/event.mjs";
3
4
 
@@ -8,8 +9,12 @@ export default {
8
9
  ...common,
9
10
  key: "salesforce_rest_api-create-event",
10
11
  name: "Create Event",
11
- description: `Creates an event. [See the documentation](${docsLink})`,
12
- version: "0.3.6",
12
+ description: "Create a Salesforce calendar event (a meeting or appointment with a start and end time)."
13
+ + " Use **Create Task** instead for to-do items with no scheduled time."
14
+ + " Use **Find Records** to get the `WhoId` (contact or lead) and `WhatId` (related record) you want to link."
15
+ + " "
16
+ + `[See the documentation](${docsLink})`,
17
+ version: "0.3.7",
13
18
  annotations: {
14
19
  destructiveHint: false,
15
20
  openWorldHint: true,
@@ -1,3 +1,4 @@
1
+ // x-pd-ai: optimized
1
2
  import common, { getProps } from "../common/base-create-update.mjs";
2
3
  import lead from "../../common/sobjects/lead.mjs";
3
4
 
@@ -7,8 +8,12 @@ export default {
7
8
  ...common,
8
9
  key: "salesforce_rest_api-create-lead",
9
10
  name: "Create Lead",
10
- description: `Creates a lead. [See the documentation](${docsLink})`,
11
- version: "0.3.6",
11
+ description: "Create a Salesforce lead (an unqualified prospect not yet linked to an account)."
12
+ + " Use **Create Contact** instead when the person already belongs to a known account."
13
+ + " Use **Add Lead to Campaign** afterwards to attribute the lead to a campaign."
14
+ + " "
15
+ + `[See the documentation](${docsLink})`,
16
+ version: "0.3.7",
12
17
  annotations: {
13
18
  destructiveHint: false,
14
19
  openWorldHint: true,
@@ -1,3 +1,4 @@
1
+ // x-pd-ai: optimized
1
2
  import common, { getProps } from "../common/base-create-update.mjs";
2
3
  import note from "../../common/sobjects/note.mjs";
3
4
  import { NOTE_INFO_PROP } from "../../common/props-info.mjs";
@@ -17,8 +18,12 @@ export default {
17
18
  ...common,
18
19
  key: "salesforce_rest_api-create-note",
19
20
  name: "Create Note",
20
- description: `Creates a note. [See the documentation](${docsLink})`,
21
- version: "0.3.7",
21
+ description: "Create a classic Salesforce note (up to 32 KB of plain text) attached to a parent record."
22
+ + " Prefer **Create Content Note** on modern orgs - classic notes are legacy and do not support rich text."
23
+ + " Use **Find Records** to get the parent record ID first."
24
+ + " "
25
+ + `[See the documentation](${docsLink})`,
26
+ version: "0.3.8",
22
27
  annotations: {
23
28
  destructiveHint: false,
24
29
  openWorldHint: true,
@@ -1,11 +1,18 @@
1
+ // x-pd-ai: optimized
1
2
  import common from "../common/batch-operation.mjs";
2
3
 
3
4
  export default {
4
5
  ...common,
5
6
  key: "salesforce_rest_api-create-opportunities-batch",
6
7
  name: "Create Opportunities (Batch)",
7
- description: "Create multiple Opportunities in Salesforce using Bulk API 2.0. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/datafiles_understanding_bulk2_ingest.htm)",
8
- version: "0.0.5",
8
+ description: "Create many Salesforce opportunities in one job using Bulk API 2.0."
9
+ + " Use this instead of **Create Opportunity** when inserting more than roughly 200 records - it is asynchronous and returns a job ID, not the created records."
10
+ + " Every row needs `Name`, `StageName` and `CloseDate`."
11
+ + " Input is a CSV file - supply a path under `/tmp` or a URL to download it from, with a header row of Salesforce field API names."
12
+ + " Poll the job in Salesforce to confirm completion; a successful response means the job was accepted, not that every row loaded."
13
+ + " "
14
+ + "[See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/datafiles_understanding_bulk2_ingest.htm)",
15
+ version: "0.0.6",
9
16
  annotations: {
10
17
  destructiveHint: false,
11
18
  openWorldHint: true,
@@ -1,3 +1,4 @@
1
+ // x-pd-ai: optimized
1
2
  import common, { getProps } from "../common/base-create-update.mjs";
2
3
  import opportunity from "../../common/sobjects/opportunity.mjs";
3
4
 
@@ -7,8 +8,12 @@ export default {
7
8
  ...common,
8
9
  key: "salesforce_rest_api-create-opportunity",
9
10
  name: "Create Opportunity",
10
- description: `Creates an opportunity. [See the documentation](${docsLink})`,
11
- version: "0.3.6",
11
+ description: "Create a Salesforce opportunity (a potential deal with an amount and close date)."
12
+ + " Requires `Name`, `StageName` and `CloseDate` - use **Describe Object** on `Opportunity` to list the valid `StageName` values for your org."
13
+ + " Use **Find Records** on `Account` to get the `AccountId` to attach the deal to."
14
+ + " "
15
+ + `[See the documentation](${docsLink})`,
16
+ version: "0.3.7",
12
17
  annotations: {
13
18
  destructiveHint: false,
14
19
  openWorldHint: true,
@@ -1,3 +1,4 @@
1
+ // x-pd-ai: optimized
1
2
  import {
2
3
  convertFieldsToProps, getAdditionalFields,
3
4
  } from "../../common/props-utils.mjs";
@@ -7,8 +8,12 @@ import { additionalFields } from "../common/base-create-update.mjs";
7
8
  export default {
8
9
  key: "salesforce_rest_api-create-record",
9
10
  name: "Create Record",
10
- 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)",
11
- version: "0.3.6",
11
+ description: "Create a Salesforce record of any object type, choosing fields interactively."
12
+ + " Prefer **Create CRM Record** in agent and API contexts - this action builds its field list dynamically, so the available inputs are not visible until an object type is chosen."
13
+ + " Use **List Objects** to discover object types and **Describe Object** to discover fields."
14
+ + " "
15
+ + "[See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_create.htm)",
16
+ version: "0.3.7",
12
17
  annotations: {
13
18
  destructiveHint: false,
14
19
  openWorldHint: true,
@@ -1,3 +1,4 @@
1
+ // x-pd-ai: optimized
1
2
  import common, { getProps } from "../common/base-create-update.mjs";
2
3
  import task from "../../common/sobjects/task.mjs";
3
4
 
@@ -8,8 +9,12 @@ export default {
8
9
  ...common,
9
10
  key: "salesforce_rest_api-create-task",
10
11
  name: "Create Task",
11
- description: `Creates a task. [See the documentation](${docsLink})`,
12
- version: "0.4.6",
12
+ description: "Create a Salesforce task (a to-do item with a due date, no specific time)."
13
+ + " Use **Create Event** instead for scheduled meetings with a start and end time."
14
+ + " Use **Find Records** to get the `WhoId` (contact or lead) and `WhatId` (related record) to link the task to."
15
+ + " "
16
+ + `[See the documentation](${docsLink})`,
17
+ version: "0.4.7",
13
18
  annotations: {
14
19
  destructiveHint: false,
15
20
  openWorldHint: true,
@@ -1,3 +1,4 @@
1
+ // x-pd-ai: optimized
1
2
  import common, { getProps } from "../common/base-create-update.mjs";
2
3
  import user from "../../common/sobjects/user.mjs";
3
4
 
@@ -8,8 +9,12 @@ export default {
8
9
  ...common,
9
10
  key: "salesforce_rest_api-create-user",
10
11
  name: "Create User",
11
- description: `Creates a Salesforce user. [See the documentation](${docsLink})`,
12
- version: "0.1.6",
12
+ description: "Create a Salesforce user (a login for a person in your org)."
13
+ + " Requires an available user license and a unique `Username` in email form; the `Username` must be globally unique across all Salesforce orgs."
14
+ + " Use **Get User** or **Find Records** on `User` to check whether the person already has an account."
15
+ + " "
16
+ + `[See the documentation](${docsLink})`,
17
+ version: "0.1.7",
13
18
  annotations: {
14
19
  destructiveHint: false,
15
20
  openWorldHint: true,
@@ -1,13 +1,15 @@
1
- // vandelay-test-dr
1
+ // x-pd-ai: optimized
2
2
  import salesforce from "../../salesforce_rest_api.app.mjs";
3
3
 
4
4
  export default {
5
5
  key: "salesforce_rest_api-delete-crm-record",
6
6
  name: "Delete Record",
7
7
  description:
8
- "Permanently deletes a Salesforce record (moves to Recycle Bin for 15 days)."
9
- + " Use **SOQL Query** to find the record ID if you only have the record name.",
10
- version: "0.0.1",
8
+ "Delete a Salesforce record. This moves it to the Recycle Bin, where it stays recoverable for up to 15 days - storage limits can purge it sooner."
9
+ + " Use **SOQL Query** to find the record ID if you only have the record name."
10
+ + " "
11
+ + "[See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_delete_record.htm)",
12
+ version: "0.0.2",
11
13
  type: "action",
12
14
  annotations: {
13
15
  readOnlyHint: false,
@@ -1,11 +1,16 @@
1
+ // x-pd-ai: optimized
1
2
  import salesforce from "../../salesforce_rest_api.app.mjs";
2
3
  import { ConfigurationError } from "@pipedream/platform";
3
4
 
4
5
  export default {
5
6
  key: "salesforce_rest_api-delete-note",
6
7
  name: "Delete Note Or Content Note",
7
- description: "Delete a note or content note from a Salesforce record. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_sobject_retrieve_delete.htm)",
8
- version: "0.0.2",
8
+ description: "Delete a note or content note from a Salesforce record."
9
+ + " This moves the note to the Recycle Bin, where it stays recoverable for up to 15 days - storage limits can purge it sooner."
10
+ + " Use **Find Records** on `Note` or `ContentNote` to get the ID first."
11
+ + " "
12
+ + "[See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_sobject_retrieve_delete.htm)",
13
+ version: "0.0.3",
9
14
  type: "action",
10
15
  annotations: {
11
16
  destructiveHint: true,
@@ -1,10 +1,15 @@
1
+ // x-pd-ai: optimized
1
2
  import salesforce from "../../salesforce_rest_api.app.mjs";
2
3
 
3
4
  export default {
4
5
  key: "salesforce_rest_api-delete-opportunity",
5
6
  name: "Delete Opportunity",
6
- 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)",
7
- version: "0.3.4",
7
+ description: "Delete a Salesforce opportunity."
8
+ + " This moves the record to the Recycle Bin, where it stays recoverable for up to 15 days - storage limits can purge it sooner."
9
+ + " Use **Find Records** on `Opportunity` to get the ID first, and prefer **Update Opportunity** to set a Closed Lost stage when you want to keep the history."
10
+ + " "
11
+ + "[See the documentation](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_delete_record.htm)",
12
+ version: "0.3.5",
8
13
  annotations: {
9
14
  destructiveHint: true,
10
15
  openWorldHint: true,
@@ -1,11 +1,16 @@
1
+ // x-pd-ai: optimized
1
2
  import salesforce from "../../salesforce_rest_api.app.mjs";
2
3
 
3
4
  export default {
4
5
  key: "salesforce_rest_api-delete-record",
5
6
  name: "Delete Record",
6
7
  description:
7
- "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)",
8
- version: "0.2.4",
8
+ "Delete a Salesforce record of any object type."
9
+ + " This moves the record to the Recycle Bin, where it stays recoverable for up to 15 days - storage limits can purge it sooner."
10
+ + " Use **Find Records** or **SOQL Query** to confirm you have the right record ID before deleting."
11
+ + " "
12
+ + "[See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_sobject_retrieve_delete.htm)",
13
+ version: "0.2.5",
9
14
  annotations: {
10
15
  destructiveHint: true,
11
16
  openWorldHint: true,
@@ -1,4 +1,4 @@
1
- // vandelay-test-dr
1
+ // x-pd-ai: optimized
2
2
  import salesforce from "../../salesforce_rest_api.app.mjs";
3
3
 
4
4
  export default {
@@ -10,8 +10,10 @@ export default {
10
10
  + " For picklist fields (like `StageName` on Opportunity, `Status` on Case), this returns all valid values"
11
11
  + " — use the API value, not the display label."
12
12
  + " Use the `fieldsFilter` parameter to narrow results — full object descriptions can be very large (100+ fields)."
13
- + " Use **List Objects** if you're unsure of the object's API name.",
14
- version: "0.0.1",
13
+ + " Use **List Objects** if you're unsure of the object's API name."
14
+ + " "
15
+ + "[See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_describe.htm)",
16
+ version: "0.0.2",
15
17
  type: "action",
16
18
  annotations: {
17
19
  readOnlyHint: true,
@@ -1,11 +1,21 @@
1
+ // x-pd-ai: optimized
1
2
  import salesforce from "../../salesforce_rest_api.app.mjs";
3
+ import constants from "../../common/constants.mjs";
4
+ import {
5
+ assertSalesforceId, truncationNote,
6
+ } from "../../common/soql.mjs";
2
7
 
3
8
  export default {
4
9
  key: "salesforce_rest_api-find-records",
5
10
  name: "Find Records",
6
- description:
7
- "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)",
8
- version: "0.2.4",
11
+ description: "Retrieve selected fields for records of any Salesforce object, either specific records by ID or the most recent ones."
12
+ + " Use this as the general-purpose record reader when no object-specific action fits - prefer **List Cases** for cases or **Get Record by ID** for a single known record."
13
+ + " Use **List Objects** to discover object types and **List Object Fields** to discover field names."
14
+ + " For example, `SObject Type` `Account` with `Fields to Obtain` `Id, Name` and `Limit` `25` returns the 25 most recently created accounts."
15
+ + " Leaving `Record ID(s)` empty returns recent records, not every record - Salesforce sends one batch, so set `Limit` and use **SOQL Query** when you need everything."
16
+ + " Newest-first ordering needs `CreatedDate`, so results are unordered on the few object types that lack it."
17
+ + " [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_query.htm)",
18
+ version: "0.3.0",
9
19
  annotations: {
10
20
  destructiveHint: false,
11
21
  openWorldHint: true,
@@ -19,7 +29,7 @@ export default {
19
29
  salesforce,
20
30
  "objectType",
21
31
  ],
22
- description: "The type of object to obtain records of.",
32
+ description: "The type of object to obtain records of, e.g. `Account`. Use **List Objects** to discover the object types in this org.",
23
33
  },
24
34
  fieldsToObtain: {
25
35
  propDefinition: [
@@ -29,6 +39,7 @@ export default {
29
39
  objType: c.sobjectType,
30
40
  }),
31
41
  ],
42
+ description: "The fields to return, e.g. `Id`, `Name`. Use **List Object Fields** to discover field names for the selected object. Include `Id` if you plan to act on the records afterwards.",
32
43
  },
33
44
  recordIds: {
34
45
  propDefinition: [
@@ -41,8 +52,15 @@ export default {
41
52
  label: "Record ID(s)",
42
53
  type: "string[]",
43
54
  optional: true,
44
- description:
45
- "The record(s) to retrieve. If not specified, all records will be retrieved.",
55
+ description: "The specific record(s) to retrieve (15- or 18-character Salesforce IDs). Leave empty to retrieve the most recent records of this object type.",
56
+ },
57
+ limit: {
58
+ type: "integer",
59
+ label: "Limit",
60
+ description: `The maximum number of records to return. Valid values are integers from 1 through ${constants.MAX_LIMIT}. Omit to return every record Salesforce sends in one batch.`,
61
+ min: 1,
62
+ max: constants.MAX_LIMIT,
63
+ optional: true,
46
64
  },
47
65
  },
48
66
  async run({ $ }) {
@@ -52,21 +70,40 @@ export default {
52
70
  fieldsToObtain,
53
71
  } = this;
54
72
 
55
- if (typeof recordIds === "string") recordIds = recordIds.split(",");
56
- if (typeof fieldsToObtain === "string") fieldsToObtain = fieldsToObtain.split(",");
73
+ if (typeof recordIds === "string") {
74
+ recordIds = recordIds.split(",");
75
+ }
76
+ if (typeof fieldsToObtain === "string") {
77
+ fieldsToObtain = fieldsToObtain.split(",");
78
+ }
57
79
 
58
80
  let query = `SELECT ${fieldsToObtain.join(", ")} FROM ${sobjectType}`;
59
81
 
60
82
  if (recordIds?.length) {
61
- query += ` WHERE Id IN ('${recordIds.join("','")}')`;
83
+ const ids = recordIds.map((id) => assertSalesforceId(id.trim(), "Record ID(s)"));
84
+ query += ` WHERE Id IN ('${ids.join("','")}')`;
85
+ } else {
86
+ // This action accepts any object type, and not every one has CreatedDate
87
+ // (PicklistValueInfo, for example). SOQL rejects the whole query rather than
88
+ // ignoring the clause, so only sort by it when the object actually has it.
89
+ const fields = await this.salesforce.getFieldsForObjectType(sobjectType);
90
+ const { CREATED_DATE: createdDate } = constants.FIELD_NAME;
91
+ if (fields.some(({ name }) => name === createdDate)) {
92
+ query += ` ORDER BY ${createdDate} DESC, Id DESC`;
93
+ }
94
+ }
95
+ if (this.limit) {
96
+ query += ` LIMIT ${this.limit}`;
62
97
  }
63
98
 
64
- const { records } = await this.salesforce.query({
99
+ const response = await this.salesforce.query({
65
100
  $,
66
101
  query,
67
102
  });
68
-
69
- $.export("$summary", `Sucessfully retrieved ${records.length} records`);
103
+ const { records } = response;
104
+ $.export("$summary", `Successfully retrieved ${records.length} ${sobjectType} record${records.length === 1
105
+ ? ""
106
+ : "s"}.${truncationNote(response, records.length)}`);
70
107
  return records;
71
108
  },
72
109
  };