Skip to content

feat(integrations): add Dynamics 365 CRM - #6714

Merged
waleedlatif1 merged 8 commits into
stagingfrom
feat/microsoft-dynamics-365
Aug 28, 2026
Merged

feat(integrations): add Dynamics 365 CRM#6714
waleedlatif1 merged 8 commits into
stagingfrom
feat/microsoft-dynamics-365

Conversation

@BillLeoutsakosvl346

@BillLeoutsakosvl346 BillLeoutsakosvl346 commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a ten-operation Microsoft Dynamics 365 CRM block backed by eight isolated CRM tool modules
  • add environment-bound Microsoft Dataverse OAuth while preserving legacy Dataverse credentials and flows
  • enforce credential-derived environments, strict response parsing, redirect-safe bearer handling, and bounded one-page pagination
  • preserve the exact Dataverse nextLink while pairing it with the page size required for the next request
  • align Opportunity Close and Case Resolution optionality and description limits with Microsoft metadata

Compatibility and safety

  • supported Dynamics UI paths prevent credential rebinding; equivalent server-side enforcement is tracked in #6716 and remains a merge prerequisite
  • existing microsoft_dataverse_* implementations and documentation are unchanged; shared generated registries change additively to register Dynamics
  • a narrowly gated credential-selector policy enforces Dynamics environment matching; no data selectors or selector API routes were added
  • adds no Desktop, service-account, migration, credential-framework, custom OAuth-route, or shared-transport work
  • limits this version to delegated OAuth for public-cloud Dataverse environments

Validation

  • focused Dynamics/OAuth/executor suite at exact head: 340 passed
  • exact-head CI: 25,512 passed / 41 skipped; build, lint/test, CodeQL, Greptile, Cursor Bugbot, Vercel, companion, and GitGuardian are green
  • local full repository bun run test: Sim reported 25,507 passed / 46 skipped; setup and all other package suites also passed
  • type-check, lint, all 26 audits, API/client/request boundaries, canvas, metadata, catalog, migrations, and git diff --check passed
  • lifecycle action contracts are statically matched to Microsoft documentation; live mutations remain UNVERIFIED because no authorized disposable sandbox was available
  • nonempty callback scope sets that contain no resource-qualified scope remain an intentional compatibility risk pending sanitized live callback evidence

Merge prerequisite

Do not merge until #6716 lands and this branch is rebased onto that platform fix.

@vercel

vercel Bot commented Aug 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Aug 28, 2026 7:55pm

Request Review

@cursor

cursor Bot commented Aug 14, 2026

Copy link
Copy Markdown

PR Summary

High Risk
Touches OAuth linking, callback scope validation, credential identity binding, and token resolution for Microsoft Dataverse—security-sensitive auth paths alongside a large new CRM surface. PR description also flags a merge dependency on server-side credential rebinding enforcement (#6716).

Overview
Adds a Microsoft Dynamics 365 CRM integration and workflow block with ten CRM-focused operations (list/get/create/update/search on standard tables, list owners, assign, qualify lead, close opportunity/case), backed by dedicated microsoft_dynamics_365_* tools while the generic Microsoft Dataverse block stays available for custom tables and delete.

Environment-bound OAuth is new for Dynamics paths: connect/reconnect flows collect a public-cloud Dataverse environment URL, request per-environment Microsoft scopes, validate link/callback scopes in auth, and persist an internal environment marker so credentials are not rebound across environments. Legacy unbound Dataverse credentials keep working; workflow credential selection enforces a matching environment when the block depends on environmentUrl. Token resolution projects instanceUrl from bound scopes for CRM calls.

Docs, integrations catalog, and icon mappings register microsoft_dynamics_365; connect modals, credential detail reconnect, and OAuth return handling wire in the Dataverse environment field and dedicated connect hook.

Reviewed by Cursor Bugbot for commit a2842cf. Bugbot is set up for automated code reviews on this repo. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds a Microsoft Dynamics 365 CRM integration backed by environment-bound Dataverse OAuth and eight CRM tool modules.

  • Registers a ten-operation workflow block, generated tool metadata, documentation, icons, and deployment configuration.
  • Adds environment-specific OAuth connection, reconnection, credential-selection, and token-resolution behavior.
  • Implements bounded listing and search plus record creation, retrieval, updating, lead qualification, opportunity closure, and case resolution.

Confidence Score: 5/5

The PR appears safe to merge from the reviewed follow-up scope because the previously reported redirect credential leak has been fixed.

No blocking failure remains from the prior redirect-safety finding: every Dynamics request enables authorization stripping, the shared transport enforces it on redirects, and the regression test covers all eight request definitions.

Important Files Changed

Filename Overview
apps/sim/tools/microsoft_dynamics_365/create_record.ts Defines environment-scoped record creation and now strips authorization before following redirects.
apps/sim/tools/microsoft_dynamics_365/dynamics_crm.test.ts Exercises shared CRM behavior and verifies redirect-safe request configuration across all eight tool definitions.
apps/sim/lib/oauth/microsoft-dataverse.ts Implements public-cloud environment normalization, environment-qualified scopes, and credential-binding classification.
apps/sim/app/workspace/[workspaceId]/components/connect-oauth-modal/connect-oauth-modal.tsx Routes Dynamics connections through the environment-bound Dataverse OAuth flow while retaining the generic OAuth path.
apps/sim/blocks/blocks/microsoft_dynamics_365.ts Defines the ten-operation Dynamics workflow block and maps its operation-specific parameters to eight CRM tools.

Sequence Diagram

sequenceDiagram
  actor User
  participant UI as Workflow or integration UI
  participant OAuth as Dataverse OAuth
  participant Executor as Tool executor
  participant CRM as Dynamics 365 CRM
  User->>UI: Select environment and connect
  UI->>OAuth: Request environment-qualified scopes
  OAuth-->>UI: Environment-bound credential
  User->>UI: Configure CRM operation
  UI->>Executor: Execute with credential and environment
  Executor->>CRM: Dataverse API request
  Note over Executor,CRM: Authorization removed before following redirects
  CRM-->>Executor: Structured CRM response
  Executor-->>UI: Normalized operation output
Loading

Reviews (7): Last reviewed commit: "test(integrations): isolate Dynamics OAu..." | Re-trigger Greptile

Comment thread apps/sim/tools/microsoft_dynamics_365/create_record.ts
Comment thread apps/sim/lib/oauth/microsoft-dataverse.ts Outdated
@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@greptile please re-review the latest commit.

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@cursor review

Comment thread apps/sim/tools/microsoft_dynamics_365/list_records.ts
@BillLeoutsakosvl346
BillLeoutsakosvl346 force-pushed the feat/microsoft-dynamics-365 branch from d757dd4 to 2a508dd Compare August 15, 2026 00:15
@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@cursor review

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@greptile please re-review the rebased latest commit.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 2a508dd. Configure here.

@BillLeoutsakosvl346
BillLeoutsakosvl346 force-pushed the feat/microsoft-dynamics-365 branch from 2a508dd to a2842cf Compare August 15, 2026 01:32
@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@greptile please re-review the latest exact-head commit. The update preserves the opaque Dataverse nextLink with a paired page-size contract and aligns Opportunity Close/Case Resolution metadata limits.

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit a2842cf. Configure here.

@waleedlatif1
waleedlatif1 force-pushed the feat/microsoft-dynamics-365 branch from a2842cf to 2562939 Compare August 28, 2026 19:45
@waleedlatif1

Copy link
Copy Markdown
Collaborator

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator

@greptile

@waleedlatif1
waleedlatif1 merged commit cc5affa into staging Aug 28, 2026
26 checks passed
@waleedlatif1
waleedlatif1 deleted the feat/microsoft-dynamics-365 branch August 28, 2026 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants