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
2 changes: 1 addition & 1 deletion bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,8 @@
"packages/pieces/framework",
"packages/pieces/common",
"packages/pieces/core/*",
"packages/pieces/community/*"
"packages/pieces/community/*",
"packages/pieces/custom/*"
],
"resolutions": {
"rollup": "npm:@rollup/wasm-node"
Expand Down
2 changes: 1 addition & 1 deletion packages/pieces/community/salesforce/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-salesforce",
"version": "0.5.3",
"version": "0.6.0",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"scripts": {
Expand Down
184 changes: 92 additions & 92 deletions packages/pieces/community/salesforce/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {
PieceAuth,
Property,
createPiece,
OAuth2PropertyValue,
PieceAuth,
Property,
createPiece,
OAuth2PropertyValue,
} from '@activepieces/pieces-framework';
import { PieceCategory } from '@activepieces/shared';
import { createCustomApiCallAction } from '@activepieces/pieces-common';
Expand Down Expand Up @@ -42,97 +42,97 @@ import { newOutboundMessage } from './lib/trigger/new-outbound-message';
import { newRecord } from './lib/trigger/new-record';
import { newUpdatedFile } from './lib/trigger/new-updated-file';
import { exportReport } from './lib/action/export-report';
import { newCaseCreatedTrigger } from './lib/trigger/new-case';
import { newCaseCreatedTrigger } from './lib/trigger/new-case-in-queue';

export const salesforceAuth = PieceAuth.OAuth2({
props: {
environment: Property.StaticDropdown({
displayName: 'Environment',
description: 'Choose environment',
required: true,
options: {
options: [
{
label: 'Production',
value: 'login',
},
{
label: 'Development',
value: 'test',
},
],
},
defaultValue: 'login',
}),
},
required: true,
description: 'Authenticate with Salesforce Production',
authUrl: 'https://{environment}.salesforce.com/services/oauth2/authorize',
tokenUrl: 'https://{environment}.salesforce.com/services/oauth2/token',
scope: ['refresh_token', 'full', 'api'],
props: {
environment: Property.StaticDropdown({
displayName: 'Environment',
description: 'Choose environment',
required: true,
options: {
options: [
{
label: 'Production',
value: 'login',
},
{
label: 'Development',
value: 'test',
},
],
},
defaultValue: 'login',
}),
},
required: true,
description: 'Authenticate with Salesforce Production',
authUrl: 'https://{environment}.salesforce.com/services/oauth2/authorize',
tokenUrl: 'https://{environment}.salesforce.com/services/oauth2/token',
scope: ['refresh_token', 'full', 'api'],
});

export const salesforce = createPiece({
displayName: 'Salesforce',
description: 'CRM software solutions and enterprise cloud computing',
minimumSupportedRelease: '0.30.0',
logoUrl: 'https://cdn.activepieces.com/pieces/salesforce.png',
authors: [
'HKudria',
'tanoggy',
'landonmoir',
'kishanprmr',
'khaledmashaly',
'abuaboud',
'Pranith124',
'sanket-a11y',
],
categories: [PieceCategory.SALES_AND_CRM],
auth: salesforceAuth,
actions: [
addContactToCampaign,
addFileToRecord,
addLeadToCampaign,
createAttachment,
createCase,
createContact,
createLead,
createNote,
createOpportunity,
createRecord,
createTask,
deleteOpportunity,
deleteRecord,
exportReport,
findChildRecords,
findRecord,
findRecordsByQuery,
getRecordAttachments,
runQuery,
runReport,
sendEmail,
updateContact,
updateLead,
updateRecord,
upsertByExternalId,
upsertByExternalIdBulk,
createCustomApiCallAction({
baseUrl: (auth) => (auth as OAuth2PropertyValue).data['instance_url'],
auth: salesforceAuth,
authMapping: async (auth) => ({
Authorization: `Bearer ${(auth as OAuth2PropertyValue).access_token}`,
}),
}),
],
triggers: [
newCaseAttachment,
newContact,
newFieldHistoryEvent,
newLead,
newOrUpdatedRecord,
newOutboundMessage,
newRecord,
newUpdatedFile,
newCaseCreatedTrigger,
],
displayName: 'Salesforce',
description: 'CRM software solutions and enterprise cloud computing',
minimumSupportedRelease: '0.30.0',
logoUrl: 'https://cdn.activepieces.com/pieces/salesforce.png',
authors: [
'HKudria',
'tanoggy',
'landonmoir',
'kishanprmr',
'khaledmashaly',
'abuaboud',
'Pranith124',
'sanket-a11y',
],
categories: [PieceCategory.SALES_AND_CRM],
auth: salesforceAuth,
actions: [
addContactToCampaign,
addFileToRecord,
addLeadToCampaign,
createAttachment,
createCase,
createContact,
createLead,
createNote,
createOpportunity,
createRecord,
createTask,
deleteOpportunity,
deleteRecord,
exportReport,
findChildRecords,
findRecord,
findRecordsByQuery,
getRecordAttachments,
runQuery,
runReport,
sendEmail,
updateContact,
updateLead,
updateRecord,
upsertByExternalId,
upsertByExternalIdBulk,
createCustomApiCallAction({
baseUrl: (auth) => (auth as OAuth2PropertyValue).data['instance_url'],
auth: salesforceAuth,
authMapping: async (auth) => ({
Authorization: `Bearer ${(auth as OAuth2PropertyValue).access_token}`,
}),
}),
],
triggers: [
newCaseAttachment,
newContact,
newFieldHistoryEvent,
newLead,
newOrUpdatedRecord,
newOutboundMessage,
newRecord,
newUpdatedFile,
newCaseCreatedTrigger,
],
});
39 changes: 39 additions & 0 deletions packages/pieces/community/salesforce/src/lib/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,45 @@ export const salesforcesCommon = {
}
},
}),
caseQueueId: Property.Dropdown({
auth: salesforceAuth,
displayName: 'Case Queue',
description: 'The queue to monitor for new cases.',
required: true,
refreshers: [],
refreshOnSearch: true,
options: async ({ auth }, { searchValue }) => {
if (!auth) {
return {
disabled: true,
placeholder: 'Connect your account first',
options: [],
};
}

let query = `
SELECT QueueId, Queue.Name
FROM QueueSobject
WHERE SobjectType = 'Case'
`;

if (searchValue) {
const sanitizedSearch = searchValue.replace(/'/g, "\\'");
query += ` AND Queue.Name LIKE '${sanitizedSearch}%'`;
}

const response = await querySalesforceApi<{
records: { QueueId: string; Queue: { Name: string } }[];
}>(HttpMethod.GET, auth as OAuth2PropertyValue, query);
return {
disabled: false,
options: response.body.records.map((record) => ({
label: record.Queue.Name,
value: record.QueueId,
})),
};
},
}),
optionalContact: Property.Dropdown({
auth: salesforceAuth,
displayName: 'Contact',
Expand Down
Loading
Loading