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 @@ -6,7 +6,7 @@ export default {
key: "microsoft_dynamics_365_sales-create-custom-entity",
name: "Create Custom Entity",
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)",
version: "0.0.5",
version: "0.0.6",
annotations: {
destructiveHint: true,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "microsoft_dynamics_365_sales-find-contact",
name: "Find Contact",
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)",
version: "0.0.5",
version: "0.0.6",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,20 @@ export default {
};
},
},
accountId: {
type: "string",
label: "Account ID",
description: "Identifier of an account",
async options() {
const { value } = await this.listAccounts();
return value?.map(({
accountid: value, name: label,
}) => ({
value,
label,
})) || [];
},
},
},
methods: {
_baseUrl() {
Expand Down Expand Up @@ -119,6 +133,12 @@ export default {
...opts,
});
},
listAccounts(opts = {}) {
return this._makeRequest({
path: "/accounts",
...opts,
});
},
getEntity({
entityId, ...opts
}) {
Expand Down
2 changes: 1 addition & 1 deletion components/microsoft_dynamics_365_sales/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/microsoft_dynamics_365_sales",
"version": "0.3.0",
"version": "0.4.0",
"description": "Pipedream Microsoft Dynamics 365 Sales Components",
"main": "microsoft_dynamics_365_sales.app.mjs",
"keywords": [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import common from "../common/common.mjs";

export default {
...common,
key: "microsoft_dynamics_365_sales-account-ownership-changed",
name: "Account Ownership Changed",

Check warning on line 6 in components/microsoft_dynamics_365_sales/sources/account-ownership-changed/account-ownership-changed.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
description: "Emit new event when the ownership of an account changes.",
version: "0.0.1",
type: "source",
dedupe: "unique",
methods: {
...common.methods,
_getOwnershipIds() {
return this.db.get("ownershipIds") || {};
},
_setOwnershipIds(ownershipIds) {
this.db.set("ownershipIds", ownershipIds);
},
getResourceFn() {
return this.microsoftDynamics365Sales.listAccounts;
},
getArgs() {
return {
params: {
"$orderby": "modifiedon desc",
},
};
},
getTsField() {
return "modifiedon";
},
getRelevantResults(results) {
const ownershipIds = this._getOwnershipIds();
const relevantResults = [];
for (const result of results) {
if (ownershipIds[result.accountid] !== result._ownerid_value) {
if (ownershipIds[result.accountid]) {
relevantResults.push(result);
}
ownershipIds[result.accountid] = result._ownerid_value;
}
}
this._setOwnershipIds(ownershipIds);
return relevantResults;
},
generateMeta(account) {
const ts = Date.parse(account.modifiedon);
return {
id: `${account.accountid}${ts}`,
summary: `Account Ownership Changed: ${account.name}`,
ts,
};
},
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import common from "../common/common.mjs";

export default {
...common,
key: "microsoft_dynamics_365_sales-account-status-changed",
name: "Account Status Changed",

Check warning on line 6 in components/microsoft_dynamics_365_sales/sources/account-status-changed/account-status-changed.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
description: "Emit new event when an account is activated or deactivated.",
version: "0.0.1",
type: "source",
dedupe: "unique",
methods: {
...common.methods,
_getStatuses() {
return this.db.get("statuses") || {};
},
_setStatuses(statuses) {
this.db.set("statuses", statuses);
},
getResourceFn() {
return this.microsoftDynamics365Sales.listAccounts;
},
getArgs() {
return {
params: {
"$orderby": "modifiedon desc",
},
};
},
getTsField() {
return "modifiedon";
},
getRelevantResults(results) {
const statuses = this._getStatuses();
const relevantResults = [];
for (const result of results) {
if (statuses[result.accountid] !== result.statuscode) {
if (statuses[result.accountid]) {
relevantResults.push(result);
}
statuses[result.accountid] = result.statuscode;
}
}
this._setStatuses(statuses);
return relevantResults;
},
generateMeta(account) {
const ts = Date.parse(account.modifiedon);
return {
id: `${account.accountid}${ts}`,
summary: `Account Status Changed: ${account.name}`,
ts,
};
},
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import common from "../common/common.mjs";

export default {
...common,
key: "microsoft_dynamics_365_sales-contact-added-to-account",
name: "Contact Added to Account",

Check warning on line 6 in components/microsoft_dynamics_365_sales/sources/contact-added-to-account/contact-added-to-account.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
description: "Emit new event when a contact is added to an account.",
version: "0.0.1",
type: "source",
dedupe: "unique",
props: {
...common.props,
accountId: {
propDefinition: [
common.props.microsoftDynamics365Sales,
"accountId",
],
},
},
methods: {
...common.methods,
getResourceFn() {
return this.microsoftDynamics365Sales.listAccounts;
},
getArgs() {
return {
params: {
"$filter": `accountid eq ${this.accountId}`,
"$expand": "contact_customer_accounts",
},
};
},
getTsField() {
return "modifiedon";
},
getRelevantResults(results) {
const relevantResults = [];
const account = results[0];
account.contact_customer_accounts.forEach((contact) => {
relevantResults.push({
...contact,
addedToAccountOn: account.modifiedon,
});
});
return relevantResults;
},
generateMeta(contact) {
const ts = Date.parse(contact.addedToAccountOn);
return {
id: `${contact.contactid}${ts}`,
summary: `Contact Added to Account: ${contact.fullname}`,
ts,
};
},
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import common from "../common/common.mjs";

export default {
...common,
key: "microsoft_dynamics_365_sales-new-account-activity",
name: "New Account Activity",
description: "Emit new event when a new task or activity is created for an account.",
version: "0.0.1",
type: "source",
dedupe: "unique",
props: {
...common.props,
accountId: {
propDefinition: [
common.props.microsoftDynamics365Sales,
"accountId",
],
},
},
methods: {
...common.methods,
getResourceFn() {
return this.microsoftDynamics365Sales.listActivityPointers;
},
getArgs() {
return {
params: {
"$orderby": "createdon desc",
"$filter": `_regardingobjectid_value eq ${this.accountId}`,
},
};
},
getTsField() {
return "createdon";
},
generateMeta(activity) {
const ts = Date.parse(activity.createdon);
return {
id: `${activity.accountid}${ts}`,
summary: `New Account Activity: ${activity.subject}`,
ts,
};
},
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import common from "../common/common.mjs";

export default {
...common,
key: "microsoft_dynamics_365_sales-new-account-created",
name: "New Account Created",
description: "Emit new event when a new account is created.",
version: "0.0.1",
type: "source",
dedupe: "unique",
methods: {
...common.methods,
getResourceFn() {
return this.microsoftDynamics365Sales.listAccounts;
},
getArgs() {
return {
params: {
"$orderby": "createdon desc",
},
};
},
getTsField() {
return "createdon";
},
generateMeta(account) {
return {
id: account.accountid,
summary: `New Account: ${account.name}`,
ts: Date.parse(account.createdon),
};
},
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "microsoft_dynamics_365_sales-new-opportunity-activity",
name: "New Opportunity Activity",
description: "Emit new event when a new task or activity is created for an opportunity.",
version: "0.0.1",
version: "0.0.2",
type: "source",
dedupe: "unique",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "microsoft_dynamics_365_sales-new-opportunity-created",
name: "New Opportunity Created",
description: "Emit new event when a new opportunity is created.",
version: "0.0.2",
version: "0.0.3",
type: "source",
dedupe: "unique",
hooks: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
export default {
...common,
key: "microsoft_dynamics_365_sales-opportunity-close-date-updated",
name: "Opportunity Close Date Updated",

Check warning on line 6 in components/microsoft_dynamics_365_sales/sources/opportunity-close-date-updated/opportunity-close-date-updated.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
description: "Emit new event when the estimated close date of an opportunity is updated.",
version: "0.0.2",
version: "0.0.3",
type: "source",
dedupe: "unique",
methods: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
export default {
...common,
key: "microsoft_dynamics_365_sales-opportunity-close-probability-updated",
name: "Opportunity Close Probability Updated",

Check warning on line 6 in components/microsoft_dynamics_365_sales/sources/opportunity-close-probability-updated/opportunity-close-probability-updated.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
description: "Emit new event when the close probability of an opportunity is updated.",
version: "0.0.2",
version: "0.0.3",
type: "source",
dedupe: "unique",
methods: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
export default {
...common,
key: "microsoft_dynamics_365_sales-opportunity-contact-changed",
name: "Opportunity Contact Changed",

Check warning on line 6 in components/microsoft_dynamics_365_sales/sources/opportunity-contact-changed/opportunity-contact-changed.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
description: "Emit new event when an opportunity's contact is changed.",
version: "0.0.{{ts}}",
version: "0.0.2",
type: "source",
dedupe: "unique",
methods: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
export default {
...common,
key: "microsoft_dynamics_365_sales-opportunity-estimated-value-updated",
name: "Opportunity Estimated Value Updated",

Check warning on line 6 in components/microsoft_dynamics_365_sales/sources/opportunity-estimated-value-updated/opportunity-estimated-value-updated.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
description: "Emit new event when the estimated value of an opportunity is updated.",
version: "0.0.2",
version: "0.0.3",
type: "source",
dedupe: "unique",
methods: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
export default {
...common,
key: "microsoft_dynamics_365_sales-opportunity-marked-won-or-lost",
name: "Opportunity Marked Won or Lost",

Check warning on line 6 in components/microsoft_dynamics_365_sales/sources/opportunity-marked-won-or-lost/opportunity-marked-won-or-lost.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
description: "Emit new event when an opportunity is marked as won or lost.",
version: "0.0.1",
version: "0.0.2",
type: "source",
dedupe: "unique",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
export default {
...common,
key: "microsoft_dynamics_365_sales-opportunity-ownership-changed",
name: "Opportunity Ownership Changed",

Check warning on line 6 in components/microsoft_dynamics_365_sales/sources/opportunity-ownership-changed/opportunity-ownership-changed.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
description: "Emit new event when the ownership of an opportunity changes.",
version: "0.0.1",
version: "0.0.2",
type: "source",
dedupe: "unique",
methods: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
export default {
...common,
key: "microsoft_dynamics_365_sales-opportunity-reopened",
name: "Opportunity Reopened",

Check warning on line 6 in components/microsoft_dynamics_365_sales/sources/opportunity-reopened/opportunity-reopened.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
description: "Emit new event when an opportunity is reopened.",
version: "0.0.1",
version: "0.0.2",
type: "source",
dedupe: "unique",
methods: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "microsoft_dynamics_365_sales-opportunity-stage-updated",
name: "Opportunity Stage Updated",
description: "Emit new event when the stage of an opportunity is updated.",
version: "0.0.2",
version: "0.0.3",
type: "source",
dedupe: "unique",
methods: {
Expand Down
Loading