Skip to content

Commit 7030774

Browse files
authored
Merging pull request #18875
* new sources * versions
1 parent c710b28 commit 7030774

File tree

14 files changed

+334
-8
lines changed

14 files changed

+334
-8
lines changed

components/microsoft_dynamics_365_sales/actions/create-custom-entity/create-custom-entity.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
key: "microsoft_dynamics_365_sales-create-custom-entity",
77
name: "Create Custom Entity",
88
description: "Create a custom entity. [See the documentation](https://learn.microsoft.com/en-us/power-apps/developer/data-platform/webapi/create-update-entity-definitions-using-web-api)",
9-
version: "0.0.4",
9+
version: "0.0.5",
1010
annotations: {
1111
destructiveHint: true,
1212
openWorldHint: true,

components/microsoft_dynamics_365_sales/actions/find-contact/find-contact.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "microsoft_dynamics_365_sales-find-contact",
55
name: "Find Contact",
66
description: "Search for a contact by id, name, or using a custom filter. [See the documentation](https://learn.microsoft.com/en-us/power-apps/developer/data-platform/webapi/query/overview)",
7-
version: "0.0.4",
7+
version: "0.0.5",
88
annotations: {
99
destructiveHint: false,
1010
openWorldHint: true,

components/microsoft_dynamics_365_sales/microsoft_dynamics_365_sales.app.mjs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,27 @@ export default {
3333
})) || [];
3434
},
3535
},
36+
opportunityId: {
37+
type: "string",
38+
label: "Opportunity ID",
39+
description: "Identifier of an opportunity",
40+
async options({ prevContext }) {
41+
const response = await this.listOpportunities({
42+
url: prevContext?.url,
43+
});
44+
return {
45+
options: response.value?.map(({
46+
opportunityid: value, name: label,
47+
}) => ({
48+
value,
49+
label,
50+
})) || [],
51+
context: {
52+
url: response["@odata.nextLink"],
53+
},
54+
};
55+
},
56+
},
3657
},
3758
methods: {
3859
_baseUrl() {
@@ -92,6 +113,12 @@ export default {
92113
...opts,
93114
});
94115
},
116+
listActivityPointers(opts = {}) {
117+
return this._makeRequest({
118+
path: "/activitypointers",
119+
...opts,
120+
});
121+
},
95122
getEntity({
96123
entityId, ...opts
97124
}) {

components/microsoft_dynamics_365_sales/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/microsoft_dynamics_365_sales",
3-
"version": "0.2.0",
3+
"version": "0.3.0",
44
"description": "Pipedream Microsoft Dynamics 365 Sales Components",
55
"main": "microsoft_dynamics_365_sales.app.mjs",
66
"keywords": [
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import common from "../common/common.mjs";
2+
3+
export default {
4+
...common,
5+
key: "microsoft_dynamics_365_sales-new-opportunity-activity",
6+
name: "New Opportunity Activity",
7+
description: "Emit new event when a new task or activity is created for an opportunity.",
8+
version: "0.0.1",
9+
type: "source",
10+
dedupe: "unique",
11+
props: {
12+
...common.props,
13+
opportunityId: {
14+
propDefinition: [
15+
common.props.microsoftDynamics365Sales,
16+
"opportunityId",
17+
],
18+
},
19+
},
20+
methods: {
21+
...common.methods,
22+
getResourceFn() {
23+
return this.microsoftDynamics365Sales.listActivityPointers;
24+
},
25+
getArgs() {
26+
return {
27+
params: {
28+
"$orderby": "createdon desc",
29+
"$filter": `_regardingobjectid_value eq ${this.opportunityId}`,
30+
},
31+
};
32+
},
33+
getTsField() {
34+
return "createdon";
35+
},
36+
generateMeta(activity) {
37+
const ts = Date.parse(activity.createdon);
38+
return {
39+
id: `${activity.opportunityid}${ts}`,
40+
summary: `New Opportunity Activity: ${activity.subject}`,
41+
ts,
42+
};
43+
},
44+
},
45+
};

components/microsoft_dynamics_365_sales/sources/new-opportunity-created/new-opportunity-created.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "microsoft_dynamics_365_sales-new-opportunity-created",
66
name: "New Opportunity Created",
77
description: "Emit new event when a new opportunity is created.",
8-
version: "0.0.1",
8+
version: "0.0.2",
99
type: "source",
1010
dedupe: "unique",
1111
hooks: {

components/microsoft_dynamics_365_sales/sources/opportunity-close-date-updated/opportunity-close-date-updated.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "microsoft_dynamics_365_sales-opportunity-close-date-updated",
66
name: "Opportunity Close Date Updated",
77
description: "Emit new event when the estimated close date of an opportunity is updated.",
8-
version: "0.0.1",
8+
version: "0.0.2",
99
type: "source",
1010
dedupe: "unique",
1111
methods: {

components/microsoft_dynamics_365_sales/sources/opportunity-close-probability-updated/opportunity-close-probability-updated.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "microsoft_dynamics_365_sales-opportunity-close-probability-updated",
66
name: "Opportunity Close Probability Updated",
77
description: "Emit new event when the close probability of an opportunity is updated.",
8-
version: "0.0.1",
8+
version: "0.0.2",
99
type: "source",
1010
dedupe: "unique",
1111
methods: {
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import common from "../common/common.mjs";
2+
3+
export default {
4+
...common,
5+
key: "microsoft_dynamics_365_sales-opportunity-contact-changed",
6+
name: "Opportunity Contact Changed",
7+
description: "Emit new event when an opportunity's contact is changed.",
8+
version: "0.0.{{ts}}",
9+
type: "source",
10+
dedupe: "unique",
11+
methods: {
12+
...common.methods,
13+
_getContactIds() {
14+
return this.db.get("contactIds") || {};
15+
},
16+
_setContactIds(contactIds) {
17+
this.db.set("contactIds", contactIds);
18+
},
19+
getResourceFn() {
20+
return this.microsoftDynamics365Sales.listOpportunities;
21+
},
22+
getArgs() {
23+
return {
24+
params: {
25+
"$orderby": "modifiedon desc",
26+
},
27+
};
28+
},
29+
getTsField() {
30+
return "modifiedon";
31+
},
32+
getRelevantResults(results) {
33+
const contactIds = this._getContactIds();
34+
const relevantResults = [];
35+
for (const result of results) {
36+
if (contactIds[result.opportunityid] !== result._parentcontactid_value) {
37+
if (contactIds[result.opportunityid]) {
38+
relevantResults.push(result);
39+
}
40+
contactIds[result.opportunityid] = result._parentcontactid_value;
41+
}
42+
}
43+
this._setContactIds(contactIds);
44+
return relevantResults;
45+
},
46+
generateMeta(opportunity) {
47+
const ts = Date.parse(opportunity.modifiedon);
48+
return {
49+
id: `${opportunity.opportunityid}${ts}`,
50+
summary: `Opportunity Contact Changed: ${opportunity.name}`,
51+
ts,
52+
};
53+
},
54+
},
55+
};

components/microsoft_dynamics_365_sales/sources/opportunity-estimated-value-updated/opportunity-estimated-value-updated.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "microsoft_dynamics_365_sales-opportunity-estimated-value-updated",
66
name: "Opportunity Estimated Value Updated",
77
description: "Emit new event when the estimated value of an opportunity is updated.",
8-
version: "0.0.1",
8+
version: "0.0.2",
99
type: "source",
1010
dedupe: "unique",
1111
methods: {

0 commit comments

Comments
 (0)