Skip to content

Salesforce usability improvements #12697

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 132 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
132 commits
Select commit Hold shift + click to select a range
46f69c1
Converting common file to dual-mode source
GTFalcao Jun 9, 2024
c76eed7
New Record dual-mode source
GTFalcao Jun 9, 2024
be27a2a
Adjustments
GTFalcao Jun 9, 2024
3dad78e
Description adjustment
GTFalcao Jun 10, 2024
4b67aa8
source testing
GTFalcao Jun 12, 2024
04b6913
removing test source
GTFalcao Jun 14, 2024
6b08c56
Merge branch 'master' into salesforce-usability-improvements
GTFalcao Jun 15, 2024
cc196b6
Record Deleted - applying flex model
GTFalcao Jun 15, 2024
6a16a4b
adjustment
GTFalcao Jun 15, 2024
65d09cd
Record Updated - applying flex model
GTFalcao Jun 15, 2024
eee3bb2
Applying flex model to 'updated field'
GTFalcao Jun 15, 2024
fba5ab9
Method name adjustments
GTFalcao Jun 15, 2024
7c60629
adjustment
GTFalcao Jun 15, 2024
7978eb6
adjustment
GTFalcao Jun 16, 2024
3a5c607
adjustments
GTFalcao Jun 16, 2024
61e8fbf
Merge branch 'master' into salesforce-usability-improvements
GTFalcao Jun 17, 2024
9807cbe
Merge branch 'master' into salesforce-usability-improvements
GTFalcao Jun 18, 2024
34ecbff
Adding field filtering to 'record updated'
GTFalcao Jun 20, 2024
afd23d5
Merge branch 'master' into salesforce-usability-improvements
GTFalcao Jun 21, 2024
2fd7331
Merge branch 'master' into salesforce-usability-improvements
GTFalcao Jun 21, 2024
d889677
Removing source no longer used
GTFalcao Jun 22, 2024
839a7aa
Merge branch 'master' into salesforce-usability-improvements
GTFalcao Jun 23, 2024
0e4b440
Description adjustment
GTFalcao Jun 23, 2024
f3b4865
New Outbound Message adjustments
GTFalcao Jun 24, 2024
78adc43
Adjusting requests to include $ debug param
GTFalcao Jun 24, 2024
7b7e46c
Description updates
GTFalcao Jun 25, 2024
2d04647
Merge branch 'master' into salesforce-usability-improvements
GTFalcao Jun 28, 2024
103a367
Merge branch 'master' into salesforce-usability-improvements
GTFalcao Jul 1, 2024
8f48dbe
Merge branch 'master' into salesforce-usability-improvements
GTFalcao Jul 1, 2024
04fde4b
Adding $ to remaining requests
GTFalcao Jul 3, 2024
3eb3f30
Merge branch 'master' into salesforce-usability-improvements
GTFalcao Jul 3, 2024
6bb73b5
Version bumps
GTFalcao Jul 3, 2024
bb8dfae
Package update
GTFalcao Jul 3, 2024
e08fc66
pnpm
GTFalcao Jul 3, 2024
385c768
Summary improvements
GTFalcao Jul 3, 2024
cd7bc6d
Merge branch 'master' into salesforce-usability-improvements
GTFalcao Jul 3, 2024
7009d5f
pnpm
GTFalcao Jul 3, 2024
245ee59
Merge branch 'master' into salesforce-usability-improvements
GTFalcao Jul 3, 2024
afa932d
Refined account props
GTFalcao Jul 4, 2024
0ee24c2
Adding static options to account props
GTFalcao Jul 5, 2024
c339a0b
additionalProps mechanism + splitting into initial and extra props
GTFalcao Jul 5, 2024
7fa2bbf
Adjustments for additionalProps model
GTFalcao Jul 6, 2024
7efa109
Adding additionalFields common object
GTFalcao Jul 7, 2024
52b1e86
Attachment props + common props w/ async options
GTFalcao Jul 10, 2024
ee57b90
Merge branch 'master' into salesforce-usability-improvements
GTFalcao Jul 10, 2024
d38111d
Prop adjustments
GTFalcao Jul 10, 2024
6f80db1
Case props and lots of async options props
GTFalcao Jul 10, 2024
b4577b6
Prop adjustments
GTFalcao Jul 10, 2024
746f5d7
Prop updates
GTFalcao Jul 10, 2024
3ae947f
Syntax adjustments
GTFalcao Jul 11, 2024
62ac9b3
Merge branch 'master' into salesforce-usability-improvements
GTFalcao Jul 11, 2024
c2bcd90
CaseComment props
GTFalcao Jul 11, 2024
16d737a
adding prop
GTFalcao Jul 11, 2024
aac6232
Merge branch 'master' into salesforce-usability-improvements
GTFalcao Jul 11, 2024
1278a51
Campaign props
GTFalcao Jul 12, 2024
51e6125
Contact props
GTFalcao Jul 13, 2024
96ed4ca
Event props
GTFalcao Jul 15, 2024
61dbecb
Merge branch 'master' into salesforce-usability-improvements
GTFalcao Jul 15, 2024
c2e652e
Lead fields
GTFalcao Jul 16, 2024
0a8d1a3
Note and Opportunity props
GTFalcao Jul 16, 2024
ab79d55
Task props + reusing and organization
GTFalcao Jul 16, 2024
73f1220
Adjustments
GTFalcao Jul 17, 2024
9aeb011
Fixing record querying
GTFalcao Jul 17, 2024
4a0b480
Adjusting queries for all object types
GTFalcao Jul 17, 2024
0ee8581
Prop reusing
GTFalcao Jul 17, 2024
1075494
Update Account and other adjustments
GTFalcao Jul 17, 2024
a4fcd31
Create Campaign + date prop parsing
GTFalcao Jul 17, 2024
825c1a3
Create Case + adjustments
GTFalcao Jul 17, 2024
2f498cc
Create Case and CaseComment
GTFalcao Jul 17, 2024
a0fd476
Create Contact
GTFalcao Jul 17, 2024
77af6c6
Update Contact + adjustments to async props
GTFalcao Jul 17, 2024
9099313
Create Event + adjustments
GTFalcao Jul 17, 2024
bb85db9
Adding date info alert prop
GTFalcao Jul 17, 2024
64e4923
Create Lead
GTFalcao Jul 17, 2024
4d13e02
Adjusting to ignore dateInfo alert prop
GTFalcao Jul 17, 2024
a8525af
Create Note + adjustments
GTFalcao Jul 17, 2024
8645fb0
Create Task + summary adjustment
GTFalcao Jul 18, 2024
252d5d1
Create Opportunity
GTFalcao Jul 18, 2024
652c840
Update Opportunity + adjustments
GTFalcao Jul 18, 2024
b086e3f
Adjustments
GTFalcao Jul 18, 2024
1c556df
User entity mapping (big!) + adjustments
GTFalcao Jul 20, 2024
31a2582
Create User + adjustments
GTFalcao Jul 20, 2024
8270583
Adjustments on user props
GTFalcao Jul 20, 2024
394c77a
Create attachment + adjustments
GTFalcao Jul 21, 2024
e0df96b
Add Contact to Campaign adjustments
GTFalcao Jul 21, 2024
dbb8189
Merge branch 'master' into salesforce-usability-improvements
GTFalcao Jul 21, 2024
75b87be
SOQL and SOSL search action updates
GTFalcao Jul 21, 2024
3255190
Extra docs info box for SOSL and SOQL
GTFalcao Jul 21, 2024
e666e5f
Add Lead to Campaign + improvements
GTFalcao Jul 21, 2024
dcdfc5d
Delete Record refactoring
GTFalcao Jul 21, 2024
18a730e
Delete Opportunity update
GTFalcao Jul 21, 2024
41f9a91
Post Feed to Chatter updates
GTFalcao Jul 21, 2024
f639029
Search String adjustments
GTFalcao Jul 21, 2024
99aface
Text adjustments and info box on Convert SOAP XML to JSON
GTFalcao Jul 21, 2024
5b3bf35
Create Record + several improvements, and added prop mapping
GTFalcao Jul 22, 2024
aa12585
Adjustments to additionalProps for records
GTFalcao Jul 22, 2024
fc874ee
Creating complete sobject name/namefield mapping
GTFalcao Jul 23, 2024
adab85f
Reusing field to prop generator
GTFalcao Jul 23, 2024
a9d8637
Adjusting actions to use recordId propDefinition
GTFalcao Jul 23, 2024
0ae66dd
Reusing allSobjects mapping for common props
GTFalcao Jul 23, 2024
7beef84
Rename common action file
GTFalcao Jul 23, 2024
58a5c64
Renames
GTFalcao Jul 23, 2024
5f8360b
Update Record + several adjustments
GTFalcao Jul 23, 2024
d7b7977
Update Record adjustments
GTFalcao Jul 23, 2024
3386729
Find Records + adjustments
GTFalcao Jul 23, 2024
684f7a4
Removing deprecated actions
GTFalcao Jul 23, 2024
620eb77
Merge branch 'master' into salesforce-usability-improvements
GTFalcao Jul 23, 2024
5f42c2a
Removing unused stuff
GTFalcao Jul 23, 2024
d469705
Version bumps
GTFalcao Jul 23, 2024
e9df6f7
removing unused props/methods
GTFalcao Jul 23, 2024
9b875d5
Reusing generic record method for individual creates
GTFalcao Jul 24, 2024
3c77992
Reusing record methods for update/delete actions
GTFalcao Jul 24, 2024
efbf924
Syntax improvement
GTFalcao Jul 24, 2024
47cd973
Adjustments
GTFalcao Jul 26, 2024
2c51bb8
Fixing 'create event'
GTFalcao Jul 26, 2024
a5be19f
Removing other fields
GTFalcao Jul 26, 2024
a095b27
Fixed Delete Opportunity
GTFalcao Jul 26, 2024
a21a422
More fixes
GTFalcao Jul 26, 2024
1ad385e
Adding filtering props with describe call
GTFalcao Jul 30, 2024
c6cb436
Fix encoding typo
GTFalcao Jul 30, 2024
a973a4b
Moving async options props to the top
GTFalcao Jul 30, 2024
196a720
Merge branch 'master' into salesforce-usability-improvements
GTFalcao Aug 1, 2024
f02fbbb
Fixed base64 encoding issue
GTFalcao Aug 1, 2024
76e7175
Merge branch 'master' into salesforce-usability-improvements
GTFalcao Aug 2, 2024
6e8fa83
Entity adjustments
GTFalcao Aug 2, 2024
cb198d4
Summary fix
GTFalcao Aug 2, 2024
390491c
Merge branch 'salesforce-usability-improvements' of https://github.co…
GTFalcao Aug 2, 2024
55f1fc5
Merge branch 'master' into salesforce-usability-improvements
GTFalcao Aug 2, 2024
7827e40
Merge branch 'master' into salesforce-usability-improvements
GTFalcao Aug 2, 2024
ff0d7c5
Merge branch 'master' into salesforce-usability-improvements
GTFalcao Aug 4, 2024
a6b10f9
Merge branch 'master' into salesforce-usability-improvements
GTFalcao Aug 5, 2024
79d74c9
Merge branch 'master' into salesforce-usability-improvements
GTFalcao Aug 5, 2024
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
@@ -1,52 +1,52 @@
import salesForceRestApi from "../../salesforce_rest_api.app.mjs";
import {
removeNullEntries, toSingleLineString,
} from "../../common/utils.mjs";
import salesforce from "../../salesforce_rest_api.app.mjs";
import constants from "../../common/constants.mjs";

export default {
key: "salesforce_rest_api-add-contact-to-campaign",
name: "Add Contact to Campaign",
description: toSingleLineString(`
Adds an existing contact to an existing campaign.
See [Event SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_campaignmember.htm)
and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm)
`),
version: "0.0.6",
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)",
version: "0.1.0",
type: "action",
props: {
salesForceRestApi,
salesforce,
campaignId: {
propDefinition: [
salesForceRestApi,
"sobjectId",
salesforce,
"recordId",
() => ({
objectType: constants.OBJECT_TYPE.CAMPAIGN,
objType: "Campaign",
nameField: "Name",
}),
],
label: "Campaign ID",
description: "ID of the Campaign to which this Lead is associated.",
description: "The Campaign to add a Contact to.",
},
contactId: {
propDefinition: [
salesForceRestApi,
"sobjectId",
salesforce,
"recordId",
() => ({
objectType: constants.OBJECT_TYPE.CONTACT,
objType: "Contact",
nameField: "Name",
}),
],
label: "Contact ID",
description: "ID of the Contact who is associated with a Campaign.",
description: "The Contact to add to the selected Campaign.",
},
},
async run({ $ }) {
const data = removeNullEntries({
CampaignId: this.campaignId,
ContactId: this.contactId,
const {
salesforce, campaignId, contactId,
} = this;
const response = await salesforce.createObject({
$,
objectType: constants.OBJECT_TYPE.CAMPAIGN_MEMBER,
data: {
CampaignId: campaignId,
ContactId: contactId,
},
});
const response = await this.salesForceRestApi
.createObject(constants.OBJECT_TYPE.CAMPAIGN_MEMBER, data);
response && $.export("$summary", "Successfully added contact to campaign");
$.export("$summary", `Successfully added contact (ID: ${contactId}) to campaign (ID: ${campaignId})`);
return response;
},
};
Original file line number Diff line number Diff line change
@@ -1,51 +1,52 @@
import salesForceRestApi from "../../salesforce_rest_api.app.mjs";
import {
removeNullEntries, toSingleLineString,
} from "../../common/utils.mjs";
import salesforce from "../../salesforce_rest_api.app.mjs";
import constants from "../../common/constants.mjs";

export default {
key: "salesforce_rest_api-add-lead-to-campaign",
name: "Add Lead to Campaign",
description: toSingleLineString(`
Adds an existing lead to an existing campaign.
See [Event SObject](https://developer.salesforce.com/docs/atlas.en-us.228.0.object_reference.meta/object_reference/sforce_api_objects_campaignmember.htm)
and [Create Record](https://developer.salesforce.com/docs/atlas.en-us.228.0.api_rest.meta/api_rest/dome_sobject_create.htm)
`),
version: "0.0.6",
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)",
version: "0.1.0",
type: "action",
props: {
salesForceRestApi,
salesforce,
campaignId: {
propDefinition: [
salesForceRestApi,
"sobjectId",
salesforce,
"recordId",
() => ({
objectType: constants.OBJECT_TYPE.CAMPAIGN,
objType: "Campaign",
nameField: "Name",
}),
],
label: "Campaign ID",
description: "ID of the Campaign to which this Lead is associated.",
description: "The Campaign to add a Lead to.",
},
leadId: {
propDefinition: [
salesForceRestApi,
"sobjectId",
salesforce,
"recordId",
() => ({
objectType: constants.OBJECT_TYPE.LEAD,
objType: "Lead",
nameField: "Name",
}),
],
label: "Lead ID",
description: "ID of the Lead who is associated with a Campaign.",
description: "The Lead to add to the selected Campaign.",
},
},
async run({ $ }) {
const data = removeNullEntries({
CampaignId: this.campaignId,
LeadId: this.leadId,
const {
salesforce, campaignId, leadId,
} = this;
const response = await salesforce.createObject({
$,
objectType: constants.OBJECT_TYPE.CAMPAIGN_MEMBER,
data: {
CampaignId: campaignId,
LeadId: leadId,
},
});
const response = await this.salesForceRestApi.createObject("CampaignMember", data);
response && $.export("$summary", "Successfully added lead to campaign");
$.export("$summary", `Successfully added lead (ID: ${leadId}) to campaign (ID: ${campaignId})`);
return response;
},
};
108 changes: 108 additions & 0 deletions components/salesforce_rest_api/actions/common/base-create-update.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import { ConfigurationError } from "@pipedream/platform";
import salesforce from "../../salesforce_rest_api.app.mjs";
import { getAdditionalFields } from "../../common/props-utils.mjs";

export const additionalFields = {
type: "object",
label: "Additional Fields",
description:
"Other fields to set for this record. Values will be parsed as JSON where applicable.",
optional: true,
};

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",
showDateInfo = false,
}) {
let { initialProps } = objType;
if (initialProps && createOrUpdate === "update") {
initialProps = Object.fromEntries(
Object.entries(initialProps).map(([
key,
value,
]) => [
key,
{
...value,
optional: true,
},
]),
);
}

return {
salesforce,
...showDateInfo && {
dateInfo: {
type: "alert",
alertType: "warning",
content: "Date fields should be a [valid date string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#date_time_string_format) or a Unix timestamp in milliseconds. Example values: `2022-01-15T18:30:00.000Z` or `1642271400000`.",
},
},
...objType[createOrUpdate === "create"
? "createProps"
: "updateProps"],
...initialProps,
docsInfo: {
type: "alert",
alertType: "info",
content: `[See the documentation](${docsLink}) for more information on available fields.`,
},
useAdvancedProps: {
propDefinition: [
salesforce,
"useAdvancedProps",
],
},
};
}

export default {
methods: {
getObjectType() {
return "";
},
getAdvancedProps() {
return {};
},
getAdditionalFields,
formatDateTimeProps(props = {}) {
// https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_valid_date_formats.htm
return Object.fromEntries(Object.entries(props).filter(([
, value,
]) => value !== undefined)
.map(([
key,
value,
]) => {
const numValue = Number(value);
const date = new Date(Number.isNaN(numValue)
? value
: numValue);
if (Number.isNaN(date.valueOf())) {
throw new ConfigurationError(`Invalid date format for prop \`${key}\`. Please provide a valid date format.`);
}
return [
key,
date.toISOString(),
];
}));
},
},
async additionalProps() {
const objectType = this.getObjectType();
if (!this.useAdvancedProps || !objectType) return {};

const fields = (await this.salesforce.getFieldsForObjectType(objectType));
const fieldNames = fields.map((f) => f.name);
const filteredProps = Object.fromEntries(Object.entries(this.getAdvancedProps()).filter(([
key,
]) => fieldNames.includes(key) || key[0] === key[0].toLowerCase()));
return {
...filteredProps,
additionalFields,
};
},
};
18 changes: 0 additions & 18 deletions components/salesforce_rest_api/actions/common/base.mjs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,17 @@ export default {
key: "salesforce_rest_api-convert-soap-xml-to-json",
name: "Convert SOAP XML Object to JSON",
description: "Converts a SOAP XML Object received from Salesforce to JSON",
version: "0.0.5",
version: "0.0.6",
type: "action",
props: {
salesforce_rest_api,
infoBox: {
type: "alert",
alertType: "info",
content: `This action is useful in conjunction with Salesforce Flow Builder, and is primarily used if Instant triggers are not working for your use case.
\\
[See the documentation](https://pipedream.com/apps/salesforce-rest-api#troubleshooting) for more details.`,
},
xml: {
type: "string",
label: "XML Soap Object",
Expand All @@ -17,14 +24,14 @@ export default {
extractNotificationOnly: {
type: "boolean",
label: "Extract Notifications Only",
description: "Extracts only the notification parts from the XML. Default: `true`.",
description: "Whether to extract only the notification parts from the XML. Default: `true`.",
optional: true,
default: true,
},
failOnError: {
type: "boolean",
label: "Fail on Error",
description: "If should fail on error when extracting notifications. Default: `false`.",
description: "Whether the action should fail if an error occurs when extracting notifications. Default: `false`.",
optional: true,
default: false,
},
Expand All @@ -44,6 +51,7 @@ export default {
try {
const notifications = json.elements[0].elements[0].elements[0].elements
.filter(({ name }) => name === "Notification");
$.export("$summary", "Successfully converted to JSON and extracted notifications");
return {
notifications,
};
Expand Down
Loading
Loading