Skip to content

Add QualifyLead request handler#343

Merged
mkholt merged 2 commits into
masterfrom
qualify-lead-request-handler-a01
Jul 9, 2026
Merged

Add QualifyLead request handler#343
mkholt merged 2 commits into
masterfrom
qualify-lead-request-handler-a01

Conversation

@mkholt

@mkholt mkholt commented Jul 8, 2026

Copy link
Copy Markdown
Member

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.

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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 QualifyLeadRequestHandler to create account/contact/opportunity from lead (with mapped fields) and close the lead with the requested status/state.
  • Expose Core.Logger and register the new request handler in the core handler pipeline.
  • Add TestLeads to 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.

Comment thread src/XrmMockup365/Requests/QualifyLeadRequestHandler.cs Outdated
Comment thread tests/XrmMockup365Test/TestLeads.cs Outdated
- 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>
@mkholt
mkholt merged commit 83f4ae3 into master Jul 9, 2026
1 of 2 checks passed
@mkholt
mkholt deleted the qualify-lead-request-handler-a01 branch July 9, 2026 05:25
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