Skip to content

Commit 61f0a45

Browse files
committed
[ACTION] Salesforce - Content Note action
1 parent 6b2368a commit 61f0a45

File tree

4 files changed

+87
-3
lines changed

4 files changed

+87
-3
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import common, { getProps } from "../common/base-create-update.mjs";
2+
import contentNote from "../../common/sobjects/content-note.mjs";
3+
4+
const docsLink = "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_contentnote.htm";
5+
6+
/* eslint-disable no-unused-vars */
7+
const {
8+
useAdvancedProps, ...props
9+
} = getProps({
10+
objType: contentNote,
11+
docsLink,
12+
});
13+
/* eslint-enable no-unused-vars */
14+
15+
export default {
16+
...common,
17+
key: "salesforce_rest_api-create-content-note",
18+
name: "Create Content Note",
19+
description: `Creates a content note. [See the documentation](${docsLink}) and [Set Up Notes](https://help.salesforce.com/s/articleView?id=sales.notes_admin_setup.htm&type=5).`,
20+
version: "0.0.1",
21+
type: "action",
22+
props,
23+
async run({ $ }) {
24+
/* eslint-disable no-unused-vars */
25+
const {
26+
salesforce,
27+
getAdvancedProps,
28+
getAdditionalFields,
29+
formatDateTimeProps,
30+
docsInfo, ...data
31+
} = this;
32+
/* eslint-enable no-unused-vars */
33+
34+
await salesforce.createRecord("ContentVersion", {
35+
$,
36+
data: {
37+
Title: data.Title,
38+
VersionData: Buffer.from(data.Content).toString("base64"),
39+
PathOnClient: `${data.Title}.snote`,
40+
FirstPublishLocationId: data.OwnerId,
41+
},
42+
});
43+
44+
const response = await salesforce.createRecord("ContentNote", {
45+
$,
46+
data,
47+
});
48+
49+
$.export("$summary", `Successfully created content note "${this.Title}"`);
50+
return response;
51+
},
52+
};
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import salesforce from "../../salesforce_rest_api.app.mjs";
2+
3+
export default {
4+
initialProps: {
5+
Content: {
6+
type: "string",
7+
label: "Content",
8+
description: "The content or body of the note, which can include properly formatted HTML or plain text.",
9+
},
10+
IsReadOnly: {
11+
type: "boolean",
12+
label: "Read Only",
13+
description: "Indicates whether the note is read only.",
14+
optional: true,
15+
},
16+
OwnerId: {
17+
propDefinition: [
18+
salesforce,
19+
"recordId",
20+
() => ({
21+
objType: "User",
22+
nameField: "Name",
23+
}),
24+
],
25+
label: "Owner ID",
26+
description: "ID of the user who owns the note.",
27+
},
28+
Title: {
29+
type: "string",
30+
label: "Title",
31+
description: "Title of the note.",
32+
},
33+
},
34+
};

components/salesforce_rest_api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/salesforce_rest_api",
3-
"version": "1.4.0",
3+
"version": "1.4.1",
44
"description": "Pipedream Salesforce (REST API) Components",
55
"main": "salesforce_rest_api.app.mjs",
66
"keywords": [

pnpm-lock.yaml

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)