@pipedream/salesforce_rest_api 1.14.1 → 2.0.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 (83) hide show
  1. package/actions/add-contact-to-campaign/add-contact-to-campaign.mjs +1 -1
  2. package/actions/add-lead-to-campaign/add-lead-to-campaign.mjs +1 -1
  3. package/actions/common/base-create-update.mjs +2 -34
  4. package/actions/convert-soap-xml-to-json/convert-soap-xml-to-json.mjs +1 -1
  5. package/actions/create-account/create-account.mjs +1 -11
  6. package/actions/create-accounts-batch/create-accounts-batch.mjs +1 -1
  7. package/actions/create-attachment/create-attachment.mjs +8 -13
  8. package/actions/create-campaign/create-campaign.mjs +1 -17
  9. package/actions/create-case/create-case.mjs +1 -16
  10. package/actions/create-casecomment/create-casecomment.mjs +13 -13
  11. package/actions/create-contact/create-contact.mjs +1 -16
  12. package/actions/create-content-note/create-content-note.mjs +43 -33
  13. package/actions/create-crm-record/create-crm-record.mjs +2 -2
  14. package/actions/create-event/create-event.mjs +27 -25
  15. package/actions/create-lead/create-lead.mjs +1 -11
  16. package/actions/create-note/create-note.mjs +13 -9
  17. package/actions/create-opportunities-batch/create-opportunities-batch.mjs +1 -1
  18. package/actions/create-opportunity/create-opportunity.mjs +1 -11
  19. package/actions/create-record/create-record.mjs +15 -54
  20. package/actions/create-task/create-task.mjs +2 -21
  21. package/actions/create-user/create-user.mjs +1 -11
  22. package/actions/delete-crm-record/delete-crm-record.mjs +2 -2
  23. package/actions/delete-note/delete-note.mjs +1 -1
  24. package/actions/delete-opportunity/delete-opportunity.mjs +1 -1
  25. package/actions/delete-record/delete-record.mjs +1 -1
  26. package/actions/describe-object/describe-object.mjs +1 -1
  27. package/actions/find-records/find-records.mjs +1 -1
  28. package/actions/get-case/get-case.mjs +1 -1
  29. package/actions/get-current-user/get-current-user.mjs +1 -1
  30. package/actions/get-knowledge-articles/get-knowledge-articles.mjs +1 -1
  31. package/actions/get-knowledge-data-category-groups/get-knowledge-data-category-groups.mjs +1 -1
  32. package/actions/get-record-by-id/get-record-by-id.mjs +1 -1
  33. package/actions/get-related-records/get-related-records.mjs +1 -1
  34. package/actions/get-user/get-user.mjs +1 -1
  35. package/actions/get-user-info/get-user-info.mjs +1 -1
  36. package/actions/insert-blob-data/insert-blob-data.mjs +1 -1
  37. package/actions/list-case-comments/list-case-comments.mjs +1 -1
  38. package/actions/list-case-feed-items/list-case-feed-items.mjs +1 -1
  39. package/actions/list-cases/list-cases.mjs +1 -1
  40. package/actions/list-email-messages/list-email-messages.mjs +1 -1
  41. package/actions/list-email-templates/list-email-templates.mjs +1 -1
  42. package/actions/list-knowledge-articles/list-knowledge-articles.mjs +1 -1
  43. package/actions/list-object-fields/list-object-fields.mjs +1 -1
  44. package/actions/list-objects/list-objects.mjs +1 -1
  45. package/actions/post-feed-to-chatter/post-feed-to-chatter.mjs +1 -1
  46. package/actions/search-string/search-string.mjs +1 -1
  47. package/actions/send-email/send-email.mjs +1 -1
  48. package/actions/soql-query/soql-query.mjs +1 -1
  49. package/actions/soql-search/soql-search.mjs +1 -1
  50. package/actions/sosl-search/sosl-search.mjs +1 -1
  51. package/actions/text-search/text-search.mjs +1 -1
  52. package/actions/update-account/update-account.mjs +8 -22
  53. package/actions/update-accounts-batch/update-accounts-batch.mjs +1 -1
  54. package/actions/update-contact/update-contact.mjs +8 -27
  55. package/actions/update-content-note/update-content-note.mjs +8 -19
  56. package/actions/update-crm-record/update-crm-record.mjs +2 -2
  57. package/actions/update-email-template/update-email-template.mjs +13 -62
  58. package/actions/update-note/update-note.mjs +8 -19
  59. package/actions/update-opportunities-batch/update-opportunities-batch.mjs +1 -1
  60. package/actions/update-opportunity/update-opportunity.mjs +8 -22
  61. package/actions/update-record/update-record.mjs +24 -80
  62. package/actions/upsert-record/upsert-record.mjs +32 -76
  63. package/common/sobjects/attachment.mjs +2 -11
  64. package/common/sobjects/caseComment.mjs +2 -11
  65. package/common/sobjects/content-note.mjs +3 -11
  66. package/common/sobjects/event.mjs +3 -17
  67. package/common/sobjects/note.mjs +3 -12
  68. package/common/sobjects/opportunity.mjs +2 -10
  69. package/common/sobjects/user.mjs +2 -10
  70. package/package.json +1 -1
  71. package/salesforce_rest_api.app.mjs +0 -16
  72. package/sources/case-updated-instant/case-updated-instant.mjs +1 -1
  73. package/sources/email-template-updated-instant/email-template-updated-instant.mjs +1 -1
  74. package/sources/knowledge-article-updated-instant/knowledge-article-updated-instant.mjs +1 -1
  75. package/sources/new-case-instant/new-case-instant.mjs +1 -1
  76. package/sources/new-email-template-instant/new-email-template-instant.mjs +1 -1
  77. package/sources/new-feed-comment/new-feed-comment.mjs +1 -1
  78. package/sources/new-feed-item/new-feed-item.mjs +1 -1
  79. package/sources/new-knowledge-article-instant/new-knowledge-article-instant.mjs +1 -1
  80. package/sources/new-outbound-message/new-outbound-message.mjs +1 -1
  81. package/sources/new-record-instant/new-record-instant.mjs +1 -1
  82. package/sources/record-deleted-instant/record-deleted-instant.mjs +1 -1
  83. package/sources/record-updated-instant/record-updated-instant.mjs +1 -1
@@ -1,15 +1,18 @@
1
1
  // x-pd-ai: optimized
2
2
  import common, { getProps } from "../common/base-create-update.mjs";
3
3
  import account from "../../common/sobjects/account.mjs";
4
+ import salesforce from "../../salesforce_rest_api.app.mjs";
4
5
  import { docsLink } from "../create-account/create-account.mjs";
5
6
 
7
+ /* eslint-disable no-unused-vars */
6
8
  const {
7
- salesforce, ...props
9
+ salesforce: _sf, ...props
8
10
  } = getProps({
9
11
  createOrUpdate: "update",
10
12
  objType: account,
11
13
  docsLink,
12
14
  });
15
+ /* eslint-enable no-unused-vars */
13
16
 
14
17
  export default {
15
18
  ...common,
@@ -20,35 +23,22 @@ export default {
20
23
  + " Use **Find Records** on `Account` to get the record ID first."
21
24
  + " "
22
25
  + `[See the documentation](${docsLink})`,
23
- version: "0.3.7",
26
+ version: "0.4.0",
24
27
  annotations: {
25
- destructiveHint: true,
28
+ destructiveHint: false,
26
29
  openWorldHint: true,
27
30
  readOnlyHint: false,
28
31
  },
29
32
  type: "action",
30
33
  methods: {
31
34
  ...common.methods,
32
- getObjectType() {
33
- return "Account";
34
- },
35
- getAdvancedProps() {
36
- return account.extraProps;
37
- },
38
35
  },
39
36
  props: {
40
37
  salesforce,
41
38
  accountId: {
42
- propDefinition: [
43
- salesforce,
44
- "recordId",
45
- () => ({
46
- objType: "Account",
47
- nameField: "Name",
48
- }),
49
- ],
39
+ type: "string",
50
40
  label: "Account ID",
51
- description: "The Account to update.",
41
+ description: "The ID of the Account to update (Salesforce's 15- or 18-character record ID, e.g. `001XX000003DHP0`). Use **SOQL Query** to find the ID.",
52
42
  },
53
43
  ...props,
54
44
  },
@@ -56,14 +46,10 @@ export default {
56
46
  /* eslint-disable no-unused-vars */
57
47
  const {
58
48
  salesforce,
59
- getAdvancedProps,
60
- getObjectType,
61
49
  getAdditionalFields,
62
50
  formatDateTimeProps,
63
51
  accountId,
64
- useAdvancedProps,
65
52
  docsInfo,
66
- dateInfo,
67
53
  additionalFields,
68
54
  ...data
69
55
  } = this;
@@ -12,7 +12,7 @@ export default {
12
12
  + " Poll the job in Salesforce to confirm completion; a successful response means the job was accepted, not that every row loaded."
13
13
  + " "
14
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",
15
+ version: "0.0.7",
16
16
  annotations: {
17
17
  destructiveHint: true,
18
18
  openWorldHint: true,
@@ -1,16 +1,18 @@
1
1
  // x-pd-ai: optimized
2
2
  import common, { getProps } from "../common/base-create-update.mjs";
3
3
  import contact from "../../common/sobjects/contact.mjs";
4
+ import salesforce from "../../salesforce_rest_api.app.mjs";
4
5
  import { docsLink } from "../create-contact/create-contact.mjs";
5
6
 
7
+ /* eslint-disable no-unused-vars */
6
8
  const {
7
- salesforce, ...props
9
+ salesforce: _sf, ...props
8
10
  } = getProps({
9
11
  createOrUpdate: "update",
10
12
  objType: contact,
11
13
  docsLink,
12
- showDateInfo: true,
13
14
  });
15
+ /* eslint-enable no-unused-vars */
14
16
 
15
17
  export default {
16
18
  ...common,
@@ -21,35 +23,22 @@ export default {
21
23
  + " Use **Find Records** on `Contact` to get the record ID first."
22
24
  + " "
23
25
  + `[See the documentation](${docsLink})`,
24
- version: "0.3.7",
26
+ version: "0.4.0",
25
27
  annotations: {
26
- destructiveHint: true,
28
+ destructiveHint: false,
27
29
  openWorldHint: true,
28
30
  readOnlyHint: false,
29
31
  },
30
32
  type: "action",
31
33
  methods: {
32
34
  ...common.methods,
33
- getObjectType() {
34
- return "Contact";
35
- },
36
- getAdvancedProps() {
37
- return contact.extraProps;
38
- },
39
35
  },
40
36
  props: {
41
37
  salesforce,
42
38
  contactId: {
43
- propDefinition: [
44
- salesforce,
45
- "recordId",
46
- () => ({
47
- objType: "Contact",
48
- nameField: "Name",
49
- }),
50
- ],
39
+ type: "string",
51
40
  label: "Contact ID",
52
- description: "The Contact to update.",
41
+ description: "The ID of the Contact to update (Salesforce's 15- or 18-character record ID, e.g. `003XX000004TmiQ`). Use **SOQL Query** to find the ID.",
53
42
  },
54
43
  ...props,
55
44
  },
@@ -57,16 +46,11 @@ export default {
57
46
  /* eslint-disable no-unused-vars */
58
47
  const {
59
48
  salesforce,
60
- getAdvancedProps,
61
- getObjectType,
62
49
  getAdditionalFields,
63
50
  formatDateTimeProps,
64
51
  contactId,
65
- useAdvancedProps,
66
52
  docsInfo,
67
- dateInfo,
68
53
  additionalFields,
69
- Birthdate,
70
54
  ...data
71
55
  } = this;
72
56
  /* eslint-enable no-unused-vars */
@@ -75,9 +59,6 @@ export default {
75
59
  id: contactId,
76
60
  data: {
77
61
  ...data,
78
- ...formatDateTimeProps({
79
- Birthdate,
80
- }),
81
62
  ...getAdditionalFields(),
82
63
  },
83
64
  });
@@ -1,17 +1,20 @@
1
1
  // x-pd-ai: optimized
2
2
  import common, { getProps } from "../common/base-create-update.mjs";
3
3
  import contentNote from "../../common/sobjects/content-note.mjs";
4
+ import salesforce from "../../salesforce_rest_api.app.mjs";
4
5
  import { NOTE_INFO_PROP } from "../../common/props-info.mjs";
5
6
 
6
7
  const docsLink = "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_contentnote.htm";
7
8
 
9
+ /* eslint-disable no-unused-vars */
8
10
  const {
9
- salesforce, ...props
11
+ salesforce: _sf, ...props
10
12
  } = getProps({
11
13
  createOrUpdate: "update",
12
14
  objType: contentNote,
13
15
  docsLink,
14
16
  });
17
+ /* eslint-enable no-unused-vars */
15
18
 
16
19
  export default {
17
20
  ...common,
@@ -24,33 +27,23 @@ export default {
24
27
  + "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)."
25
28
  + " "
26
29
  + `[See the documentation](${docsLink})`,
27
- version: "0.0.4",
30
+ version: "1.0.0",
28
31
  type: "action",
29
32
  annotations: {
30
- destructiveHint: true,
33
+ destructiveHint: false,
31
34
  openWorldHint: true,
32
35
  readOnlyHint: false,
33
36
  },
34
37
  methods: {
35
38
  ...common.methods,
36
- getObjectType() {
37
- return "ContentNote";
38
- },
39
39
  },
40
40
  props: {
41
41
  salesforce,
42
42
  noteInfo: NOTE_INFO_PROP,
43
43
  contentNoteId: {
44
- propDefinition: [
45
- salesforce,
46
- "recordId",
47
- () => ({
48
- objType: "ContentNote",
49
- nameField: "Title",
50
- }),
51
- ],
44
+ type: "string",
52
45
  label: "Content Note ID",
53
- description: "The ID of the content note to update.",
46
+ description: "The ID of the ContentNote to update (Salesforce's 15- or 18-character record ID, e.g. `069XX0000004Grr`). Use **SOQL Query** to find the ID.",
54
47
  },
55
48
  ...props,
56
49
  },
@@ -59,13 +52,9 @@ export default {
59
52
  const {
60
53
  salesforce,
61
54
  contentNoteId,
62
- getAdvancedProps,
63
- getObjectType,
64
55
  getAdditionalFields,
65
56
  formatDateTimeProps,
66
- useAdvancedProps,
67
57
  docsInfo,
68
- dateInfo,
69
58
  additionalFields,
70
59
  noteInfo,
71
60
  ...data
@@ -3,14 +3,14 @@ import salesforce from "../../salesforce_rest_api.app.mjs";
3
3
 
4
4
  export default {
5
5
  key: "salesforce_rest_api-update-crm-record",
6
- name: "Update Record",
6
+ name: "Update CRM Record",
7
7
  description:
8
8
  "Update an existing Salesforce record. Only pass fields you want to change — unspecified fields remain unchanged."
9
9
  + " Use **Describe Object** for valid field names and picklist values."
10
10
  + " Use **SOQL Query** to find the record ID if you only have the name."
11
11
  + " "
12
12
  + "[See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_update_fields.htm)",
13
- version: "0.0.2",
13
+ version: "0.0.3",
14
14
  type: "action",
15
15
  annotations: {
16
16
  readOnlyHint: false,
@@ -1,9 +1,5 @@
1
1
  // x-pd-ai: optimized
2
- import {
3
- convertFieldsToProps, getAdditionalFields,
4
- } from "../../common/props-utils.mjs";
5
2
  import salesforce from "../../salesforce_rest_api.app.mjs";
6
- import { additionalFields } from "../common/base-create-update.mjs";
7
3
 
8
4
  export default {
9
5
  key: "salesforce_rest_api-update-email-template",
@@ -13,9 +9,9 @@ export default {
13
9
  + " Only the fields you supply change; everything else is left as-is."
14
10
  + " "
15
11
  + "[See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_update_fields.htm)",
16
- version: "0.0.7",
12
+ version: "1.0.0",
17
13
  annotations: {
18
- destructiveHint: true,
14
+ destructiveHint: false,
19
15
  openWorldHint: true,
20
16
  readOnlyHint: false,
21
17
  },
@@ -23,69 +19,24 @@ export default {
23
19
  props: {
24
20
  salesforce,
25
21
  recordId: {
26
- propDefinition: [
27
- salesforce,
28
- "recordId",
29
- () => ({
30
- objType: "EmailTemplate",
31
- }),
32
- ],
33
- description: "The email template to update.",
22
+ type: "string",
23
+ label: "Record ID",
24
+ description: "The ID of the EmailTemplate record to update (Salesforce's 15- or 18-character record ID, e.g. `00XXX0000004Cts`). Use **SOQL Query** to find the ID.",
34
25
  },
35
- fieldsToUpdate: {
36
- propDefinition: [
37
- salesforce,
38
- "fieldsToUpdate",
39
- () => ({
40
- objType: "EmailTemplate",
41
- }),
42
- ],
43
- reloadProps: true,
26
+ fields: {
27
+ type: "object",
28
+ label: "Fields",
29
+ description:
30
+ "Field name -> new value pairs. Example: `{\"Subject\": \"Updated subject line\", \"Body\": \"New body content\"}`. Use **Describe Object** to discover valid field names.",
44
31
  },
45
32
  },
46
- methods: {
47
- getAdditionalFields,
48
- convertFieldsToProps,
49
- },
50
- async additionalProps() {
51
- const { fieldsToUpdate } = this;
52
- const fields = await this.salesforce.getFieldsForObjectType("EmailTemplate");
53
-
54
- const selectedFields = fields.filter(({ name }) => fieldsToUpdate.includes(name));
55
- const selectedFieldProps = this.convertFieldsToProps(selectedFields);
56
-
57
- return {
58
- docsInfo: {
59
- type: "alert",
60
- alertType: "info",
61
- content: "[See the documentation](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_emailtemplate.htm) for information on all available fields.",
62
- },
63
- ...selectedFieldProps,
64
- additionalFields,
65
- };
66
- },
67
33
  async run({ $ }) {
68
- /* eslint-disable no-unused-vars */
69
- const {
70
- salesforce,
71
- recordId,
72
- fieldsToUpdate,
73
- getAdditionalFields: getData,
74
- convertFieldsToProps,
75
- docsInfo,
76
- additionalFields,
77
- ...data
78
- } = this;
79
- /* eslint-enable no-unused-vars */
80
34
  const response = await this.salesforce.updateRecord("EmailTemplate", {
81
35
  $,
82
- id: recordId,
83
- data: {
84
- ...data,
85
- ...getData(),
86
- },
36
+ id: this.recordId,
37
+ data: this.fields,
87
38
  });
88
- $.export("$summary", `Successfully updated Email Template record (ID: ${recordId})`);
39
+ $.export("$summary", `Successfully updated Email Template record (ID: ${this.recordId})`);
89
40
  return response;
90
41
  },
91
42
  };
@@ -1,17 +1,20 @@
1
1
  // x-pd-ai: optimized
2
2
  import common, { getProps } from "../common/base-create-update.mjs";
3
3
  import note from "../../common/sobjects/note.mjs";
4
+ import salesforce from "../../salesforce_rest_api.app.mjs";
4
5
  import { NOTE_INFO_PROP } from "../../common/props-info.mjs";
5
6
 
6
7
  const docsLink = "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_note.htm";
7
8
 
9
+ /* eslint-disable no-unused-vars */
8
10
  const {
9
- salesforce, ...props
11
+ salesforce: _sf, ...props
10
12
  } = getProps({
11
13
  createOrUpdate: "update",
12
14
  objType: note,
13
15
  docsLink,
14
16
  });
17
+ /* eslint-enable no-unused-vars */
15
18
 
16
19
  export default {
17
20
  ...common,
@@ -22,33 +25,23 @@ export default {
22
25
  + " Supplying `Body` replaces the note text outright rather than appending to it."
23
26
  + " "
24
27
  + `[See the documentation](${docsLink})`,
25
- version: "0.0.4",
28
+ version: "0.1.0",
26
29
  type: "action",
27
30
  annotations: {
28
- destructiveHint: true,
31
+ destructiveHint: false,
29
32
  openWorldHint: true,
30
33
  readOnlyHint: false,
31
34
  },
32
35
  methods: {
33
36
  ...common.methods,
34
- getObjectType() {
35
- return "Note";
36
- },
37
37
  },
38
38
  props: {
39
39
  salesforce,
40
40
  noteInfo: NOTE_INFO_PROP,
41
41
  noteId: {
42
- propDefinition: [
43
- salesforce,
44
- "recordId",
45
- () => ({
46
- objType: "Note",
47
- nameField: "Title",
48
- }),
49
- ],
42
+ type: "string",
50
43
  label: "Note ID",
51
- description: "The ID of the note to update.",
44
+ description: "The ID of the note to update (Salesforce's 15- or 18-character record ID, e.g. `002XX000001aBcD`). Use **SOQL Query** to find the ID.",
52
45
  },
53
46
  ...props,
54
47
  },
@@ -57,13 +50,9 @@ export default {
57
50
  const {
58
51
  salesforce,
59
52
  noteId,
60
- getAdvancedProps,
61
- getObjectType,
62
53
  getAdditionalFields,
63
54
  formatDateTimeProps,
64
- useAdvancedProps,
65
55
  docsInfo,
66
- dateInfo,
67
56
  additionalFields,
68
57
  noteInfo,
69
58
  ...data
@@ -12,7 +12,7 @@ export default {
12
12
  + " Poll the job in Salesforce to confirm completion; a successful response means the job was accepted, not that every row loaded."
13
13
  + " "
14
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",
15
+ version: "0.0.7",
16
16
  annotations: {
17
17
  destructiveHint: true,
18
18
  openWorldHint: true,
@@ -1,17 +1,19 @@
1
1
  // x-pd-ai: optimized
2
2
  import common, { getProps } from "../common/base-create-update.mjs";
3
3
  import opportunity from "../../common/sobjects/opportunity.mjs";
4
+ import salesforce from "../../salesforce_rest_api.app.mjs";
4
5
  import { docsLink } from "../create-opportunity/create-opportunity.mjs";
5
6
 
7
+ /* eslint-disable no-unused-vars */
6
8
  const {
7
- salesforce, ...props
9
+ salesforce: _sf, ...props
8
10
  } = getProps({
9
11
  createOrUpdate: "update",
10
12
  objType: opportunity,
11
13
  docsLink,
12
14
  showDateInfo: true,
13
- advancedProps: false,
14
15
  });
16
+ /* eslint-enable no-unused-vars */
15
17
 
16
18
  export default {
17
19
  ...common,
@@ -22,35 +24,22 @@ export default {
22
24
  + " Only the fields you supply change; everything else is left as-is."
23
25
  + " "
24
26
  + `[See the documentation](${docsLink})`,
25
- version: "0.3.7",
27
+ version: "0.4.0",
26
28
  annotations: {
27
- destructiveHint: true,
29
+ destructiveHint: false,
28
30
  openWorldHint: true,
29
31
  readOnlyHint: false,
30
32
  },
31
33
  type: "action",
32
34
  methods: {
33
35
  ...common.methods,
34
- getObjectType() {
35
- return "Opportunity";
36
- },
37
- getAdvancedProps() {
38
- return opportunity.extraProps;
39
- },
40
36
  },
41
37
  props: {
42
38
  salesforce,
43
39
  opportunityId: {
44
- propDefinition: [
45
- salesforce,
46
- "recordId",
47
- () => ({
48
- objType: "Opportunity",
49
- nameField: "Name",
50
- }),
51
- ],
40
+ type: "string",
52
41
  label: "Opportunity ID",
53
- description: "The Opportunity to update.",
42
+ description: "The ID of the Opportunity to update (Salesforce's 15- or 18-character record ID, e.g. `006XX000004TmXY`). Use **SOQL Query** to find the ID.",
54
43
  },
55
44
  ...props,
56
45
  },
@@ -58,12 +47,9 @@ export default {
58
47
  /* eslint-disable no-unused-vars */
59
48
  const {
60
49
  salesforce,
61
- getAdvancedProps,
62
- getObjectType,
63
50
  getAdditionalFields,
64
51
  formatDateTimeProps,
65
52
  opportunityId,
66
- useAdvancedProps,
67
53
  docsInfo,
68
54
  dateInfo,
69
55
  additionalFields,
@@ -1,21 +1,16 @@
1
1
  // x-pd-ai: optimized
2
- import {
3
- convertFieldsToProps, getAdditionalFields,
4
- } from "../../common/props-utils.mjs";
5
2
  import salesforce from "../../salesforce_rest_api.app.mjs";
6
- import { additionalFields } from "../common/base-create-update.mjs";
7
3
 
8
4
  export default {
9
5
  key: "salesforce_rest_api-update-record",
10
6
  name: "Update Record",
11
- description: "Update a Salesforce record of any object type, choosing fields interactively."
12
- + " Prefer **Update 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."
7
+ description: "Update a Salesforce record of any object type."
13
8
  + " Only the fields you supply change; everything else is left as-is."
14
9
  + " "
15
10
  + "[See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_update_fields.htm)",
16
- version: "0.3.8",
11
+ version: "1.0.0",
17
12
  annotations: {
18
- destructiveHint: true,
13
+ destructiveHint: false,
19
14
  openWorldHint: true,
20
15
  readOnlyHint: false,
21
16
  },
@@ -23,86 +18,35 @@ export default {
23
18
  props: {
24
19
  salesforce,
25
20
  sobjectType: {
26
- propDefinition: [
27
- salesforce,
28
- "objectType",
29
- ],
30
- description: "The type of object to update a record of.",
31
- reloadProps: true,
21
+ type: "string",
22
+ label: "Object Type",
23
+ description:
24
+ "The Salesforce object API name to update (e.g. `Account`, `Contact`, `Opportunity`). Prop name preserved to avoid breaking existing configs.",
32
25
  },
33
26
  recordId: {
34
- propDefinition: [
35
- salesforce,
36
- "recordId",
37
- (c) => ({
38
- objType: c.sobjectType,
39
- }),
40
- ],
27
+ type: "string",
28
+ label: "Record ID",
41
29
  description:
42
- "The record to update.",
30
+ "The ID of the record to update (Salesforce's 15- or 18-character record ID, e.g. `001XX000003DHP0` for an Account). Use **SOQL Query** to find the ID if you only have the record name.",
43
31
  },
44
- fieldsToUpdate: {
45
- propDefinition: [
46
- salesforce,
47
- "fieldsToUpdate",
48
- (c) => ({
49
- objType: c.sobjectType,
50
- }),
51
- ],
52
- optional: true,
53
- reloadProps: true,
32
+ fields: {
33
+ type: "object",
34
+ label: "Fields",
35
+ description:
36
+ "Field name -> new value pairs. Only include fields you want to change. Example: `{\"StageName\": \"Closed Won\", \"Amount\": 75000}`. Use **Describe Object** to discover valid field names.",
54
37
  },
55
38
  },
56
- methods: {
57
- getAdditionalFields,
58
- convertFieldsToProps,
59
- },
60
- async additionalProps() {
61
- const {
62
- sobjectType, fieldsToUpdate,
63
- } = this;
64
- const fields = await this.salesforce.getFieldsForObjectType(sobjectType);
65
-
66
- // Only generate props for manually selected fields if any were selected
67
- let selectedFieldProps = {};
68
- if (fieldsToUpdate && fieldsToUpdate.length > 0) {
69
- const selectedFields = fields.filter(({ name }) => fieldsToUpdate.includes(name));
70
- selectedFieldProps = this.convertFieldsToProps(selectedFields);
71
- }
72
-
73
- return {
74
- docsInfo: {
75
- type: "alert",
76
- alertType: "info",
77
- 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.`,
78
- },
79
- ...selectedFieldProps,
80
- additionalFields,
81
- };
82
- },
83
39
  async run({ $ }) {
84
- /* eslint-disable no-unused-vars */
85
- const {
86
- salesforce,
87
- sobjectType,
88
- recordId,
89
- fieldsToUpdate,
90
- getAdditionalFields: getData,
91
- convertFieldsToProps,
92
- docsInfo,
93
- additionalFields,
94
- ...data
95
- } = this;
96
- /* eslint-enable no-unused-vars */
97
- const response = await this.salesforce.updateRecord(sobjectType, {
40
+ await this.salesforce.updateRecord(this.sobjectType, {
98
41
  $,
99
- id: recordId,
100
- data: {
101
- ...data,
102
- ...getData(),
103
- },
42
+ id: this.recordId,
43
+ data: this.fields,
104
44
  });
105
- $.export("$summary", `Successfully updated ${sobjectType} record (ID: ${recordId})`);
106
- return response;
45
+ $.export("$summary", `Successfully updated ${this.sobjectType} record (ID: ${this.recordId})`);
46
+ return {
47
+ success: true,
48
+ objectType: this.sobjectType,
49
+ recordId: this.recordId,
50
+ };
107
51
  },
108
52
  };