@pipedream/salesforce_rest_api 0.3.3 → 0.4.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 (73) hide show
  1. package/actions/create-account/create-account.mjs +51 -0
  2. package/actions/create-attachment/create-attachment.mjs +62 -0
  3. package/actions/create-campaign/create-campaign.mjs +51 -0
  4. package/actions/create-case/create-case.mjs +50 -0
  5. package/actions/create-casecomment/create-casecomment.mjs +50 -0
  6. package/actions/create-contact/create-contact.mjs +50 -0
  7. package/actions/create-event/create-event.mjs +80 -0
  8. package/actions/create-lead/create-lead.mjs +56 -0
  9. package/actions/create-note/create-note.mjs +56 -0
  10. package/actions/create-opportunity/create-opportunity.mjs +62 -0
  11. package/actions/create-record/create-record.mjs +36 -0
  12. package/actions/create-task/create-task.mjs +56 -0
  13. package/actions/delete-opportunity/delete-opportunity.mjs +30 -0
  14. package/actions/delete-record/delete-record.mjs +37 -0
  15. package/actions/find-create-record/find-create-record.mjs +84 -0
  16. package/actions/find-records/find-records.mjs +48 -0
  17. package/actions/get-sobject-fields-values/get-sobject-fields-values.mjs +57 -0
  18. package/actions/insert-blob-data/insert-blob-data.mjs +77 -0
  19. package/actions/soql-search/soql-search.mjs +29 -0
  20. package/actions/sosl-search/sosl-search.mjs +29 -0
  21. package/actions/update-account/update-account.mjs +59 -0
  22. package/actions/update-contact/update-contact.mjs +58 -0
  23. package/actions/update-opportunity/update-opportunity.mjs +72 -0
  24. package/actions/update-record/update-record.mjs +46 -0
  25. package/common/constants.mjs +30 -0
  26. package/common/sobjects/account.mjs +27 -0
  27. package/common/sobjects/attachment.mjs +22 -0
  28. package/common/sobjects/campaign.mjs +27 -0
  29. package/common/sobjects/case.mjs +17 -0
  30. package/common/sobjects/caseComment.mjs +7 -0
  31. package/common/sobjects/contact.mjs +52 -0
  32. package/common/sobjects/event.mjs +22 -0
  33. package/common/sobjects/lead.mjs +32 -0
  34. package/common/sobjects/note.mjs +17 -0
  35. package/common/sobjects/opportunity.mjs +27 -0
  36. package/common/sobjects/task.mjs +25 -0
  37. package/common/utils.mjs +51 -0
  38. package/package.json +6 -3
  39. package/salesforce_rest_api.app.mjs +349 -37
  40. package/sources/common-instant.mjs +15 -9
  41. package/sources/common.mjs +3 -5
  42. package/sources/new-object/new-object.mjs +1 -1
  43. package/sources/new-object-instant/new-object-instant.mjs +1 -1
  44. package/sources/new-outbound-message/new-outbound-message.mjs +1 -1
  45. package/sources/object-deleted/object-deleted.mjs +2 -2
  46. package/sources/object-deleted-instant/object-deleted-instant.mjs +2 -2
  47. package/sources/object-updated/object-updated.mjs +2 -2
  48. package/sources/object-updated-instant/object-updated-instant.mjs +2 -2
  49. package/sources/updated-field-on-record/updated-field-on-record.mjs +2 -2
  50. package/sources/updated-field-on-record-instant/updated-field-on-record-instant.mjs +2 -2
  51. package/actions/salesforce-create-account/salesforce-create-account.mjs +0 -374
  52. package/actions/salesforce-create-attachment/salesforce-create-attachment.mjs +0 -73
  53. package/actions/salesforce-create-campaign/salesforce-create-campaign.mjs +0 -148
  54. package/actions/salesforce-create-case/salesforce-create-case.mjs +0 -179
  55. package/actions/salesforce-create-casecomment/salesforce-create-casecomment.mjs +0 -58
  56. package/actions/salesforce-create-contact/salesforce-create-contact.mjs +0 -340
  57. package/actions/salesforce-create-event/salesforce-create-event.mjs +0 -232
  58. package/actions/salesforce-create-lead/salesforce-create-lead.mjs +0 -267
  59. package/actions/salesforce-create-note/salesforce-create-note.mjs +0 -63
  60. package/actions/salesforce-create-opportunity/salesforce-create-opportunity.mjs +0 -170
  61. package/actions/salesforce-create-record/salesforce-create-record.mjs +0 -36
  62. package/actions/salesforce-create-task/salesforce-create-task.mjs +0 -219
  63. package/actions/salesforce-delete-opportunity/salesforce-delete-opportunity.mjs +0 -37
  64. package/actions/salesforce-get-sobject-fields-values/salesforce-get-sobject-fields-values.mjs +0 -37
  65. package/actions/salesforce-insert-blob-data/salesforce-insert-blob-data.mjs +0 -70
  66. package/actions/salesforce-make-api-call/salesforce-make-api-call.mjs +0 -56
  67. package/actions/salesforce-soql-search/salesforce-soql-search.mjs +0 -29
  68. package/actions/salesforce-sosl-search/salesforce-sosl-search.mjs +0 -30
  69. package/actions/salesforce-update-account/salesforce-update-account.mjs +0 -357
  70. package/actions/salesforce-update-contact/salesforce-update-contact.mjs +0 -345
  71. package/actions/salesforce-update-opportunity/salesforce-update-opportunity.mjs +0 -171
  72. package/actions/salesforce-update-record/salesforce-update-record.mjs +0 -40
  73. package/utils.mjs +0 -27
@@ -0,0 +1,51 @@
1
+ import salesforce from "../../salesforce_rest_api.app.mjs";
2
+ import account from "../../common/sobjects/account.mjs";
3
+ import {
4
+ pickBy, pick,
5
+ } from "lodash-es";
6
+ import { toSingleLineString } from "../../common/utils.mjs";
7
+
8
+ export default {
9
+ key: "salesforce_rest_api-create-account",
10
+ name: "Create Account",
11
+ description: toSingleLineString(`
12
+ Creates a Salesforce account, representing an individual account,
13
+ which is an organization or person involved with your business (such as customers, competitors, and partners).
14
+ See [Account SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_account.htm)
15
+ and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm)
16
+ `),
17
+ version: "0.2.2",
18
+ type: "action",
19
+ props: {
20
+ salesforce,
21
+ Name: {
22
+ type: "string",
23
+ label: "Name",
24
+ description: "Name of the account.",
25
+ },
26
+ selector: {
27
+ propDefinition: [
28
+ salesforce,
29
+ "fieldSelector",
30
+ ],
31
+ description: `${salesforce.propDefinitions.fieldSelector.description} Account`,
32
+ options: () => Object.keys(account),
33
+ reloadProps: true,
34
+ },
35
+ },
36
+ async additionalProps() {
37
+ return this.salesforce.additionalProps(this.selector, account);
38
+ },
39
+ async run({ $ }) {
40
+ const data = pickBy(pick(this, [
41
+ "Name",
42
+ ...this.selector,
43
+ ]));
44
+ const response = await this.salesforce.createAccount({
45
+ $,
46
+ data,
47
+ });
48
+ $.export("$summary", `Successfully created account "${this.Name}"`);
49
+ return response;
50
+ },
51
+ };
@@ -0,0 +1,62 @@
1
+ import salesforce from "../../salesforce_rest_api.app.mjs";
2
+ import attachment from "../../common/sobjects/attachment.mjs";
3
+ import {
4
+ pickBy, pick,
5
+ } from "lodash-es";
6
+ import { toSingleLineString } from "../../common/utils.mjs";
7
+
8
+ export default {
9
+ key: "salesforce_rest_api-create-attachment",
10
+ name: "Create Attachment",
11
+ description: toSingleLineString(`
12
+ Creates an attachment, which represents a file that a User has uploaded and attached to a parent object.
13
+ See [Attachment SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_attachment.htm)
14
+ and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm)
15
+ `),
16
+ version: "0.3.2",
17
+ type: "action",
18
+ props: {
19
+ salesforce,
20
+ Body: {
21
+ type: "string",
22
+ label: "Body",
23
+ description: "Encoded file data.",
24
+ },
25
+ Name: {
26
+ type: "string",
27
+ label: "Name",
28
+ description: "Name of the attached file. Maximum size is 255 characters.",
29
+ },
30
+ ParentId: {
31
+ type: "string",
32
+ label: "Parent ID",
33
+ 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",
34
+ },
35
+ selector: {
36
+ propDefinition: [
37
+ salesforce,
38
+ "fieldSelector",
39
+ ],
40
+ description: `${salesforce.propDefinitions.fieldSelector.description} Attachment`,
41
+ options: () => Object.keys(attachment),
42
+ reloadProps: true,
43
+ },
44
+ },
45
+ async additionalProps() {
46
+ return this.salesforce.additionalProps(this.selector, attachment);
47
+ },
48
+ async run({ $ }) {
49
+ const data = pickBy(pick(this, [
50
+ "Body",
51
+ "Name",
52
+ "ParentId",
53
+ ...this.selector,
54
+ ]));
55
+ const response = await this.salesforce.createAttachment({
56
+ $,
57
+ data,
58
+ });
59
+ $.export("$summary", `Successfully created attachment "${this.Name}"`);
60
+ return response;
61
+ },
62
+ };
@@ -0,0 +1,51 @@
1
+ import salesforce from "../../salesforce_rest_api.app.mjs";
2
+ import campaign from "../../common/sobjects/campaign.mjs";
3
+ import {
4
+ pickBy, pick,
5
+ } from "lodash-es";
6
+ import { toSingleLineString } from "../../common/utils.mjs";
7
+
8
+ export default {
9
+ key: "salesforce_rest_api-create-campaign",
10
+ name: "Create Campaign",
11
+ description: toSingleLineString(`
12
+ Creates a marketing campaign, such as a direct mail promotion, webinar, or trade show.
13
+ See [Campaign SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_campaign.htm)
14
+ and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm)
15
+ `),
16
+ version: "0.2.2",
17
+ type: "action",
18
+ props: {
19
+ salesforce,
20
+ Name: {
21
+ type: "string",
22
+ label: "Name",
23
+ description: "Required. Name of the campaign. Limit: is 80 characters.",
24
+ },
25
+ selector: {
26
+ propDefinition: [
27
+ salesforce,
28
+ "fieldSelector",
29
+ ],
30
+ description: `${salesforce.propDefinitions.fieldSelector.description} Campaign`,
31
+ options: () => Object.keys(campaign),
32
+ reloadProps: true,
33
+ optional: true,
34
+ },
35
+ },
36
+ async additionalProps() {
37
+ return this.salesforce.additionalProps(this.selector, campaign);
38
+ },
39
+ async run({ $ }) {
40
+ const data = pickBy(pick(this, [
41
+ "Name",
42
+ ...this.selector,
43
+ ]));
44
+ const response = await this.salesforce.createCampaign({
45
+ $,
46
+ data,
47
+ });
48
+ $.export("$summary", `Created campaign "${this.Name}"`);
49
+ return response;
50
+ },
51
+ };
@@ -0,0 +1,50 @@
1
+ import salesforce from "../../salesforce_rest_api.app.mjs";
2
+ import salesforceCase from "../../common/sobjects/case.mjs";
3
+ import {
4
+ pickBy, pick,
5
+ } from "lodash-es";
6
+ import { toSingleLineString } from "../../common/utils.mjs";
7
+
8
+ export default {
9
+ key: "salesforce_rest_api-create-case",
10
+ name: "Create Case",
11
+ description: toSingleLineString(`
12
+ Creates a Salesforce case, which represents a customer issue or problem.
13
+ See [Case SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_case.htm)
14
+ and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm)
15
+ `),
16
+ version: "0.2.2",
17
+ type: "action",
18
+ props: {
19
+ salesforce,
20
+ SuppliedEmail: {
21
+ type: "string",
22
+ label: "Supplied email",
23
+ 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.",
24
+ },
25
+ selector: {
26
+ propDefinition: [
27
+ salesforce,
28
+ "fieldSelector",
29
+ ],
30
+ description: `${salesforce.propDefinitions.fieldSelector.description} Case`,
31
+ options: () => Object.keys(salesforceCase),
32
+ reloadProps: true,
33
+ },
34
+ },
35
+ async additionalProps() {
36
+ return this.salesforce.additionalProps(this.selector, salesforceCase);
37
+ },
38
+ async run({ $ }) {
39
+ const data = pickBy(pick(this, [
40
+ "SuppliedEmail",
41
+ ...this.selector,
42
+ ]));
43
+ const response = await this.salesforce.createCase({
44
+ $,
45
+ data,
46
+ });
47
+ $.export("$summary", `Successfully created case for ${this.SuppliedEmail}`);
48
+ return response;
49
+ },
50
+ };
@@ -0,0 +1,50 @@
1
+ import salesforce from "../../salesforce_rest_api.app.mjs";
2
+ import caseComment from "../../common/sobjects/caseComment.mjs";
3
+ import {
4
+ pickBy, pick,
5
+ } from "lodash-es";
6
+ import { toSingleLineString } from "../../common/utils.mjs";
7
+
8
+ export default {
9
+ key: "salesforce_rest_api-create-casecomment",
10
+ name: "Create CaseComment",
11
+ description: toSingleLineString(`
12
+ Creates a Case Comment that provides additional information about the associated Case.
13
+ See [CaseComment SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_casecomment.htm)
14
+ and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm)
15
+ `),
16
+ version: "0.2.2",
17
+ type: "action",
18
+ props: {
19
+ salesforce,
20
+ ParentId: {
21
+ type: "string",
22
+ label: "Parent ID",
23
+ description: "Required. ID of the parent Case of the CaseComment.",
24
+ },
25
+ selector: {
26
+ propDefinition: [
27
+ salesforce,
28
+ "fieldSelector",
29
+ ],
30
+ description: `${salesforce.propDefinitions.fieldSelector.description} CaseComment`,
31
+ options: () => Object.keys(caseComment),
32
+ reloadProps: true,
33
+ },
34
+ },
35
+ async additionalProps() {
36
+ return this.salesforce.additionalProps(this.selector, caseComment);
37
+ },
38
+ async run({ $ }) {
39
+ const data = pickBy(pick(this, [
40
+ "ParentId",
41
+ ...this.selector,
42
+ ]));
43
+ const response = await this.salesforce.createCaseComment({
44
+ $,
45
+ data,
46
+ });
47
+ $.export("$summary", `Successfully created case comment for ${this.ParentId}`);
48
+ return response;
49
+ },
50
+ };
@@ -0,0 +1,50 @@
1
+ import salesforce from "../../salesforce_rest_api.app.mjs";
2
+ import contact from "../../common/sobjects/contact.mjs";
3
+ import {
4
+ pickBy, pick,
5
+ } from "lodash-es";
6
+ import { toSingleLineString } from "../../common/utils.mjs";
7
+
8
+ export default {
9
+ key: "salesforce_rest_api-create-contact",
10
+ name: "Create Contact",
11
+ description: toSingleLineString(`
12
+ Creates a Contact, which is a person associated with an account.
13
+ See [Contact SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_contact.htm)
14
+ and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm)
15
+ `),
16
+ version: "0.2.2",
17
+ type: "action",
18
+ props: {
19
+ salesforce,
20
+ LastName: {
21
+ type: "string",
22
+ label: "Last name",
23
+ description: "Last name of the contact up to 80 characters.",
24
+ },
25
+ selector: {
26
+ propDefinition: [
27
+ salesforce,
28
+ "fieldSelector",
29
+ ],
30
+ description: `${salesforce.propDefinitions.fieldSelector.description} Contact`,
31
+ options: () => Object.keys(contact),
32
+ reloadProps: true,
33
+ },
34
+ },
35
+ async additionalProps() {
36
+ return this.salesforce.additionalProps(this.selector, contact);
37
+ },
38
+ async run({ $ }) {
39
+ const data = pickBy(pick(this, [
40
+ "LastName",
41
+ ...this.selector,
42
+ ]));
43
+ const response = await this.salesforce.createContact({
44
+ $,
45
+ data,
46
+ });
47
+ $.export("$summary", `Successfully created contact "${this.LastName}"`);
48
+ return response;
49
+ },
50
+ };
@@ -0,0 +1,80 @@
1
+ import salesforce from "../../salesforce_rest_api.app.mjs";
2
+ import {
3
+ removeNullEntries, toSingleLineString,
4
+ } from "../../common/utils.mjs";
5
+
6
+ export default {
7
+ key: "salesforce_rest_api-create-event",
8
+ name: "Create Event",
9
+ description: toSingleLineString(`
10
+ Creates an event, which represents an event in the calendar.
11
+ See [Event SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_event.htm)
12
+ and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm)
13
+ `),
14
+ version: "0.2.2",
15
+ type: "action",
16
+ props: {
17
+ salesforce,
18
+ IsAllDayEvent: {
19
+ type: "boolean",
20
+ label: "All-Day Event",
21
+ description: "Indicates whether the ActivityDate field (true) or the ActivityDateTime field (false) is used to define the date or time of the event.",
22
+ reloadProps: true,
23
+ },
24
+ AcceptedEventInviteeIds: {
25
+ propDefinition: [
26
+ salesforce,
27
+ "AcceptedEventInviteeIds",
28
+ ],
29
+ },
30
+ Description: {
31
+ type: "string",
32
+ label: "Description",
33
+ description: "Contains a text description of the event. Limit: 32,000 characters.",
34
+ },
35
+ Subject: {
36
+ type: "string",
37
+ label: "Subject",
38
+ description: "The subject line of the event, such as Call, Email, or Meeting. Limit: 255 characters.",
39
+ },
40
+ },
41
+ async additionalProps() {
42
+ const props = {};
43
+ if (this.IsAllDayEvent) {
44
+ props.ActivityDate = {
45
+ type: "string",
46
+ label: "Due Date Only (YYYY/MM/DD)",
47
+ description: "Contains the event's due date if the IsAllDayEvent flag is set to true.",
48
+ };
49
+ } else {
50
+ props.ActivityDateTime = {
51
+ type: "string",
52
+ label: "Due Date Time",
53
+ 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.",
54
+ };
55
+ props.DurationInMinutes = {
56
+ type: "integer",
57
+ label: "Duration in minutes",
58
+ description: "Contains the event length, in minutes.",
59
+ };
60
+ }
61
+ return props;
62
+ },
63
+ async run({ $ }) {
64
+ const data = removeNullEntries({
65
+ IsAllDayEvent: this.IsAllDayEvent,
66
+ AcceptedEventInviteeIds: this.AcceptedEventInviteeIds,
67
+ Description: this.Description,
68
+ Subject: this.Subject,
69
+ ActivityDate: this.ActivityDate && new Date(this.ActivityDate).toUTCString(),
70
+ ActivityDateTime: this.ActivityDateTime,
71
+ DurationInMinutes: this.DurationInMinutes,
72
+ });
73
+ const response = await this.salesforce.createEvent({
74
+ $,
75
+ data,
76
+ });
77
+ $.export("$summary", "Succcessfully created event");
78
+ return response;
79
+ },
80
+ };
@@ -0,0 +1,56 @@
1
+ import salesforce from "../../salesforce_rest_api.app.mjs";
2
+ import lead from "../../common/sobjects/lead.mjs";
3
+ import {
4
+ pickBy, pick,
5
+ } from "lodash-es";
6
+ import { toSingleLineString } from "../../common/utils.mjs";
7
+
8
+ export default {
9
+ key: "salesforce_rest_api-create-lead",
10
+ name: "Create Lead",
11
+ description: toSingleLineString(`
12
+ Creates a lead, which represents a prospect or lead.
13
+ See [Lead SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_lead.htm)
14
+ and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm)
15
+ `),
16
+ version: "0.2.2",
17
+ type: "action",
18
+ props: {
19
+ salesforce,
20
+ Company: {
21
+ type: "string",
22
+ label: "Company",
23
+ 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.",
24
+ },
25
+ LastName: {
26
+ type: "string",
27
+ label: "Last name",
28
+ description: "Required. Last name of the lead up to 80 characters.",
29
+ },
30
+ selector: {
31
+ propDefinition: [
32
+ salesforce,
33
+ "fieldSelector",
34
+ ],
35
+ description: `${salesforce.propDefinitions.fieldSelector.description} Lead`,
36
+ options: () => Object.keys(lead),
37
+ reloadProps: true,
38
+ },
39
+ },
40
+ async additionalProps() {
41
+ return this.salesforce.additionalProps(this.selector, lead);
42
+ },
43
+ async run({ $ }) {
44
+ const data = pickBy(pick(this, [
45
+ "Company",
46
+ "LastName",
47
+ ...this.selector,
48
+ ]));
49
+ const response = await this.salesforce.createLead({
50
+ $,
51
+ data,
52
+ });
53
+ $.export("$summary", `Successfully created lead for ${this.Company}`);
54
+ return response;
55
+ },
56
+ };
@@ -0,0 +1,56 @@
1
+ import salesforce from "../../salesforce_rest_api.app.mjs";
2
+ import note from "../../common/sobjects/note.mjs";
3
+ import {
4
+ pickBy, pick,
5
+ } from "lodash-es";
6
+ import { toSingleLineString } from "../../common/utils.mjs";
7
+
8
+ export default {
9
+ key: "salesforce_rest_api-create-note",
10
+ name: "Create Note",
11
+ description: toSingleLineString(`
12
+ Creates a note, which is text associated with a custom object or a standard object, such as a Contact, Contract, or Opportunity.
13
+ See [Note SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_note.htm)
14
+ and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm)
15
+ `),
16
+ version: "0.2.2",
17
+ type: "action",
18
+ props: {
19
+ salesforce,
20
+ ParentId: {
21
+ type: "string",
22
+ label: "Parent ID",
23
+ description: "ID of the object associated with the note.",
24
+ },
25
+ Title: {
26
+ type: "string",
27
+ label: "Title",
28
+ description: "Title of the note.",
29
+ },
30
+ selector: {
31
+ propDefinition: [
32
+ salesforce,
33
+ "fieldSelector",
34
+ ],
35
+ description: `${salesforce.propDefinitions.fieldSelector.description} Note`,
36
+ options: () => Object.keys(note),
37
+ reloadProps: true,
38
+ },
39
+ },
40
+ async additionalProps() {
41
+ return this.salesforce.additionalProps(this.selector, note);
42
+ },
43
+ async run({ $ }) {
44
+ const data = pickBy(pick(this, [
45
+ "ParentId",
46
+ "Title",
47
+ ...this.selector,
48
+ ]));
49
+ const response = await this.salesforce.createNote({
50
+ $,
51
+ data,
52
+ });
53
+ $.export("$summary", `Successfully created note "${this.Title}"`);
54
+ return response;
55
+ },
56
+ };
@@ -0,0 +1,62 @@
1
+ import salesforce from "../../salesforce_rest_api.app.mjs";
2
+ import opportunity from "../../common/sobjects/opportunity.mjs";
3
+ import {
4
+ pickBy, pick,
5
+ } from "lodash-es";
6
+ import { toSingleLineString } from "../../common/utils.mjs";
7
+
8
+ export default {
9
+ key: "salesforce_rest_api-create-opportunity",
10
+ name: "Create Opportunity",
11
+ description: toSingleLineString(`
12
+ Creates an opportunity, which represents an opportunity, which is a sale or pending deal.
13
+ See [Opportunity SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_opportunity.htm)
14
+ and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm)
15
+ `),
16
+ version: "0.2.2",
17
+ type: "action",
18
+ props: {
19
+ salesforce,
20
+ CloseDate: {
21
+ type: "string",
22
+ label: "Close date",
23
+ description: "Date when the opportunity is expected to close.",
24
+ },
25
+ Name: {
26
+ type: "string",
27
+ label: "Name",
28
+ description: "A name for this opportunity. Limit: 120 characters.",
29
+ },
30
+ StageName: {
31
+ type: "string",
32
+ label: "StageName",
33
+ 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.",
34
+ },
35
+ selector: {
36
+ propDefinition: [
37
+ salesforce,
38
+ "fieldSelector",
39
+ ],
40
+ description: `${salesforce.propDefinitions.fieldSelector.description} Opportunity`,
41
+ options: () => Object.keys(opportunity),
42
+ reloadProps: true,
43
+ },
44
+ },
45
+ async additionalProps() {
46
+ return this.salesforce.additionalProps(this.selector, opportunity);
47
+ },
48
+ async run({ $ }) {
49
+ const data = pickBy(pick(this, [
50
+ "CloseDate",
51
+ "Name",
52
+ "StageName",
53
+ ...this.selector,
54
+ ]));
55
+ const response = await this.salesforce.createOpportunity({
56
+ $,
57
+ data,
58
+ });
59
+ $.export("$summary", `Successfully created opportunity "${this.Name}"`);
60
+ return response;
61
+ },
62
+ };
@@ -0,0 +1,36 @@
1
+ import salesforce from "../../salesforce_rest_api.app.mjs";
2
+ import { toSingleLineString } from "../../common/utils.mjs";
3
+
4
+ export default {
5
+ key: "salesforce_rest_api-create-record",
6
+ name: "Create Record",
7
+ description: toSingleLineString(`
8
+ Create new records of a given resource.
9
+ See [docs](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_create.htm)
10
+ `),
11
+ version: "0.2.2",
12
+ type: "action",
13
+ props: {
14
+ salesforce,
15
+ objectType: {
16
+ propDefinition: [
17
+ salesforce,
18
+ "objectType",
19
+ ],
20
+ description: "SObject Type for this record",
21
+ },
22
+ sobject: {
23
+ type: "object",
24
+ label: "SObject fields and values",
25
+ description: "Data of the SObject record to create",
26
+ },
27
+ },
28
+ async run({ $ }) {
29
+ const response = await this.salesforce.createRecord(this.objectType, {
30
+ $,
31
+ data: this.sobject,
32
+ });
33
+ $.export("$summary", `Created record "${this.objectType}"`);
34
+ return response;
35
+ },
36
+ };
@@ -0,0 +1,56 @@
1
+ import salesforce from "../../salesforce_rest_api.app.mjs";
2
+ import task from "../../common/sobjects/task.mjs";
3
+ import {
4
+ pickBy, pick,
5
+ } from "lodash-es";
6
+ import { toSingleLineString } from "../../common/utils.mjs";
7
+
8
+ export default {
9
+ key: "salesforce_rest_api-create-task",
10
+ name: "Create Task",
11
+ description: toSingleLineString(`
12
+ Creates a task, which represents a business activity such as making a phone call or other to-do items.
13
+ See [Task SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_task.htm)
14
+ and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm)
15
+ `),
16
+ version: "0.3.2",
17
+ type: "action",
18
+ props: {
19
+ salesforce,
20
+ Priority: {
21
+ type: "string",
22
+ label: "Priority",
23
+ description: "Required. Indicates the importance or urgency of a task, such as high or low.",
24
+ },
25
+ Status: {
26
+ type: "string",
27
+ label: "Status",
28
+ 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).",
29
+ },
30
+ selector: {
31
+ propDefinition: [
32
+ salesforce,
33
+ "fieldSelector",
34
+ ],
35
+ description: `${salesforce.propDefinitions.fieldSelector.description} Task`,
36
+ options: () => Object.keys(task),
37
+ reloadProps: true,
38
+ },
39
+ },
40
+ async additionalProps() {
41
+ return this.salesforce.additionalProps(this.selector, task);
42
+ },
43
+ async run({ $ }) {
44
+ const data = pickBy(pick(this, [
45
+ "Priority",
46
+ "Status",
47
+ ...this.selector,
48
+ ]));
49
+ const response = await this.salesforce.createTask({
50
+ $,
51
+ data,
52
+ });
53
+ $.export("$summary", "Successfully created task");
54
+ return response;
55
+ },
56
+ };