Add Microsoft Dynamics 365 CRM integration#378
Conversation
17 actions across Accounts, Contacts, Leads, Opportunities, and Tasks. Uses platform OAuth2 with org_url from context.auth, OData v4 REST API. 32 unit tests passing, integration tests included.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 797cc34dde
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| "provider": "Microsoft Dynamics 365", | ||
| "scopes": [ | ||
| "offline_access", | ||
| "https://org.crm.dynamics.com/user_impersonation" |
There was a problem hiding this comment.
Use an environment-specific Dynamics scope
When a user connects to any real Dataverse environment, this static scope requests a token for the literal org.crm.dynamics.com audience, while _base_url later calls the user's own org_url. Dataverse OAuth scopes are environment-specific (<environment-url>/user_impersonation), so tokens minted with this scope won't be accepted by most org URLs and the integration can't authenticate unless the scope is built from the selected environment or supplied by provider metadata.
Useful? React with 👍 / 👎.
| "OData-MaxVersion": "4.0", | ||
| "OData-Version": "4.0", | ||
| "Accept": "application/json", | ||
| "Prefer": 'odata.include-annotations="*"', |
There was a problem hiding this comment.
Return created Dataverse record IDs
When Dataverse handles a normal POST, it returns 204 No Content plus the new record URI in OData-EntityId unless the request includes Prefer: return=representation; with the current headers every create_* action falls back to returning the submitted body, which has no generated accountid/contactid/leadid/opportunityid/activityid. That prevents follow-up workflow steps from updating or linking the record they just created, as the live account test already has to skip when accountid is missing.
Useful? React with 👍 / 👎.
|
We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted. |
🔍 Integration Validation ResultsCommit: Changed directories:
|
- Add README.md with full action docs and setup instructions - Add 512x512 icon.png placeholder - Add display_name to config.json - Pin SDK version to ~=2.0.0 in requirements.txt - Add dynamics365 entry to root README.md
- Run ruff format on all dynamics365 Python files - Add table row for dynamics365 to main README.md
Summary
/api/data/v9.2/# -- Dynamics 365 --section to.env.example(alphabetically between Coda and Dropbox)Actions
Auth note
Currently uses platform OAuth2, but
org_url(required for the API base URL) cannot be collected from the user this way. Needs to be converted to custom auth (like iMIS) where the user suppliesorg_url,client_id,client_secret, andtenant_idand we handle the Azure AD token exchange in code.Test plan
D365_ORG_URLandD365_ACCESS_TOKENenv vars