@pipedream/salesforce_rest_api 1.2.1 → 1.3.1
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.
- package/README.md +92 -0
- package/actions/add-contact-to-campaign/add-contact-to-campaign.mjs +25 -25
- package/actions/add-lead-to-campaign/add-lead-to-campaign.mjs +25 -24
- package/actions/common/base-create-update.mjs +108 -0
- package/actions/convert-soap-xml-to-json/convert-soap-xml-to-json.mjs +11 -3
- package/actions/create-account/create-account.mjs +33 -36
- package/actions/create-attachment/create-attachment.mjs +36 -50
- package/actions/create-campaign/create-campaign.mjs +41 -37
- package/actions/create-case/create-case.mjs +41 -37
- package/actions/create-casecomment/create-casecomment.mjs +26 -38
- package/actions/create-contact/create-contact.mjs +38 -35
- package/actions/create-event/create-event.mjs +57 -66
- package/actions/create-lead/create-lead.mjs +34 -42
- package/actions/create-note/create-note.mjs +24 -43
- package/actions/create-opportunity/create-opportunity.mjs +38 -47
- package/actions/create-record/create-record.mjs +49 -15
- package/actions/create-task/create-task.mjs +50 -42
- package/actions/create-user/create-user.mjs +33 -196
- package/actions/delete-opportunity/delete-opportunity.mjs +17 -13
- package/actions/delete-record/delete-record.mjs +18 -16
- package/actions/find-records/find-records.mjs +41 -26
- package/actions/insert-blob-data/insert-blob-data.mjs +3 -7
- package/actions/post-feed-to-chatter/post-feed-to-chatter.mjs +45 -20
- package/actions/search-string/search-string.mjs +22 -20
- package/actions/soql-search/soql-search.mjs +13 -8
- package/actions/sosl-search/sosl-search.mjs +19 -9
- package/actions/update-account/update-account.mjs +54 -41
- package/actions/update-contact/update-contact.mjs +59 -40
- package/actions/update-opportunity/update-opportunity.mjs +56 -54
- package/actions/update-record/update-record.mjs +67 -20
- package/common/all-sobjects.mjs +3812 -0
- package/common/constants-props.mjs +1539 -0
- package/common/props-async-options.mjs +154 -0
- package/common/props-utils.mjs +88 -31
- package/common/sobjects/account.mjs +349 -22
- package/common/sobjects/attachment.mjs +56 -17
- package/common/sobjects/campaign.mjs +125 -23
- package/common/sobjects/case.mjs +193 -13
- package/common/sobjects/caseComment.mjs +28 -4
- package/common/sobjects/contact.mjs +207 -43
- package/common/sobjects/event.mjs +218 -18
- package/common/sobjects/lead.mjs +245 -22
- package/common/sobjects/note.mjs +37 -14
- package/common/sobjects/opportunity.mjs +148 -22
- package/common/sobjects/task.mjs +240 -19
- package/common/sobjects/user.mjs +965 -0
- package/package.json +2 -2
- package/salesforce_rest_api.app.mjs +72 -249
- package/sources/common-webhook-methods.mjs +71 -0
- package/sources/common.mjs +85 -22
- package/sources/new-outbound-message/new-outbound-message.mjs +11 -3
- package/sources/new-record-instant/new-record-instant.mjs +95 -7
- package/sources/record-deleted-instant/record-deleted-instant.mjs +40 -5
- package/sources/record-updated-instant/record-updated-instant.mjs +137 -5
- package/actions/common/base.mjs +0 -18
- package/actions/find-create-record/find-create-record.mjs +0 -89
- package/actions/get-sobject-fields-values/get-sobject-fields-values.mjs +0 -57
- package/common/utils.mjs +0 -51
- package/sources/common-instant.mjs +0 -146
- package/sources/new-record/new-record.mjs +0 -91
- package/sources/record-deleted/record-deleted.mjs +0 -51
- package/sources/record-updated/record-updated.mjs +0 -94
- package/sources/updated-field-on-record/updated-field-on-record.mjs +0 -161
- package/sources/updated-field-on-record-instant/updated-field-on-record-instant.mjs +0 -76
|
@@ -1,75 +1,77 @@
|
|
|
1
|
-
import common from "../common/base.mjs";
|
|
1
|
+
import common, { getProps } from "../common/base-create-update.mjs";
|
|
2
2
|
import opportunity from "../../common/sobjects/opportunity.mjs";
|
|
3
|
-
import {
|
|
4
|
-
pickBy, pick,
|
|
5
|
-
} from "lodash-es";
|
|
6
|
-
import { toSingleLineString } from "../../common/utils.mjs";
|
|
3
|
+
import { docsLink } from "../create-opportunity/create-opportunity.mjs";
|
|
7
4
|
|
|
8
|
-
const {
|
|
5
|
+
const {
|
|
6
|
+
salesforce, ...props
|
|
7
|
+
} = getProps({
|
|
8
|
+
createOrUpdate: "update",
|
|
9
|
+
objType: opportunity,
|
|
10
|
+
docsLink,
|
|
11
|
+
showDateInfo: true,
|
|
12
|
+
});
|
|
9
13
|
|
|
10
14
|
export default {
|
|
11
15
|
...common,
|
|
12
16
|
key: "salesforce_rest_api-update-opportunity",
|
|
13
17
|
name: "Update Opportunity",
|
|
14
|
-
description:
|
|
15
|
-
|
|
16
|
-
See [Opportunity SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_opportunity.htm)
|
|
17
|
-
and [Update Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_update_fields.htm)
|
|
18
|
-
`),
|
|
19
|
-
version: "0.2.7",
|
|
18
|
+
description: `Updates an opportunity. [See the documentation](${docsLink})`,
|
|
19
|
+
version: "0.3.0",
|
|
20
20
|
type: "action",
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
label: "Opportunity ID",
|
|
26
|
-
description: "ID of the Opportunity to update.",
|
|
27
|
-
},
|
|
28
|
-
CloseDate: {
|
|
29
|
-
type: "string",
|
|
30
|
-
label: "CloseDate",
|
|
31
|
-
description: "Date when the opportunity is expected to close.",
|
|
32
|
-
optional: true,
|
|
33
|
-
},
|
|
34
|
-
Name: {
|
|
35
|
-
type: "string",
|
|
36
|
-
label: "Name",
|
|
37
|
-
description: "A name for this opportunity. Limit: 120 characters.",
|
|
38
|
-
optional: true,
|
|
21
|
+
methods: {
|
|
22
|
+
...common.methods,
|
|
23
|
+
getObjectType() {
|
|
24
|
+
return "Opportunity";
|
|
39
25
|
},
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
label: "StageName",
|
|
43
|
-
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.",
|
|
44
|
-
optional: true,
|
|
26
|
+
getAdvancedProps() {
|
|
27
|
+
return opportunity.extraProps;
|
|
45
28
|
},
|
|
46
|
-
|
|
29
|
+
},
|
|
30
|
+
props: {
|
|
31
|
+
salesforce,
|
|
32
|
+
opportunityId: {
|
|
47
33
|
propDefinition: [
|
|
48
34
|
salesforce,
|
|
49
|
-
"
|
|
35
|
+
"recordId",
|
|
36
|
+
() => ({
|
|
37
|
+
objType: "Opportunity",
|
|
38
|
+
nameField: "Name",
|
|
39
|
+
}),
|
|
50
40
|
],
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
reloadProps: true,
|
|
41
|
+
label: "Opportunity ID",
|
|
42
|
+
description: "The Opportunity to update.",
|
|
54
43
|
},
|
|
55
|
-
|
|
56
|
-
additionalProps() {
|
|
57
|
-
return this.additionalProps(this.selector, opportunity);
|
|
44
|
+
...props,
|
|
58
45
|
},
|
|
59
46
|
async run({ $ }) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
47
|
+
/* eslint-disable no-unused-vars */
|
|
48
|
+
const {
|
|
49
|
+
salesforce,
|
|
50
|
+
getAdvancedProps,
|
|
51
|
+
getObjectType,
|
|
52
|
+
getAdditionalFields,
|
|
53
|
+
formatDateTimeProps,
|
|
54
|
+
opportunityId,
|
|
55
|
+
useAdvancedProps,
|
|
56
|
+
docsInfo,
|
|
57
|
+
dateInfo,
|
|
58
|
+
additionalFields,
|
|
59
|
+
CloseDate,
|
|
60
|
+
...data
|
|
61
|
+
} = this;
|
|
62
|
+
/* eslint-enable no-unused-vars */
|
|
63
|
+
const response = await salesforce.updateRecord("Opportunity", {
|
|
68
64
|
$,
|
|
69
|
-
id:
|
|
70
|
-
data
|
|
65
|
+
id: opportunityId,
|
|
66
|
+
data: {
|
|
67
|
+
...data,
|
|
68
|
+
...formatDateTimeProps({
|
|
69
|
+
CloseDate,
|
|
70
|
+
}),
|
|
71
|
+
...getAdditionalFields(),
|
|
72
|
+
},
|
|
71
73
|
});
|
|
72
|
-
$.export("$summary", `Successfully updated opportunity ${
|
|
74
|
+
$.export("$summary", `Successfully updated opportunity (ID: ${opportunityId})`);
|
|
73
75
|
return response;
|
|
74
76
|
},
|
|
75
77
|
};
|
|
@@ -1,46 +1,93 @@
|
|
|
1
|
+
import {
|
|
2
|
+
convertFieldsToProps, getAdditionalFields,
|
|
3
|
+
} from "../../common/props-utils.mjs";
|
|
1
4
|
import salesforce from "../../salesforce_rest_api.app.mjs";
|
|
2
|
-
import {
|
|
5
|
+
import { additionalFields } from "../common/base-create-update.mjs";
|
|
3
6
|
|
|
4
7
|
export default {
|
|
5
8
|
key: "salesforce_rest_api-update-record",
|
|
6
9
|
name: "Update Record",
|
|
7
|
-
description:
|
|
8
|
-
|
|
9
|
-
[See docs here](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_update_fields.htm)
|
|
10
|
-
`),
|
|
11
|
-
version: "0.2.7",
|
|
10
|
+
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)",
|
|
11
|
+
version: "0.3.0",
|
|
12
12
|
type: "action",
|
|
13
13
|
props: {
|
|
14
14
|
salesforce,
|
|
15
|
-
|
|
15
|
+
sobjectType: {
|
|
16
16
|
propDefinition: [
|
|
17
17
|
salesforce,
|
|
18
18
|
"objectType",
|
|
19
19
|
],
|
|
20
|
-
description: "
|
|
20
|
+
description: "The type of object to update a record of.",
|
|
21
|
+
|
|
21
22
|
},
|
|
22
|
-
|
|
23
|
+
recordId: {
|
|
23
24
|
propDefinition: [
|
|
24
25
|
salesforce,
|
|
25
|
-
"
|
|
26
|
+
"recordId",
|
|
26
27
|
(c) => ({
|
|
27
|
-
|
|
28
|
+
objType: c.sobjectType,
|
|
28
29
|
}),
|
|
29
30
|
],
|
|
30
|
-
description:
|
|
31
|
+
description:
|
|
32
|
+
"The record to update.",
|
|
31
33
|
},
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
fieldsToUpdate: {
|
|
35
|
+
propDefinition: [
|
|
36
|
+
salesforce,
|
|
37
|
+
"fieldsToUpdate",
|
|
38
|
+
(c) => ({
|
|
39
|
+
objType: c.sobjectType,
|
|
40
|
+
}),
|
|
41
|
+
],
|
|
42
|
+
reloadProps: true,
|
|
36
43
|
},
|
|
37
44
|
},
|
|
45
|
+
methods: {
|
|
46
|
+
getAdditionalFields,
|
|
47
|
+
convertFieldsToProps,
|
|
48
|
+
},
|
|
49
|
+
async additionalProps() {
|
|
50
|
+
const {
|
|
51
|
+
sobjectType, fieldsToUpdate,
|
|
52
|
+
} = this;
|
|
53
|
+
const fields = await this.salesforce.getFieldsForObjectType(sobjectType);
|
|
54
|
+
|
|
55
|
+
const selectedFields = fields.filter(({ name }) => fieldsToUpdate.includes(name));
|
|
56
|
+
const selectedFieldProps = this.convertFieldsToProps(selectedFields);
|
|
57
|
+
|
|
58
|
+
return {
|
|
59
|
+
docsInfo: {
|
|
60
|
+
type: "alert",
|
|
61
|
+
alertType: "info",
|
|
62
|
+
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.`,
|
|
63
|
+
},
|
|
64
|
+
...selectedFieldProps,
|
|
65
|
+
additionalFields,
|
|
66
|
+
};
|
|
67
|
+
},
|
|
38
68
|
async run({ $ }) {
|
|
39
|
-
|
|
69
|
+
/* eslint-disable no-unused-vars */
|
|
70
|
+
const {
|
|
71
|
+
salesforce,
|
|
72
|
+
sobjectType,
|
|
73
|
+
recordId,
|
|
74
|
+
fieldsToUpdate,
|
|
75
|
+
getAdditionalFields: getData,
|
|
76
|
+
convertFieldsToProps,
|
|
77
|
+
docsInfo,
|
|
78
|
+
additionalFields,
|
|
79
|
+
...data
|
|
80
|
+
} = this;
|
|
81
|
+
/* eslint-enable no-unused-vars */
|
|
82
|
+
const response = await this.salesforce.updateRecord(sobjectType, {
|
|
40
83
|
$,
|
|
41
|
-
id:
|
|
42
|
-
data:
|
|
84
|
+
id: recordId,
|
|
85
|
+
data: {
|
|
86
|
+
...data,
|
|
87
|
+
...getData(),
|
|
88
|
+
},
|
|
43
89
|
});
|
|
44
|
-
$.export("$summary", `
|
|
90
|
+
$.export("$summary", `Successfully updated ${sobjectType} record (ID: ${recordId})`);
|
|
91
|
+
return response;
|
|
45
92
|
},
|
|
46
93
|
};
|