Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export function getProps({
objType,
createOrUpdate = "create",
docsLink = "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_concepts.htm",
showDocsInfo = true,
showDateInfo = false,
}) {
let { initialProps } = objType;
Expand All @@ -34,6 +35,13 @@ export function getProps({

return {
salesforce,
...showDocsInfo && {
docsInfo: {
type: "alert",
alertType: "info",
content: `[See the documentation](${docsLink}) for more information on available fields.`,
},
},
...showDateInfo && {
dateInfo: {
type: "alert",
Expand All @@ -45,11 +53,6 @@ export function getProps({
? "createProps"
: "updateProps"],
...initialProps,
docsInfo: {
type: "alert",
alertType: "info",
content: `[See the documentation](${docsLink}) for more information on available fields.`,
},
useAdvancedProps: {
propDefinition: [
salesforce,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
key: "salesforce_rest_api-create-account",
name: "Create Account",
description: `Creates a Salesforce account. [See the documentation](${docsLink})`,
version: "0.3.0",
version: "0.3.1",
type: "action",
methods: {
...common.methods,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default {
key: "salesforce_rest_api-create-attachment",
name: "Create Attachment",
description: `Creates an Attachment on a parent object. [See the documentation](${docsLink})`,
version: "0.4.0",
version: "0.4.1",
type: "action",
props,
async run({ $ }) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
key: "salesforce_rest_api-create-campaign",
name: "Create Campaign",
description: `Creates a marketing campaign. [See the documentation](${docsLink})`,
version: "0.3.0",
version: "0.3.1",
type: "action",
methods: {
...common.methods,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
key: "salesforce_rest_api-create-case",
name: "Create Case",
description: `Creates a Case, which represents a customer issue or problem. [See the documentation](${docsLink})`,
version: "0.3.0",
version: "0.3.1",
type: "action",
methods: {
...common.methods,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default {
key: "salesforce_rest_api-create-casecomment",
name: "Create Case Comment",
description: `Creates a Case Comment on a selected Case. [See the documentation](${docsLink})`,
version: "0.3.0",
version: "0.3.1",
type: "action",
props,
async run({ $ }) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
key: "salesforce_rest_api-create-contact",
name: "Create Contact",
description: `Creates a contact. [See the documentation](${docsLink})`,
version: "0.3.0",
version: "0.3.1",
type: "action",
methods: {
...common.methods,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/* eslint-disable no-unused-vars */
import common, { getProps } from "../common/base-create-update.mjs";
import contentNote from "../../common/sobjects/content-note.mjs";
import contentDocumentLink from "../../common/sobjects/content-document-link.mjs";

const docsLink = "https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_contentnote.htm";

const {
useAdvancedProps: contentNoteUseAdvancedProps,
...contentNoteProps
} = getProps({
objType: contentNote,
docsLink,
});

const {
useAdvancedProps: contentDocumentLinkUseAdvancedProps,
...contentDocumentLinkProps
} = getProps({
objType: contentDocumentLink,
docsLink,
showDocsInfo: false,
});

export default {
...common,
key: "salesforce_rest_api-create-content-note",
name: "Create Content Note",
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).`,
version: "0.0.1",
type: "action",
props: {
...contentNoteProps,
...contentDocumentLinkProps,
},
methods: {
...common.methods,
escapeHtml4(unsafe) {
return unsafe
.replace(/&/g, "&")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;")
.replace(/'/g, "&#039;");
},
},
async run({ $ }) {
const {
salesforce,
escapeHtml4,
Title,
Content,
OwnerId,
LinkedEntityId,
ShareType,
Visibility,
} = this;

const contentNoteResponse = await salesforce.createRecord("ContentNote", {
$,
data: {
Title,
Content: Buffer.from(escapeHtml4(Content)).toString("base64"),
OwnerId: OwnerId,
},
});

if (!LinkedEntityId) {
$.export("$summary", `Successfully created content note with ID \`${contentNoteResponse.id}\`.`);
return {
contentNote: contentNoteResponse,
};
}

const contentDocumentLinkResponse = await salesforce.createRecord("ContentDocumentLink", {
$,
data: {
ContentDocumentId: contentNoteResponse.id,
LinkedEntityId,
ShareType,
Visibility,
},
});

$.export("$summary", `Successfully created content note with ID \`${contentNoteResponse.id}\` and document link with ID \`${contentDocumentLinkResponse.id}\`.`);
return {
contentNote: contentNoteResponse,
contentDocumentLink: contentDocumentLinkResponse,
};
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default {
key: "salesforce_rest_api-create-event",
name: "Create Event",
description: `Creates an event. [See the documentation](${docsLink})`,
version: "0.3.0",
version: "0.3.1",
type: "action",
methods: {
...common.methods,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
key: "salesforce_rest_api-create-lead",
name: "Create Lead",
description: `Creates a lead. [See the documentation](${docsLink})`,
version: "0.3.0",
version: "0.3.1",
type: "action",
methods: {
...common.methods,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default {
key: "salesforce_rest_api-create-note",
name: "Create Note",
description: `Creates a note. [See the documentation](${docsLink})`,
version: "0.3.0",
version: "0.3.1",
type: "action",
props,
async run({ $ }) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
key: "salesforce_rest_api-create-opportunity",
name: "Create Opportunity",
description: `Creates an opportunity. [See the documentation](${docsLink})`,
version: "0.3.0",
version: "0.3.1",
type: "action",
methods: {
...common.methods,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
key: "salesforce_rest_api-create-record",
name: "Create Record",
description: "Create a record of a given object. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_create.htm)",
version: "0.3.0",
version: "0.3.1",
type: "action",
props: {
salesforce,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default {
key: "salesforce_rest_api-create-task",
name: "Create Task",
description: `Creates a task. [See the documentation](${docsLink})`,
version: "0.4.0",
version: "0.4.1",
type: "action",
methods: {
...common.methods,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default {
key: "salesforce_rest_api-create-user",
name: "Create User",
description: `Creates a Salesforce user. [See the documentation](${docsLink})`,
version: "0.1.0",
version: "0.1.1",
type: "action",
methods: {
...common.methods,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default {
key: "salesforce_rest_api-update-account",
name: "Update Account",
description: `Updates a Salesforce account. [See the documentation](${docsLink})`,
version: "0.3.0",
version: "0.3.1",
type: "action",
methods: {
...common.methods,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default {
key: "salesforce_rest_api-update-contact",
name: "Update Contact",
description: `Updates a contact. [See the documentation](${docsLink})`,
version: "0.3.0",
version: "0.3.1",
type: "action",
methods: {
...common.methods,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default {
key: "salesforce_rest_api-update-opportunity",
name: "Update Opportunity",
description: `Updates an opportunity. [See the documentation](${docsLink})`,
version: "0.3.0",
version: "0.3.1",
type: "action",
methods: {
...common.methods,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
key: "salesforce_rest_api-update-record",
name: "Update Record",
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)",
version: "0.3.0",
version: "0.3.1",
type: "action",
props: {
salesforce,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
key: "salesforce_rest_api-upsert-record",
name: "Upsert Record",
description: "Create or update a record of a given object. [See the documentation](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_upsert.htm)",
version: "0.0.1",
version: "0.0.2",
type: "action",
props: {
salesforce,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
export default {
initialProps: {
LinkedEntityId: {
type: "string",
label: "Linked Entity ID",
description: "ID of the linked object. Can include Chatter users, groups, records (any that support Chatter feed tracking including custom objects), and Salesforce CRM Content libraries.",
optional: true,
},
ShareType: {
type: "string",
label: "Share Type",
description: "The permission granted to the user of the shared file in a library. This is determined by the permission the user already has in the library.",
optional: true,
default: "I",
options: [
{
label: "Viewer Permission",
value: "V",
},
{
label: "Collaborator Permission",
value: "C",
},
{
label: "Inferred Permission",
value: "I",
},
],
},
Visibility: {
type: "string",
label: "Visibility",
description: "Specifies whether this file is available to all users, internal users, or shared users.",
optional: true,
options: [
{
label: "All Users",
value: "AllUsers",
},
{
label: "Internal Users",
value: "InternalUsers",
},
{
label: "Shared Users",
value: "SharedUsers",
},
],
},
},
};
34 changes: 34 additions & 0 deletions components/salesforce_rest_api/common/sobjects/content-note.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import salesforce from "../../salesforce_rest_api.app.mjs";

export default {
initialProps: {
OwnerId: {
propDefinition: [
salesforce,
"recordId",
() => ({
objType: "User",
nameField: "Name",
}),
],
label: "Owner ID",
description: "ID of the user who owns the note.",
},
Title: {
type: "string",
label: "Title",
description: "Title of the note.",
},
Content: {
type: "string",
label: "Content",
description: "The content or body of the note, which can include properly formatted HTML or plain text.",
},
IsReadOnly: {
type: "boolean",
label: "Read Only",
description: "Indicates whether the note is read only.",
optional: true,
},
},
};
2 changes: 1 addition & 1 deletion components/salesforce_rest_api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/salesforce_rest_api",
"version": "1.4.0",
"version": "1.5.0",
"description": "Pipedream Salesforce (REST API) Components",
"main": "salesforce_rest_api.app.mjs",
"keywords": [
Expand Down
Loading