@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.
- package/actions/create-account/create-account.mjs +51 -0
- package/actions/create-attachment/create-attachment.mjs +62 -0
- package/actions/create-campaign/create-campaign.mjs +51 -0
- package/actions/create-case/create-case.mjs +50 -0
- package/actions/create-casecomment/create-casecomment.mjs +50 -0
- package/actions/create-contact/create-contact.mjs +50 -0
- package/actions/create-event/create-event.mjs +80 -0
- package/actions/create-lead/create-lead.mjs +56 -0
- package/actions/create-note/create-note.mjs +56 -0
- package/actions/create-opportunity/create-opportunity.mjs +62 -0
- package/actions/create-record/create-record.mjs +36 -0
- package/actions/create-task/create-task.mjs +56 -0
- package/actions/delete-opportunity/delete-opportunity.mjs +30 -0
- package/actions/delete-record/delete-record.mjs +37 -0
- package/actions/find-create-record/find-create-record.mjs +84 -0
- package/actions/find-records/find-records.mjs +48 -0
- package/actions/get-sobject-fields-values/get-sobject-fields-values.mjs +57 -0
- package/actions/insert-blob-data/insert-blob-data.mjs +77 -0
- package/actions/soql-search/soql-search.mjs +29 -0
- package/actions/sosl-search/sosl-search.mjs +29 -0
- package/actions/update-account/update-account.mjs +59 -0
- package/actions/update-contact/update-contact.mjs +58 -0
- package/actions/update-opportunity/update-opportunity.mjs +72 -0
- package/actions/update-record/update-record.mjs +46 -0
- package/common/constants.mjs +30 -0
- package/common/sobjects/account.mjs +27 -0
- package/common/sobjects/attachment.mjs +22 -0
- package/common/sobjects/campaign.mjs +27 -0
- package/common/sobjects/case.mjs +17 -0
- package/common/sobjects/caseComment.mjs +7 -0
- package/common/sobjects/contact.mjs +52 -0
- package/common/sobjects/event.mjs +22 -0
- package/common/sobjects/lead.mjs +32 -0
- package/common/sobjects/note.mjs +17 -0
- package/common/sobjects/opportunity.mjs +27 -0
- package/common/sobjects/task.mjs +25 -0
- package/common/utils.mjs +51 -0
- package/package.json +6 -3
- package/salesforce_rest_api.app.mjs +349 -37
- package/sources/common-instant.mjs +15 -9
- package/sources/common.mjs +3 -5
- package/sources/new-object/new-object.mjs +1 -1
- package/sources/new-object-instant/new-object-instant.mjs +1 -1
- package/sources/new-outbound-message/new-outbound-message.mjs +1 -1
- package/sources/object-deleted/object-deleted.mjs +2 -2
- package/sources/object-deleted-instant/object-deleted-instant.mjs +2 -2
- package/sources/object-updated/object-updated.mjs +2 -2
- package/sources/object-updated-instant/object-updated-instant.mjs +2 -2
- package/sources/updated-field-on-record/updated-field-on-record.mjs +2 -2
- package/sources/updated-field-on-record-instant/updated-field-on-record-instant.mjs +2 -2
- package/actions/salesforce-create-account/salesforce-create-account.mjs +0 -374
- package/actions/salesforce-create-attachment/salesforce-create-attachment.mjs +0 -73
- package/actions/salesforce-create-campaign/salesforce-create-campaign.mjs +0 -148
- package/actions/salesforce-create-case/salesforce-create-case.mjs +0 -179
- package/actions/salesforce-create-casecomment/salesforce-create-casecomment.mjs +0 -58
- package/actions/salesforce-create-contact/salesforce-create-contact.mjs +0 -340
- package/actions/salesforce-create-event/salesforce-create-event.mjs +0 -232
- package/actions/salesforce-create-lead/salesforce-create-lead.mjs +0 -267
- package/actions/salesforce-create-note/salesforce-create-note.mjs +0 -63
- package/actions/salesforce-create-opportunity/salesforce-create-opportunity.mjs +0 -170
- package/actions/salesforce-create-record/salesforce-create-record.mjs +0 -36
- package/actions/salesforce-create-task/salesforce-create-task.mjs +0 -219
- package/actions/salesforce-delete-opportunity/salesforce-delete-opportunity.mjs +0 -37
- package/actions/salesforce-get-sobject-fields-values/salesforce-get-sobject-fields-values.mjs +0 -37
- package/actions/salesforce-insert-blob-data/salesforce-insert-blob-data.mjs +0 -70
- package/actions/salesforce-make-api-call/salesforce-make-api-call.mjs +0 -56
- package/actions/salesforce-soql-search/salesforce-soql-search.mjs +0 -29
- package/actions/salesforce-sosl-search/salesforce-sosl-search.mjs +0 -30
- package/actions/salesforce-update-account/salesforce-update-account.mjs +0 -357
- package/actions/salesforce-update-contact/salesforce-update-contact.mjs +0 -345
- package/actions/salesforce-update-opportunity/salesforce-update-opportunity.mjs +0 -171
- package/actions/salesforce-update-record/salesforce-update-record.mjs +0 -40
- package/utils.mjs +0 -27
|
@@ -0,0 +1,30 @@
|
|
|
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-delete-opportunity",
|
|
6
|
+
name: "Delete Opportunity",
|
|
7
|
+
description: toSingleLineString(`
|
|
8
|
+
Deletes an opportunity.
|
|
9
|
+
See [Opportunity SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_opportunity.htm)
|
|
10
|
+
and [Delete Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_delete_record.htm)
|
|
11
|
+
`),
|
|
12
|
+
version: "0.2.2",
|
|
13
|
+
type: "action",
|
|
14
|
+
props: {
|
|
15
|
+
salesforce,
|
|
16
|
+
OpportunityId: {
|
|
17
|
+
type: "string",
|
|
18
|
+
label: "Opportunity ID",
|
|
19
|
+
description: "ID of the Opportunity to delete",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
async run({ $ }) {
|
|
23
|
+
const response = await this.salesforce.deleteOpportunity({
|
|
24
|
+
$,
|
|
25
|
+
id: this.OpportunityId,
|
|
26
|
+
});
|
|
27
|
+
$.export("$summary", "Successfully deleted opportunity");
|
|
28
|
+
return response;
|
|
29
|
+
},
|
|
30
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import salesForceRestApi from "../../salesforce_rest_api.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "salesforce_rest_api-delete-record",
|
|
5
|
+
name: "Delete a Record in an Object",
|
|
6
|
+
description:
|
|
7
|
+
"Deletes an existing record in an object. [API Doc](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_query.htm)",
|
|
8
|
+
version: "0.1.0",
|
|
9
|
+
type: "action",
|
|
10
|
+
props: {
|
|
11
|
+
salesForceRestApi,
|
|
12
|
+
sobjectType: {
|
|
13
|
+
type: "string",
|
|
14
|
+
label: "Object type",
|
|
15
|
+
description:
|
|
16
|
+
"Salesforce standard object type of the record to get field values from. [Object types](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_list.htm)",
|
|
17
|
+
},
|
|
18
|
+
sobjectId: {
|
|
19
|
+
type: "string",
|
|
20
|
+
label: "Object id",
|
|
21
|
+
description:
|
|
22
|
+
"ID of the Salesforce standard object to get field values from.",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
async run({ $ }) {
|
|
26
|
+
const {
|
|
27
|
+
sobjectType,
|
|
28
|
+
sobjectId,
|
|
29
|
+
} = this;
|
|
30
|
+
const response = await this.salesForceRestApi.deleteObject(
|
|
31
|
+
sobjectType,
|
|
32
|
+
sobjectId,
|
|
33
|
+
);
|
|
34
|
+
response && $.export("$summary", `Successfully deleted record with ID ${sobjectId}`);
|
|
35
|
+
return response;
|
|
36
|
+
},
|
|
37
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { ConfigurationError } from "@pipedream/platform";
|
|
2
|
+
import salesForceRestApi from "../../salesforce_rest_api.app.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
key: "salesforce_rest_api-find-create-record",
|
|
6
|
+
name: "Get Field Values from Object Record and optionally create one is none is found. ",
|
|
7
|
+
description:
|
|
8
|
+
"Finds a specified Salesforce record by a field. Optionally, create one if none is found. [API Docs](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_get_field_values.htm)",
|
|
9
|
+
version: "0.1.0",
|
|
10
|
+
type: "action",
|
|
11
|
+
props: {
|
|
12
|
+
salesForceRestApi,
|
|
13
|
+
sobjectType: {
|
|
14
|
+
type: "string",
|
|
15
|
+
label: "Object type",
|
|
16
|
+
description:
|
|
17
|
+
"Salesforce standard object type of the record to get field values from. [Object types](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_list.htm)",
|
|
18
|
+
},
|
|
19
|
+
sobjectId: {
|
|
20
|
+
type: "string",
|
|
21
|
+
label: "Object ID",
|
|
22
|
+
description:
|
|
23
|
+
"ID of the Salesforce standard object to get field values from.",
|
|
24
|
+
},
|
|
25
|
+
sobjectFields: {
|
|
26
|
+
type: "string[]",
|
|
27
|
+
label: "Fields to get values from",
|
|
28
|
+
description:
|
|
29
|
+
"list of the Salesforce standard object's fields to get values from.",
|
|
30
|
+
},
|
|
31
|
+
createIfNotFound: {
|
|
32
|
+
type: "boolean",
|
|
33
|
+
label: "Create new object",
|
|
34
|
+
description: "Create a new object if none is found",
|
|
35
|
+
reloadProps: true,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
async additionalProps() {
|
|
39
|
+
return {
|
|
40
|
+
sobject: {
|
|
41
|
+
type: "object",
|
|
42
|
+
label: "Salesforce standard object",
|
|
43
|
+
description: `Data of the Salesforce standard object record to create.
|
|
44
|
+
Salesforce standard objects are described in [Standard Objects](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_list.htm) section of the [SOAP API Developer Guide](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_quickstart_intro.htm).`,
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
},
|
|
48
|
+
async run({ $ }) {
|
|
49
|
+
const {
|
|
50
|
+
sobjectType,
|
|
51
|
+
sobjectId,
|
|
52
|
+
sobjectFields,
|
|
53
|
+
sobject,
|
|
54
|
+
createIfNotFound,
|
|
55
|
+
} = this;
|
|
56
|
+
let data;
|
|
57
|
+
try {
|
|
58
|
+
data = await this.salesForceRestApi.getSObject(
|
|
59
|
+
sobjectType,
|
|
60
|
+
sobjectId,
|
|
61
|
+
sobjectFields && {
|
|
62
|
+
fields: sobjectFields.join(","),
|
|
63
|
+
},
|
|
64
|
+
);
|
|
65
|
+
} catch (error) {
|
|
66
|
+
if (!createIfNotFound) throw new ConfigurationError("Record not found");
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (createIfNotFound && !data) {
|
|
70
|
+
const response = await this.salesForceRestApi.createObject(
|
|
71
|
+
sobjectType,
|
|
72
|
+
sobject,
|
|
73
|
+
);
|
|
74
|
+
response && $.export(
|
|
75
|
+
"$summary", "Record successfully created",
|
|
76
|
+
);
|
|
77
|
+
return response;
|
|
78
|
+
}
|
|
79
|
+
if (data) {
|
|
80
|
+
$.export("$summary", "Record found!");
|
|
81
|
+
}
|
|
82
|
+
return data;
|
|
83
|
+
},
|
|
84
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import salesForceRestApi from "../../salesforce_rest_api.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "salesforce_rest_api-find-records",
|
|
5
|
+
name: "Get Object Records",
|
|
6
|
+
description:
|
|
7
|
+
"Retrieves all records in an object or a record in an object by the given ID or criteria. [API Doc](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_get_field_values.htm)",
|
|
8
|
+
version: "0.1.0",
|
|
9
|
+
type: "action",
|
|
10
|
+
props: {
|
|
11
|
+
salesForceRestApi,
|
|
12
|
+
sobjectType: {
|
|
13
|
+
type: "string",
|
|
14
|
+
label: "Object type",
|
|
15
|
+
description:
|
|
16
|
+
"Salesforce standard object type of the record to get field values from. [Object types](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_list.htm)",
|
|
17
|
+
},
|
|
18
|
+
ids: {
|
|
19
|
+
type: "string[]",
|
|
20
|
+
label: "Record IDs to be returned",
|
|
21
|
+
description:
|
|
22
|
+
"Record IDs to be returned",
|
|
23
|
+
},
|
|
24
|
+
fields: {
|
|
25
|
+
type: "string[]",
|
|
26
|
+
label: "Fields to get values from",
|
|
27
|
+
description:
|
|
28
|
+
"list of the Salesforce standard object's fields to get values from.",
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
async run({ $ }) {
|
|
32
|
+
const {
|
|
33
|
+
sobjectType,
|
|
34
|
+
fields,
|
|
35
|
+
ids,
|
|
36
|
+
} = this;
|
|
37
|
+
const response = await this.salesForceRestApi.getRecords(
|
|
38
|
+
sobjectType, {
|
|
39
|
+
fields: fields.join(","),
|
|
40
|
+
ids: ids.join(","),
|
|
41
|
+
},
|
|
42
|
+
);
|
|
43
|
+
if (response) {
|
|
44
|
+
$.export("$summary", "Record found successfully" );
|
|
45
|
+
}
|
|
46
|
+
return response;
|
|
47
|
+
},
|
|
48
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
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-get-sobject-fields-values",
|
|
6
|
+
name: "Get Field Values from a Standard Object Record",
|
|
7
|
+
description: toSingleLineString(`
|
|
8
|
+
Retrieve field values from a record. You can specify the fields you want to retrieve.
|
|
9
|
+
See [docs](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_get_field_values.htm)
|
|
10
|
+
`),
|
|
11
|
+
version: "0.2.2",
|
|
12
|
+
type: "action",
|
|
13
|
+
props: {
|
|
14
|
+
salesforce,
|
|
15
|
+
objectType: {
|
|
16
|
+
propDefinition: [
|
|
17
|
+
salesforce,
|
|
18
|
+
"objectType",
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
sobjectId: {
|
|
22
|
+
propDefinition: [
|
|
23
|
+
salesforce,
|
|
24
|
+
"sobjectId",
|
|
25
|
+
(c) => ({
|
|
26
|
+
objectType: c.objectType,
|
|
27
|
+
}),
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
fields: {
|
|
31
|
+
type: "string[]",
|
|
32
|
+
label: "SObject Fields",
|
|
33
|
+
description: "List of fields of the Standard object to get values from",
|
|
34
|
+
propDefinition: [
|
|
35
|
+
salesforce,
|
|
36
|
+
"field",
|
|
37
|
+
(c) => ({
|
|
38
|
+
objectType: c.objectType,
|
|
39
|
+
}),
|
|
40
|
+
],
|
|
41
|
+
optional: true,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
async run({ $ }) {
|
|
45
|
+
const params = {};
|
|
46
|
+
if (this.fields?.length > 0) {
|
|
47
|
+
params.fields = this.fields.join(",");
|
|
48
|
+
}
|
|
49
|
+
const response = await this.salesforce.getRecordFieldValues(this.objectType, {
|
|
50
|
+
$,
|
|
51
|
+
id: this.sobjectId,
|
|
52
|
+
params,
|
|
53
|
+
});
|
|
54
|
+
$.export("$summary", `Retrieved ${this.objectType} field values`);
|
|
55
|
+
return response;
|
|
56
|
+
},
|
|
57
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
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-insert-blob-data",
|
|
6
|
+
name: "Insert Blob Data",
|
|
7
|
+
description: toSingleLineString(`
|
|
8
|
+
Inserts blob data in Salesforce standard objects.
|
|
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.2",
|
|
12
|
+
type: "action",
|
|
13
|
+
props: {
|
|
14
|
+
salesforce,
|
|
15
|
+
entiyName: {
|
|
16
|
+
type: "string",
|
|
17
|
+
label: "Entity Name",
|
|
18
|
+
description: "Name of the entity to insert as part of the form-data sent along the Salesforce API as a request with multipart/form-data content type. I.e. entityDocument for Documents.",
|
|
19
|
+
},
|
|
20
|
+
entityDocument: {
|
|
21
|
+
type: "string",
|
|
22
|
+
label: "Entity Document",
|
|
23
|
+
description: "Salesforce object entity to insert.",
|
|
24
|
+
},
|
|
25
|
+
formContentName: {
|
|
26
|
+
type: "string",
|
|
27
|
+
label: "Form Content Name",
|
|
28
|
+
description: "Name of the binary content to insert as part of the form-data sent along the Salesforce API as a request with multipart/form-data content type.",
|
|
29
|
+
},
|
|
30
|
+
filename: {
|
|
31
|
+
type: "string",
|
|
32
|
+
label: "Filename",
|
|
33
|
+
description: "Filename of the blob data to insert.",
|
|
34
|
+
},
|
|
35
|
+
contentType: {
|
|
36
|
+
type: "string",
|
|
37
|
+
label: "Content Type",
|
|
38
|
+
description: "Mime type of the content to insert.",
|
|
39
|
+
},
|
|
40
|
+
attachmentBinarycontent: {
|
|
41
|
+
type: "string",
|
|
42
|
+
label: "Attachment Binary Content",
|
|
43
|
+
description: "Binary content of the blob data to insert.",
|
|
44
|
+
},
|
|
45
|
+
sobjectName: {
|
|
46
|
+
type: "string",
|
|
47
|
+
label: "SObject Type",
|
|
48
|
+
description: "Salesforce standard object type to insert.",
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
async run({ $ }) {
|
|
52
|
+
const payloadPart1 = `----------------------------932677621329676389151855
|
|
53
|
+
\r\nContent-Disposition: form-data; name="${this.entiyName}""
|
|
54
|
+
\r\nContent-Type: application/json
|
|
55
|
+
\r\n\r\n${this.entityDocument}\r\n\r\n
|
|
56
|
+
\r\n\r\n----------------------------932677621329676389151855
|
|
57
|
+
\r\nContent-Disposition: form-data; name="${this.formContentName}"; filename="${this.filename}"
|
|
58
|
+
\r\nContent-Type: ${this.contentType}
|
|
59
|
+
\r\n\r\n`;
|
|
60
|
+
|
|
61
|
+
const payloadPart2 = "\r\n\r\n----------------------------932677621329676389151855--";
|
|
62
|
+
|
|
63
|
+
const data = `${payloadPart1}${this.attachmentBinarycontent}${payloadPart2}`;
|
|
64
|
+
|
|
65
|
+
const headers = {
|
|
66
|
+
"Content-Type": "multipart/form-data; boundary=--------------------------932677621329676389151855",
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const response = await this.salesforce.insertBlobData(this.sobjectName, {
|
|
70
|
+
$,
|
|
71
|
+
headers,
|
|
72
|
+
data,
|
|
73
|
+
});
|
|
74
|
+
$.export("$summary", `Inserted Blob data to ${this.sobjectName}`);
|
|
75
|
+
return response;
|
|
76
|
+
},
|
|
77
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
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-soql-search",
|
|
6
|
+
name: "SOQL Search",
|
|
7
|
+
description: toSingleLineString(`
|
|
8
|
+
Executes a SOQL query.
|
|
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.2",
|
|
12
|
+
type: "action",
|
|
13
|
+
props: {
|
|
14
|
+
salesforce,
|
|
15
|
+
query: {
|
|
16
|
+
type: "string",
|
|
17
|
+
label: "SOQL Query",
|
|
18
|
+
description: "A SOQL search query",
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
async run({ $ }) {
|
|
22
|
+
const response = await this.salesforce.query({
|
|
23
|
+
$,
|
|
24
|
+
query: this.query,
|
|
25
|
+
});
|
|
26
|
+
$.export("$summary", "Successfully returned ${response.length} results for SOQL query");
|
|
27
|
+
return response;
|
|
28
|
+
},
|
|
29
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
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-sosl-search",
|
|
6
|
+
name: "SOSL Search",
|
|
7
|
+
description: toSingleLineString(`
|
|
8
|
+
Executes the specified SOSL search.
|
|
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.2",
|
|
12
|
+
type: "action",
|
|
13
|
+
props: {
|
|
14
|
+
salesforce,
|
|
15
|
+
search: {
|
|
16
|
+
type: "string",
|
|
17
|
+
label: "SOSL Query",
|
|
18
|
+
description: "A SOSL search query",
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
async run({ $ }) {
|
|
22
|
+
const response = await this.salesforce.search({
|
|
23
|
+
$,
|
|
24
|
+
search: this.search,
|
|
25
|
+
});
|
|
26
|
+
$.export("$summary", "Successfully returned ${response.length} results for SOSL search");
|
|
27
|
+
return response;
|
|
28
|
+
},
|
|
29
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
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-update-account",
|
|
10
|
+
name: "Update Account",
|
|
11
|
+
description: toSingleLineString(`
|
|
12
|
+
Updates 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 [Update Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_update_fields.htm)
|
|
16
|
+
`),
|
|
17
|
+
version: "0.2.2",
|
|
18
|
+
type: "action",
|
|
19
|
+
props: {
|
|
20
|
+
salesforce,
|
|
21
|
+
AccountId: {
|
|
22
|
+
type: "string",
|
|
23
|
+
label: "Account ID",
|
|
24
|
+
description: "ID of the Account to modify.",
|
|
25
|
+
},
|
|
26
|
+
Name: {
|
|
27
|
+
type: "string",
|
|
28
|
+
label: "Name",
|
|
29
|
+
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.",
|
|
30
|
+
optional: true,
|
|
31
|
+
},
|
|
32
|
+
selector: {
|
|
33
|
+
propDefinition: [
|
|
34
|
+
salesforce,
|
|
35
|
+
"fieldSelector",
|
|
36
|
+
],
|
|
37
|
+
description: `${salesforce.propDefinitions.fieldSelector.description} Account`,
|
|
38
|
+
options: () => Object.keys(account),
|
|
39
|
+
reloadProps: true,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
async additionalProps() {
|
|
43
|
+
return this.salesforce.additionalProps(this.selector, account);
|
|
44
|
+
},
|
|
45
|
+
async run({ $ }) {
|
|
46
|
+
const data = pickBy(pick(this, [
|
|
47
|
+
"AccountId",
|
|
48
|
+
"Name",
|
|
49
|
+
...this.selector,
|
|
50
|
+
]));
|
|
51
|
+
const response = await this.salesforce.updateAccount({
|
|
52
|
+
$,
|
|
53
|
+
id: this.AccountId,
|
|
54
|
+
data,
|
|
55
|
+
});
|
|
56
|
+
$.export("$summary", `Successfully updated account ${this.AccountId}`);
|
|
57
|
+
return response;
|
|
58
|
+
},
|
|
59
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
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-update-contact",
|
|
10
|
+
name: "Update Contact",
|
|
11
|
+
description: toSingleLineString(`
|
|
12
|
+
Updates 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 [Update Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_update_fields.htm)
|
|
15
|
+
`),
|
|
16
|
+
version: "0.2.2",
|
|
17
|
+
type: "action",
|
|
18
|
+
props: {
|
|
19
|
+
salesforce,
|
|
20
|
+
ContactId: {
|
|
21
|
+
type: "string",
|
|
22
|
+
label: "Contact ID",
|
|
23
|
+
description: "ID of the Contact to update.",
|
|
24
|
+
},
|
|
25
|
+
LastName: {
|
|
26
|
+
type: "string",
|
|
27
|
+
label: "Last Name",
|
|
28
|
+
description: "Last name of the contact up to 80 characters.",
|
|
29
|
+
optional: true,
|
|
30
|
+
},
|
|
31
|
+
selector: {
|
|
32
|
+
propDefinition: [
|
|
33
|
+
salesforce,
|
|
34
|
+
"fieldSelector",
|
|
35
|
+
],
|
|
36
|
+
description: `${salesforce.propDefinitions.fieldSelector.description} Contact`,
|
|
37
|
+
options: () => Object.keys(contact),
|
|
38
|
+
reloadProps: true,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
async additionalProps() {
|
|
42
|
+
return this.salesforce.additionalProps(this.selector, contact);
|
|
43
|
+
},
|
|
44
|
+
async run({ $ }) {
|
|
45
|
+
const data = pickBy(pick(this, [
|
|
46
|
+
"ContactId",
|
|
47
|
+
"LastName",
|
|
48
|
+
...this.selector,
|
|
49
|
+
]));
|
|
50
|
+
const response = await this.salesforce.updateContact({
|
|
51
|
+
$,
|
|
52
|
+
id: this.ContactId,
|
|
53
|
+
data,
|
|
54
|
+
});
|
|
55
|
+
$.export("$summary", `Successfully updated contact for ${this.ContactId}`);
|
|
56
|
+
return response;
|
|
57
|
+
},
|
|
58
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
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-update-opportunity",
|
|
10
|
+
name: "Update Opportunity",
|
|
11
|
+
description: toSingleLineString(`
|
|
12
|
+
Updates 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 [Update Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_update_fields.htm)
|
|
15
|
+
`),
|
|
16
|
+
version: "0.2.2",
|
|
17
|
+
type: "action",
|
|
18
|
+
props: {
|
|
19
|
+
salesforce,
|
|
20
|
+
OpportunityId: {
|
|
21
|
+
type: "string",
|
|
22
|
+
label: "Opportunity ID",
|
|
23
|
+
description: "ID of the Opportunity to update.",
|
|
24
|
+
},
|
|
25
|
+
CloseDate: {
|
|
26
|
+
type: "string",
|
|
27
|
+
label: "CloseDate",
|
|
28
|
+
description: "Date when the opportunity is expected to close.",
|
|
29
|
+
optional: true,
|
|
30
|
+
},
|
|
31
|
+
Name: {
|
|
32
|
+
type: "string",
|
|
33
|
+
label: "Name",
|
|
34
|
+
description: "A name for this opportunity. Limit: 120 characters.",
|
|
35
|
+
optional: true,
|
|
36
|
+
},
|
|
37
|
+
StageName: {
|
|
38
|
+
type: "string",
|
|
39
|
+
label: "StageName",
|
|
40
|
+
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.",
|
|
41
|
+
optional: true,
|
|
42
|
+
},
|
|
43
|
+
selector: {
|
|
44
|
+
propDefinition: [
|
|
45
|
+
salesforce,
|
|
46
|
+
"fieldSelector",
|
|
47
|
+
],
|
|
48
|
+
description: `${salesforce.propDefinitions.fieldSelector.description} Opportunity`,
|
|
49
|
+
options: () => Object.keys(opportunity),
|
|
50
|
+
reloadProps: true,
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
async additionalProps() {
|
|
54
|
+
return this.salesforce.additionalProps(this.selector, opportunity);
|
|
55
|
+
},
|
|
56
|
+
async run({ $ }) {
|
|
57
|
+
const data = pickBy(pick(this, [
|
|
58
|
+
"OpportunityId",
|
|
59
|
+
"CloseDate",
|
|
60
|
+
"Name",
|
|
61
|
+
"StageName",
|
|
62
|
+
...this.selector,
|
|
63
|
+
]));
|
|
64
|
+
const response = await this.salesforce.updateOpportunity({
|
|
65
|
+
$,
|
|
66
|
+
id: this.OpportunityId,
|
|
67
|
+
data,
|
|
68
|
+
});
|
|
69
|
+
$.export("$summary", `Successfully updated opportunity ${this.OpportunityId}`);
|
|
70
|
+
return response;
|
|
71
|
+
},
|
|
72
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
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-update-record",
|
|
6
|
+
name: "Update Record",
|
|
7
|
+
description: toSingleLineString(`
|
|
8
|
+
Updates a record of a given resource.
|
|
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.2",
|
|
12
|
+
type: "action",
|
|
13
|
+
props: {
|
|
14
|
+
salesforce,
|
|
15
|
+
objectType: {
|
|
16
|
+
propDefinition: [
|
|
17
|
+
salesforce,
|
|
18
|
+
"objectType",
|
|
19
|
+
],
|
|
20
|
+
description: "SObject Type of record to be updated",
|
|
21
|
+
},
|
|
22
|
+
sobjectId: {
|
|
23
|
+
propDefinition: [
|
|
24
|
+
salesforce,
|
|
25
|
+
"sobjectId",
|
|
26
|
+
(c) => ({
|
|
27
|
+
objectType: c.objectType,
|
|
28
|
+
}),
|
|
29
|
+
],
|
|
30
|
+
description: "ID of the SObject record to be updated",
|
|
31
|
+
},
|
|
32
|
+
sobject: {
|
|
33
|
+
type: "object",
|
|
34
|
+
label: "SObject fields and values",
|
|
35
|
+
description: "SObject record data to patch",
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
async run({ $ }) {
|
|
39
|
+
await this.salesforce.updateRecord(this.objectType, {
|
|
40
|
+
$,
|
|
41
|
+
id: this.sobjectId,
|
|
42
|
+
data: this.sobject,
|
|
43
|
+
});
|
|
44
|
+
$.export("$summary", `Updated record ${this.objectType}`);
|
|
45
|
+
},
|
|
46
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
CLEAN_STATUS: [
|
|
3
|
+
"Matched",
|
|
4
|
+
"Different",
|
|
5
|
+
"Acknowledged",
|
|
6
|
+
"NotFound",
|
|
7
|
+
"Inactive",
|
|
8
|
+
"Pending",
|
|
9
|
+
"SelectMatch",
|
|
10
|
+
"Skipped",
|
|
11
|
+
],
|
|
12
|
+
CALL_TYPES: [
|
|
13
|
+
"Inbound",
|
|
14
|
+
"Internal",
|
|
15
|
+
"Outbound",
|
|
16
|
+
],
|
|
17
|
+
RECURRENCE_REGENERATED_TYPE: [
|
|
18
|
+
"None",
|
|
19
|
+
"After due date",
|
|
20
|
+
"After the task is closed",
|
|
21
|
+
"(Task closed)",
|
|
22
|
+
],
|
|
23
|
+
TASK_SUB_TYPES: [
|
|
24
|
+
"Task",
|
|
25
|
+
"Email",
|
|
26
|
+
"List Email",
|
|
27
|
+
"Cadence",
|
|
28
|
+
"Call",
|
|
29
|
+
],
|
|
30
|
+
};
|