Skip to content

Commit 1f30302

Browse files
committed
Adjustments
1 parent 3572753 commit 1f30302

File tree

2 files changed

+60
-15
lines changed

2 files changed

+60
-15
lines changed

components/salesloft/actions/create-note/create-note.mjs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,22 @@ export default {
1313
label: "Content",
1414
description: "The content of the note",
1515
},
16-
associatedWithId: {
17-
type: "string",
18-
label: "Associated With ID",
19-
description: "The ID of the record this note is associated with (e.g., a person ID)",
20-
},
2116
associatedWithType: {
2217
type: "string",
23-
label: "Associated With Type",
18+
label: "Associated Record Type",
2419
description: "The type of record this note is associated with",
2520
options: [
26-
"Person",
27-
"Account",
21+
"person",
22+
"account",
23+
],
24+
},
25+
associatedWithId: {
26+
propDefinition: [
27+
salesloft,
28+
"recordId",
29+
({ associatedWithType }) => ({
30+
recordType: associatedWithType,
31+
}),
2832
],
2933
},
3034
skipActivities: {

components/salesloft/salesloft.app.mjs

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import { axios } from "@pipedream/platform";
1+
import {
2+
axios, ConfigurationError,
3+
} from "@pipedream/platform";
24

35
export default {
46
type: "app",
@@ -9,30 +11,63 @@ export default {
911
label: "Person ID",
1012
description: "Select a person to add to the cadence or provide a person ID",
1113
async options({ page }) {
12-
const { data } = await this.listPeople({
14+
const people = await this.listPeople({
1315
params: {
1416
per_page: 100,
1517
page: page + 1,
1618
},
1719
});
18-
return data?.map((person) => ({
20+
return people?.map((person) => ({
1921
label: person.full_email_address ?? person.email_address ?? person.display_name,
2022
value: person.id,
2123
}));
2224
},
2325
},
26+
recordId: {
27+
type: "string",
28+
label: "Associated Record ID",
29+
description: "Select a record (a person or account) to associate this note with",
30+
async options({
31+
page, recordType,
32+
}) {
33+
if (recordType === "person") {
34+
const people = await this.listPeople({
35+
params: {
36+
per_page: 100,
37+
page: page + 1,
38+
},
39+
});
40+
return people?.map((person) => ({
41+
label: person.full_email_address ?? person.email_address ?? person.display_name,
42+
value: person.id,
43+
}));
44+
} else if (recordType === "account") {
45+
const accounts = await this.listAccounts({
46+
params: {
47+
per_page: 100,
48+
page: page + 1,
49+
},
50+
});
51+
return accounts?.map((account) => ({
52+
label: account.name,
53+
value: account.id,
54+
}));
55+
} else throw new ConfigurationError("Invalid record type, select either `person` or `account`");
56+
},
57+
},
2458
cadenceId: {
2559
type: "string",
2660
label: "Cadence ID",
2761
description: "Select a cadence or provide a cadence ID",
2862
async options({ page }) {
29-
const { data } = await this.listCadences({
63+
const cadences = await this.listCadences({
3064
params: {
3165
per_page: 100,
3266
page: page + 1,
3367
},
3468
});
35-
return data?.map((cadence) => ({
69+
console.log(cadences);
70+
return cadences?.map((cadence) => ({
3671
label: cadence.name,
3772
value: cadence.id,
3873
}));
@@ -44,13 +79,13 @@ export default {
4479
description: "Select a user who will own this cadence membership or provide a user ID. Defaults to the authenticated user if not provided.",
4580
optional: true,
4681
async options({ page }) {
47-
const { data } = await this.listUsers({
82+
const users = await this.listUsers({
4883
params: {
4984
per_page: 100,
5085
page: page + 1,
5186
},
5287
});
53-
return data?.map((user) => ({
88+
return users?.map((user) => ({
5489
label: user.name ?? user.email,
5590
value: user.id,
5691
}));
@@ -127,5 +162,11 @@ export default {
127162
...args,
128163
});
129164
},
165+
async listAccounts(args = {}) {
166+
return this._makeRequest({
167+
path: "/accounts",
168+
...args,
169+
});
170+
},
130171
},
131172
};

0 commit comments

Comments
 (0)