@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,52 +1,67 @@
|
|
|
1
|
-
import
|
|
1
|
+
import salesforce from "../../salesforce_rest_api.app.mjs";
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
key: "salesforce_rest_api-find-records",
|
|
5
|
-
name: "
|
|
5
|
+
name: "Find Records",
|
|
6
6
|
description:
|
|
7
|
-
"Retrieves
|
|
8
|
-
version: "0.
|
|
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.0",
|
|
9
9
|
type: "action",
|
|
10
10
|
props: {
|
|
11
|
-
|
|
11
|
+
salesforce,
|
|
12
12
|
sobjectType: {
|
|
13
13
|
propDefinition: [
|
|
14
|
-
|
|
14
|
+
salesforce,
|
|
15
15
|
"objectType",
|
|
16
16
|
],
|
|
17
|
+
description: "The type of object to obtain records of.",
|
|
17
18
|
},
|
|
18
|
-
|
|
19
|
+
fieldsToObtain: {
|
|
19
20
|
propDefinition: [
|
|
20
|
-
|
|
21
|
-
"
|
|
21
|
+
salesforce,
|
|
22
|
+
"fieldsToObtain",
|
|
22
23
|
(c) => ({
|
|
23
|
-
|
|
24
|
+
objType: c.sobjectType,
|
|
24
25
|
}),
|
|
25
26
|
],
|
|
26
|
-
type: "string[]",
|
|
27
27
|
},
|
|
28
|
-
|
|
28
|
+
recordIds: {
|
|
29
|
+
propDefinition: [
|
|
30
|
+
salesforce,
|
|
31
|
+
"recordId",
|
|
32
|
+
(c) => ({
|
|
33
|
+
objType: c.sobjectType,
|
|
34
|
+
}),
|
|
35
|
+
],
|
|
36
|
+
label: "Record ID(s)",
|
|
29
37
|
type: "string[]",
|
|
30
|
-
|
|
38
|
+
optional: true,
|
|
31
39
|
description:
|
|
32
|
-
"
|
|
40
|
+
"The record(s) to retrieve. If not specified, all records will be retrieved.",
|
|
33
41
|
},
|
|
34
42
|
},
|
|
35
43
|
async run({ $ }) {
|
|
36
|
-
|
|
44
|
+
let {
|
|
37
45
|
sobjectType,
|
|
38
|
-
|
|
39
|
-
|
|
46
|
+
recordIds,
|
|
47
|
+
fieldsToObtain,
|
|
40
48
|
} = this;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if (
|
|
48
|
-
|
|
49
|
+
|
|
50
|
+
if (typeof recordIds === "string") recordIds = recordIds.split(",");
|
|
51
|
+
if (typeof fieldsToObtain === "string") fieldsToObtain = fieldsToObtain.split(",");
|
|
52
|
+
|
|
53
|
+
let query = `SELECT ${fieldsToObtain.join(", ")} FROM ${sobjectType}`;
|
|
54
|
+
|
|
55
|
+
if (recordIds?.length) {
|
|
56
|
+
query += ` WHERE Id IN ('${recordIds.join("','")}')`;
|
|
49
57
|
}
|
|
50
|
-
|
|
58
|
+
|
|
59
|
+
const { records } = await this.salesforce.query({
|
|
60
|
+
$,
|
|
61
|
+
query,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
$.export("$summary", `Sucessfully retrieved ${records.length} records`);
|
|
65
|
+
return records;
|
|
51
66
|
},
|
|
52
67
|
};
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import salesforce from "../../salesforce_rest_api.app.mjs";
|
|
2
|
-
import { toSingleLineString } from "../../common/utils.mjs";
|
|
3
2
|
|
|
4
3
|
export default {
|
|
5
4
|
key: "salesforce_rest_api-insert-blob-data",
|
|
6
5
|
name: "Insert Blob Data",
|
|
7
|
-
description:
|
|
8
|
-
|
|
9
|
-
See [docs](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_insert_update_blob.htm)
|
|
10
|
-
`),
|
|
11
|
-
version: "0.2.7",
|
|
6
|
+
description: "Inserts blob data in Salesforce standard objects. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_insert_update_blob.htm)",
|
|
7
|
+
version: "0.2.8",
|
|
12
8
|
type: "action",
|
|
13
9
|
props: {
|
|
14
10
|
salesforce,
|
|
@@ -71,7 +67,7 @@ export default {
|
|
|
71
67
|
headers,
|
|
72
68
|
data,
|
|
73
69
|
});
|
|
74
|
-
$.export("$summary", `
|
|
70
|
+
$.export("$summary", `Successfully inserted blob data in ${this.sobjectName}`);
|
|
75
71
|
return response;
|
|
76
72
|
},
|
|
77
73
|
};
|
|
@@ -1,39 +1,64 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { toSingleLineString } from "../../common/utils.mjs";
|
|
1
|
+
import salesforce from "../../salesforce_rest_api.app.mjs";
|
|
3
2
|
|
|
4
3
|
export default {
|
|
5
4
|
key: "salesforce_rest_api-post-feed-to-chatter",
|
|
6
5
|
name: "Post a Message to Chatter Feed",
|
|
7
|
-
description:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
`),
|
|
11
|
-
version: "0.0.6",
|
|
6
|
+
description:
|
|
7
|
+
"Post a feed item in Chatter. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/quickreference_post_feed_item.htm)",
|
|
8
|
+
version: "0.1.0",
|
|
12
9
|
type: "action",
|
|
13
10
|
props: {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
salesforce,
|
|
12
|
+
sobjectType: {
|
|
13
|
+
propDefinition: [
|
|
14
|
+
salesforce,
|
|
15
|
+
"objectType",
|
|
16
|
+
],
|
|
17
|
+
description: "The type of object to select a record from.",
|
|
19
18
|
},
|
|
20
19
|
subjectId: {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
propDefinition: [
|
|
21
|
+
salesforce,
|
|
22
|
+
"recordId",
|
|
23
|
+
(c) => ({
|
|
24
|
+
objType: c.sobjectType,
|
|
25
|
+
}),
|
|
26
|
+
],
|
|
27
|
+
description: "The record that will parent the feed item.",
|
|
28
|
+
},
|
|
29
|
+
messageSegments: {
|
|
30
|
+
label: "Message segments",
|
|
31
|
+
description:
|
|
32
|
+
"Each message segment can be a text string, which will be treated as a segment of `type: Text`, or a [message segment object](https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_requests_message_body_input.htm) such as `{ \"type\": \"Mention\", \"username\": \"john\" }`",
|
|
33
|
+
type: "string[]",
|
|
24
34
|
},
|
|
25
35
|
},
|
|
26
36
|
async run({ $ }) {
|
|
27
|
-
const
|
|
28
|
-
text: this.text,
|
|
37
|
+
const data = {
|
|
29
38
|
subjectId: this.subjectId,
|
|
30
39
|
feedElementType: "FeedItem",
|
|
40
|
+
body: {
|
|
41
|
+
messageSegments: this.messageSegments.map((segment) => {
|
|
42
|
+
if (typeof segment === "string") {
|
|
43
|
+
try {
|
|
44
|
+
return JSON.parse(segment);
|
|
45
|
+
} catch (err) {
|
|
46
|
+
return {
|
|
47
|
+
type: "Text",
|
|
48
|
+
text: segment,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return segment;
|
|
54
|
+
}),
|
|
55
|
+
},
|
|
31
56
|
};
|
|
32
|
-
const response = await this.
|
|
57
|
+
const response = await this.salesforce.postFeed({
|
|
33
58
|
$,
|
|
34
|
-
|
|
59
|
+
data,
|
|
35
60
|
});
|
|
36
|
-
response && $.export("$summary", "Successfully
|
|
61
|
+
response && $.export("$summary", "Successfully posted feed item");
|
|
37
62
|
return response;
|
|
38
63
|
},
|
|
39
64
|
};
|
|
@@ -1,19 +1,25 @@
|
|
|
1
|
-
import
|
|
1
|
+
import salesforce from "../../salesforce_rest_api.app.mjs";
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
key: "salesforce_rest_api-search-string",
|
|
5
5
|
name: "Search Object Records",
|
|
6
6
|
description:
|
|
7
|
-
"Searches for records in an object using a parameterized search. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/
|
|
8
|
-
version: "0.0.
|
|
7
|
+
"Searches for records in an object using a parameterized search. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_search_parameterized_get.htm)",
|
|
8
|
+
version: "0.0.2",
|
|
9
9
|
type: "action",
|
|
10
10
|
props: {
|
|
11
|
-
|
|
11
|
+
salesforce,
|
|
12
|
+
infoBox: {
|
|
13
|
+
type: "alert",
|
|
14
|
+
alertType: "info",
|
|
15
|
+
content: "If you need a more flexible search, consider using the **SOQL Search** or **SOSL Search** actions instead.",
|
|
16
|
+
},
|
|
12
17
|
sobjectType: {
|
|
13
18
|
propDefinition: [
|
|
14
|
-
|
|
19
|
+
salesforce,
|
|
15
20
|
"objectType",
|
|
16
21
|
],
|
|
22
|
+
description: "The type of object to search for records.",
|
|
17
23
|
},
|
|
18
24
|
searchTerm: {
|
|
19
25
|
type: "string",
|
|
@@ -22,9 +28,9 @@ export default {
|
|
|
22
28
|
},
|
|
23
29
|
fields: {
|
|
24
30
|
type: "string[]",
|
|
25
|
-
label: "Fields
|
|
31
|
+
label: "Fields",
|
|
26
32
|
description:
|
|
27
|
-
"List of the Salesforce object's fields to get values from
|
|
33
|
+
"List of the Salesforce object's fields to get values from, such as `Id` or `Name`.",
|
|
28
34
|
},
|
|
29
35
|
},
|
|
30
36
|
async run({ $ }) {
|
|
@@ -33,21 +39,17 @@ export default {
|
|
|
33
39
|
searchTerm,
|
|
34
40
|
fields,
|
|
35
41
|
} = this;
|
|
36
|
-
|
|
37
|
-
|
|
42
|
+
|
|
43
|
+
const response = await this.salesforce.parameterizedSearch({
|
|
44
|
+
$,
|
|
45
|
+
params: {
|
|
38
46
|
q: searchTerm,
|
|
39
47
|
sobject: sobjectType,
|
|
40
48
|
fields: fields.join(","),
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
} catch (error) {
|
|
47
|
-
console.error(error);
|
|
48
|
-
$.export("$summary", "Search failed");
|
|
49
|
-
$.export("results_found", 0);
|
|
50
|
-
throw new Error(`Search failed: ${error.message}`);
|
|
51
|
-
}
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
const resultsFound = response.searchRecords.length;
|
|
52
|
+
$.export("$summary", `Sucessfully found ${resultsFound} results`);
|
|
53
|
+
return response;
|
|
52
54
|
},
|
|
53
55
|
};
|
|
@@ -1,21 +1,26 @@
|
|
|
1
|
-
import { toSingleLineString } from "../../common/utils.mjs";
|
|
2
1
|
import salesforce from "../../salesforce_rest_api.app.mjs";
|
|
2
|
+
import { docsInfo } from "../sosl-search/sosl-search.mjs";
|
|
3
|
+
|
|
4
|
+
const docsLink = "https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_examples.htm";
|
|
3
5
|
|
|
4
6
|
export default {
|
|
5
7
|
key: "salesforce_rest_api-soql-search",
|
|
6
|
-
name: "SOQL
|
|
7
|
-
description:
|
|
8
|
-
|
|
9
|
-
See [docs](https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql.htm)
|
|
10
|
-
`),
|
|
11
|
-
version: "0.2.8",
|
|
8
|
+
name: "SOQL Query (Object Query)",
|
|
9
|
+
description: `Executes a [Salesforce Object Query Language (SOQL)](${docsLink}) query-based, SQL-like search.`,
|
|
10
|
+
version: "0.2.9",
|
|
12
11
|
type: "action",
|
|
13
12
|
props: {
|
|
14
13
|
salesforce,
|
|
14
|
+
docsInfo,
|
|
15
|
+
exampleInfo: {
|
|
16
|
+
type: "alert",
|
|
17
|
+
alertType: "info",
|
|
18
|
+
content: "Example query: `SELECT Id, Name, BillingCity FROM Account`",
|
|
19
|
+
},
|
|
15
20
|
query: {
|
|
16
21
|
type: "string",
|
|
17
22
|
label: "SOQL Query",
|
|
18
|
-
description:
|
|
23
|
+
description: `A SOQL search query. [See the documentation](${docsLink}) for examples and more information.`,
|
|
19
24
|
},
|
|
20
25
|
},
|
|
21
26
|
async run({ $ }) {
|
|
@@ -1,21 +1,31 @@
|
|
|
1
1
|
import salesforce from "../../salesforce_rest_api.app.mjs";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
const docsLink = "https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_sosl_examples.htm";
|
|
4
|
+
|
|
5
|
+
export const docsInfo = {
|
|
6
|
+
type: "alert",
|
|
7
|
+
alertType: "info",
|
|
8
|
+
content: "You can find helpful information on SOQL and SOSL in [the Salesforce documentation](https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_sosl_intro.htm).",
|
|
9
|
+
};
|
|
3
10
|
|
|
4
11
|
export default {
|
|
5
12
|
key: "salesforce_rest_api-sosl-search",
|
|
6
|
-
name: "SOSL Search",
|
|
7
|
-
description:
|
|
8
|
-
|
|
9
|
-
See [docs](https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_sosl.htm)
|
|
10
|
-
`),
|
|
11
|
-
version: "0.2.7",
|
|
13
|
+
name: "SOSL Search (Object Search)",
|
|
14
|
+
description: `Executes a [Salesforce Object Search Language (SOSL)](${docsLink}) text-based search query.`,
|
|
15
|
+
version: "0.2.8",
|
|
12
16
|
type: "action",
|
|
13
17
|
props: {
|
|
14
18
|
salesforce,
|
|
19
|
+
docsInfo,
|
|
20
|
+
exampleInfo: {
|
|
21
|
+
type: "alert",
|
|
22
|
+
alertType: "info",
|
|
23
|
+
content: "Example search: `FIND {Joe Smith} IN Name Fields RETURNING lead(name, phone)`",
|
|
24
|
+
},
|
|
15
25
|
search: {
|
|
16
26
|
type: "string",
|
|
17
27
|
label: "SOSL Query",
|
|
18
|
-
description:
|
|
28
|
+
description: `A SOSL search query. [See the documentation](${docsLink}) for examples and more information.`,
|
|
19
29
|
},
|
|
20
30
|
},
|
|
21
31
|
async run({ $ }) {
|
|
@@ -23,7 +33,7 @@ export default {
|
|
|
23
33
|
$,
|
|
24
34
|
search: this.search,
|
|
25
35
|
});
|
|
26
|
-
$.export("$summary",
|
|
36
|
+
$.export("$summary", `Successfully returned ${response.searchRecords?.length} results for SOSL search`);
|
|
27
37
|
return response;
|
|
28
38
|
},
|
|
29
39
|
};
|
|
@@ -1,62 +1,75 @@
|
|
|
1
|
-
import common from "../common/base.mjs";
|
|
1
|
+
import common, { getProps } from "../common/base-create-update.mjs";
|
|
2
2
|
import account from "../../common/sobjects/account.mjs";
|
|
3
|
-
import {
|
|
4
|
-
pickBy, pick,
|
|
5
|
-
} from "lodash-es";
|
|
6
|
-
import { toSingleLineString } from "../../common/utils.mjs";
|
|
3
|
+
import { docsLink } from "../create-account/create-account.mjs";
|
|
7
4
|
|
|
8
|
-
const {
|
|
5
|
+
const {
|
|
6
|
+
salesforce, ...props
|
|
7
|
+
} = getProps({
|
|
8
|
+
createOrUpdate: "update",
|
|
9
|
+
objType: account,
|
|
10
|
+
docsLink,
|
|
11
|
+
});
|
|
9
12
|
|
|
10
13
|
export default {
|
|
11
14
|
...common,
|
|
12
15
|
key: "salesforce_rest_api-update-account",
|
|
13
16
|
name: "Update Account",
|
|
14
|
-
description:
|
|
15
|
-
|
|
16
|
-
which is an organization or person involved with your business (such as customers, competitors, and partners).
|
|
17
|
-
See [Account SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_account.htm)
|
|
18
|
-
and [Update Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_update_fields.htm)
|
|
19
|
-
`),
|
|
20
|
-
version: "0.2.7",
|
|
17
|
+
description: `Updates a Salesforce account. [See the documentation](${docsLink})`,
|
|
18
|
+
version: "0.3.0",
|
|
21
19
|
type: "action",
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
label: "Account ID",
|
|
27
|
-
description: "ID of the Account to modify.",
|
|
20
|
+
methods: {
|
|
21
|
+
...common.methods,
|
|
22
|
+
getObjectType() {
|
|
23
|
+
return "Account";
|
|
28
24
|
},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
label: "Name",
|
|
32
|
-
description: "Name of the account. Maximum size is 255 characters. If the account has a record type of Person Account:\nThis value is the concatenation of the FirstName, MiddleName, LastName, and Suffix of the associated person contact.",
|
|
33
|
-
optional: true,
|
|
25
|
+
getAdvancedProps() {
|
|
26
|
+
return account.extraProps;
|
|
34
27
|
},
|
|
35
|
-
|
|
28
|
+
},
|
|
29
|
+
props: {
|
|
30
|
+
salesforce,
|
|
31
|
+
accountId: {
|
|
36
32
|
propDefinition: [
|
|
37
33
|
salesforce,
|
|
38
|
-
"
|
|
34
|
+
"recordId",
|
|
35
|
+
() => ({
|
|
36
|
+
objType: "Account",
|
|
37
|
+
nameField: "Name",
|
|
38
|
+
}),
|
|
39
39
|
],
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
reloadProps: true,
|
|
40
|
+
label: "Account ID",
|
|
41
|
+
description: "The Account to update.",
|
|
43
42
|
},
|
|
44
|
-
|
|
45
|
-
additionalProps() {
|
|
46
|
-
return this.additionalProps(this.selector, account);
|
|
43
|
+
...props,
|
|
47
44
|
},
|
|
48
45
|
async run({ $ }) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
46
|
+
/* eslint-disable no-unused-vars */
|
|
47
|
+
const {
|
|
48
|
+
salesforce,
|
|
49
|
+
getAdvancedProps,
|
|
50
|
+
getObjectType,
|
|
51
|
+
getAdditionalFields,
|
|
52
|
+
formatDateTimeProps,
|
|
53
|
+
accountId,
|
|
54
|
+
useAdvancedProps,
|
|
55
|
+
docsInfo,
|
|
56
|
+
dateInfo,
|
|
57
|
+
additionalFields,
|
|
58
|
+
...data
|
|
59
|
+
} = this;
|
|
60
|
+
/* eslint-enable no-unused-vars */
|
|
61
|
+
const response = await salesforce.updateRecord("Account", {
|
|
55
62
|
$,
|
|
56
|
-
id:
|
|
57
|
-
data
|
|
63
|
+
id: accountId,
|
|
64
|
+
data: {
|
|
65
|
+
...data,
|
|
66
|
+
...getAdditionalFields(),
|
|
67
|
+
},
|
|
58
68
|
});
|
|
59
|
-
$.export(
|
|
69
|
+
$.export(
|
|
70
|
+
"$summary",
|
|
71
|
+
`Successfully updated account (ID: ${this.accountId})`,
|
|
72
|
+
);
|
|
60
73
|
return response;
|
|
61
74
|
},
|
|
62
75
|
};
|
|
@@ -1,61 +1,80 @@
|
|
|
1
|
-
import common from "../common/base.mjs";
|
|
1
|
+
import common, { getProps } from "../common/base-create-update.mjs";
|
|
2
2
|
import contact from "../../common/sobjects/contact.mjs";
|
|
3
|
-
import {
|
|
4
|
-
pickBy, pick,
|
|
5
|
-
} from "lodash-es";
|
|
6
|
-
import { toSingleLineString } from "../../common/utils.mjs";
|
|
3
|
+
import { docsLink } from "../create-contact/create-contact.mjs";
|
|
7
4
|
|
|
8
|
-
const {
|
|
5
|
+
const {
|
|
6
|
+
salesforce, ...props
|
|
7
|
+
} = getProps({
|
|
8
|
+
createOrUpdate: "update",
|
|
9
|
+
objType: contact,
|
|
10
|
+
docsLink,
|
|
11
|
+
showDateInfo: true,
|
|
12
|
+
});
|
|
9
13
|
|
|
10
14
|
export default {
|
|
11
15
|
...common,
|
|
12
16
|
key: "salesforce_rest_api-update-contact",
|
|
13
17
|
name: "Update Contact",
|
|
14
|
-
description:
|
|
15
|
-
|
|
16
|
-
See [Contact SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_contact.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 a contact. [See the documentation](${docsLink})`,
|
|
19
|
+
version: "0.3.0",
|
|
20
20
|
type: "action",
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
label: "Contact ID",
|
|
26
|
-
description: "ID of the Contact to update.",
|
|
21
|
+
methods: {
|
|
22
|
+
...common.methods,
|
|
23
|
+
getObjectType() {
|
|
24
|
+
return "Contact";
|
|
27
25
|
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
label: "Last Name",
|
|
31
|
-
description: "Last name of the contact up to 80 characters.",
|
|
32
|
-
optional: true,
|
|
26
|
+
getAdvancedProps() {
|
|
27
|
+
return contact.extraProps;
|
|
33
28
|
},
|
|
34
|
-
|
|
29
|
+
},
|
|
30
|
+
props: {
|
|
31
|
+
salesforce,
|
|
32
|
+
contactId: {
|
|
35
33
|
propDefinition: [
|
|
36
34
|
salesforce,
|
|
37
|
-
"
|
|
35
|
+
"recordId",
|
|
36
|
+
() => ({
|
|
37
|
+
objType: "Contact",
|
|
38
|
+
nameField: "Name",
|
|
39
|
+
}),
|
|
38
40
|
],
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
reloadProps: true,
|
|
41
|
+
label: "Contact ID",
|
|
42
|
+
description: "The Contact to update.",
|
|
42
43
|
},
|
|
43
|
-
|
|
44
|
-
additionalProps() {
|
|
45
|
-
return this.additionalProps(this.selector, contact);
|
|
44
|
+
...props,
|
|
46
45
|
},
|
|
47
46
|
async run({ $ }) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
/* eslint-disable no-unused-vars */
|
|
48
|
+
const {
|
|
49
|
+
salesforce,
|
|
50
|
+
getAdvancedProps,
|
|
51
|
+
getObjectType,
|
|
52
|
+
getAdditionalFields,
|
|
53
|
+
formatDateTimeProps,
|
|
54
|
+
contactId,
|
|
55
|
+
useAdvancedProps,
|
|
56
|
+
docsInfo,
|
|
57
|
+
dateInfo,
|
|
58
|
+
additionalFields,
|
|
59
|
+
Birthdate,
|
|
60
|
+
...data
|
|
61
|
+
} = this;
|
|
62
|
+
/* eslint-enable no-unused-vars */
|
|
63
|
+
const response = await salesforce.updateRecord("Contact", {
|
|
54
64
|
$,
|
|
55
|
-
id:
|
|
56
|
-
data
|
|
65
|
+
id: contactId,
|
|
66
|
+
data: {
|
|
67
|
+
...data,
|
|
68
|
+
...formatDateTimeProps({
|
|
69
|
+
Birthdate,
|
|
70
|
+
}),
|
|
71
|
+
...getAdditionalFields(),
|
|
72
|
+
},
|
|
57
73
|
});
|
|
58
|
-
$.export(
|
|
74
|
+
$.export(
|
|
75
|
+
"$summary",
|
|
76
|
+
`Successfully updated contact (ID: ${this.contactId})`,
|
|
77
|
+
);
|
|
59
78
|
return response;
|
|
60
79
|
},
|
|
61
80
|
};
|