Skip to content

Commit 68da7a3

Browse files
authored
[ACTION] Salesforce Accounts/Opportunities Batch Create/UpdateDD (#18201)
1 parent 4e64451 commit 68da7a3

File tree

56 files changed

+266
-51
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+266
-51
lines changed

components/salesforce_rest_api/actions/add-contact-to-campaign/add-contact-to-campaign.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "salesforce_rest_api-add-contact-to-campaign",
66
name: "Add Contact to Campaign",
77
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.0",
8+
version: "0.1.1",
99
type: "action",
1010
props: {
1111
salesforce,

components/salesforce_rest_api/actions/add-lead-to-campaign/add-lead-to-campaign.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "salesforce_rest_api-add-lead-to-campaign",
66
name: "Add Lead to Campaign",
77
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.0",
8+
version: "0.1.1",
99
type: "action",
1010
props: {
1111
salesforce,
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
import {
2+
ConfigurationError,
3+
getFileStream,
4+
} from "@pipedream/platform";
5+
import app from "../../salesforce_rest_api.app.mjs";
6+
7+
export default {
8+
props: {
9+
app,
10+
csvFilePath: {
11+
type: "string",
12+
label: "CSV File Path Or URL",
13+
description: "The path to the CSV file to process. Provide a path to a file in the `/tmp` directory (for example, `/tmp/data.csv`). If a URL is provided, the file will be downloaded to the `/tmp` directory. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/datafiles_prepare_data.htm)",
14+
},
15+
syncDir: {
16+
type: "dir",
17+
accessMode: "read",
18+
sync: true,
19+
},
20+
},
21+
methods: {
22+
getObject() {
23+
throw new ConfigurationError("getObject method not implemented");
24+
},
25+
getOperation() {
26+
throw new ConfigurationError("getOperation method not implemented");
27+
},
28+
getSummary() {
29+
throw new ConfigurationError("getSummary method not implemented");
30+
},
31+
async processBulkOperation({
32+
object, operation, csvData, externalIdFieldName, ...args
33+
} = {}) {
34+
const { app } = this;
35+
const job = await app.createBulkJob({
36+
...args,
37+
data: {
38+
object,
39+
operation,
40+
externalIdFieldName,
41+
},
42+
});
43+
44+
await app.uploadBulkJobData({
45+
...args,
46+
jobId: job.id,
47+
data: csvData,
48+
});
49+
50+
await app.patchBulkJob({
51+
...args,
52+
jobId: job.id,
53+
data: {
54+
state: "UploadComplete",
55+
},
56+
});
57+
58+
return app.getBulkJobInfo({
59+
...args,
60+
jobId: job.id,
61+
});
62+
},
63+
},
64+
async run({ $ }) {
65+
const {
66+
processBulkOperation,
67+
getObject,
68+
getOperation,
69+
getSummary,
70+
csvFilePath,
71+
} = this;
72+
73+
const csvData = await getFileStream(csvFilePath);
74+
75+
const result = await processBulkOperation({
76+
$,
77+
object: getObject(),
78+
operation: getOperation(),
79+
csvData,
80+
});
81+
82+
$.export("$summary", getSummary());
83+
84+
return result;
85+
},
86+
};

components/salesforce_rest_api/actions/convert-soap-xml-to-json/convert-soap-xml-to-json.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "salesforce_rest_api-convert-soap-xml-to-json",
66
name: "Convert SOAP XML Object to JSON",
77
description: "Converts a SOAP XML Object received from Salesforce to JSON",
8-
version: "0.0.6",
8+
version: "0.0.7",
99
type: "action",
1010
props: {
1111
salesforce_rest_api,

components/salesforce_rest_api/actions/create-account/create-account.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default {
88
key: "salesforce_rest_api-create-account",
99
name: "Create Account",
1010
description: `Creates a Salesforce account. [See the documentation](${docsLink})`,
11-
version: "0.3.1",
11+
version: "0.3.2",
1212
type: "action",
1313
methods: {
1414
...common.methods,
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import common from "../common/batch-operation.mjs";
2+
3+
export default {
4+
...common,
5+
key: "salesforce_rest_api-create-accounts-batch",
6+
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.1",
9+
type: "action",
10+
methods: {
11+
...common.methods,
12+
getObject() {
13+
return "Account";
14+
},
15+
getOperation() {
16+
return "insert";
17+
},
18+
getSummary() {
19+
return "Successfully created Accounts";
20+
},
21+
},
22+
};

components/salesforce_rest_api/actions/create-attachment/create-attachment.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default {
1818
key: "salesforce_rest_api-create-attachment",
1919
name: "Create Attachment",
2020
description: `Creates an Attachment on a parent object. [See the documentation](${docsLink})`,
21-
version: "0.5.1",
21+
version: "0.5.2",
2222
type: "action",
2323
props,
2424
async run({ $ }) {

components/salesforce_rest_api/actions/create-campaign/create-campaign.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default {
88
key: "salesforce_rest_api-create-campaign",
99
name: "Create Campaign",
1010
description: `Creates a marketing campaign. [See the documentation](${docsLink})`,
11-
version: "0.3.1",
11+
version: "0.3.2",
1212
type: "action",
1313
methods: {
1414
...common.methods,

components/salesforce_rest_api/actions/create-case/create-case.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default {
88
key: "salesforce_rest_api-create-case",
99
name: "Create Case",
1010
description: `Creates a Case, which represents a customer issue or problem. [See the documentation](${docsLink})`,
11-
version: "0.3.1",
11+
version: "0.3.2",
1212
type: "action",
1313
methods: {
1414
...common.methods,

components/salesforce_rest_api/actions/create-casecomment/create-casecomment.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default {
1717
key: "salesforce_rest_api-create-casecomment",
1818
name: "Create Case Comment",
1919
description: `Creates a Case Comment on a selected Case. [See the documentation](${docsLink})`,
20-
version: "0.3.1",
20+
version: "0.3.2",
2121
type: "action",
2222
props,
2323
async run({ $ }) {

0 commit comments

Comments
 (0)