Add QualifyLead request handler#343
Merged
Merged
Conversation
Implements QualifyLeadRequestHandler for the QualifyLead message: optionally creates account/contact/opportunity from the lead (copying the standard mapped fields), links the opportunity via originatingleadid, and closes the lead in the status/state supplied on the request. Attributes not present on the target entity's metadata are skipped with a warning rather than failing the request (Core now exposes its ILogger so handlers can surface such diagnostics). Lead metadata is absent from the leaned test environment, so it is supplied as a standalone LeadMetadata.xml (custom-publisher fields stripped), merged like the existing RemovedEntitiesMetadata.xml. Adds TestLeads covering creation, mapping, qualify/disqualify, and the validation/guard paths. Re-implements and builds on the original work by Niels Ladekarl (@Ladekarl) in #51, updated for the current codebase and test environment. Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds first-class support for the Dataverse QualifyLead message in XrmMockup365, including creating related records from a lead, closing the lead with the requested status/state, and surfacing metadata-mismatch diagnostics via the engine logger. This is reinforced with a dedicated late-bound test suite and release note entry.
Changes:
- Add
QualifyLeadRequestHandlerto create account/contact/opportunity from lead (with mapped fields) and close the lead with the requested status/state. - Expose
Core.Loggerand register the new request handler in the core handler pipeline. - Add
TestLeadsto validate qualify/disqualify flows, guard paths, and warning behavior when target metadata lacks attributes.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/XrmMockup365Test/TestLeads.cs | New late-bound tests covering qualify/disqualify behavior and warning logging. |
| src/XrmMockup365/Requests/QualifyLeadRequestHandler.cs | Implements QualifyLead request handling, entity creation/mapping, lead closing, and warnings. |
| src/XrmMockup365/Internal/Utility.cs | Adds LogicalNames.Account constant used by the new handler. |
| src/XrmMockup365/Core.cs | Exposes Core.Logger and wires the new handler into the request handler list. |
| RELEASE_NOTES.md | Documents the new QualifyLead request support. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Validate OpportunityCurrencyId references a transactioncurrency, throwing a clear FaultException early. (A non-existent currency already surfaced as a FaultException from the create pipeline via XrmDb.GetDbRow, not an NRE; added TestQualifyLeadNonexistentCurrencyThrowsFault to lock that in.) - Test capture logger's BeginScope now returns a NullScope singleton instead of null, matching the precedent in TestLogging.cs. Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com>
This was referenced Jul 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements QualifyLeadRequestHandler for the QualifyLead message: optionally creates account/contact/opportunity from the lead (copying the standard mapped fields), links the opportunity via originatingleadid, and closes the lead in the status/state supplied on the request. Attributes not present on the target entity's metadata are skipped with a warning rather than failing the request (Core now exposes its ILogger so handlers can surface such diagnostics).
Lead metadata is absent from the leaned test environment, so it is supplied as a standalone LeadMetadata.xml (custom-publisher fields stripped), merged like the existing RemovedEntitiesMetadata.xml. Adds TestLeads covering creation, mapping, qualify/disqualify, and the validation/guard paths.
Re-implements and builds on the original work by Niels Ladekarl (@Ladekarl) in #51, updated for the current codebase and test environment.