r/Dynamics365 • u/Assassin-Desire • 1d ago
Sales, Service, Customer Engagement Trigger Qualify Button
Hi, I'm looking for a way to trigger the Qualify button in the Sales Pro app when a user finishes the Business Process Flow (BPF).
Ideally, when the user completes the BPF and clicks Finish, it should execute the same actions as the Qualify button, including opening the quick create form and identifying potential duplicates.
I've tried using a workflow with QualifyLead, but it bypasses the duplicate detection process and proceeds directly with creating the Opportunity, Account, and Contact records.
Is there a way to trigger the standard Qualify button's behavior when the BPF is finished, rather than having to recreate its functionality from scratch?
Any help would be greatly appreciated. Thanks!
1
u/Eastern_Use_2572 17h ago
Qualifies: Use a JS handler on the BPF finish event that does the duplicate check.
Registration form Context.data.process.addOnProcessStatusChange and act on status finished.
Call RetrieveDuplicates (Web API) on lead.
Show Xrm.Navigation.openConfirmDialog if matches, call QualifyLead if user goes through (or no matches)
The standard Qualify button does not support direct calls as the command is internal, so this is the surefire way.
3
u/xrmghost_team 17h ago
There's no public API that fires the Qualify button itself: the duplicate dialog and the "Qualify lead" side pane are Sales app UI. The QualifyLead message underneath only takes the three Create* flags, Status, currency, customer, SourceCampaignId and ProcessInstanceId. It has no duplicate-detection switch: with rules published it fails with "a duplicate of the current record already exists", so a workflow either skips the check or errors.
Two options on documented ground:
Flip the order. Make the lead stage the last one before the opportunity stage and let sellers press Qualify at the end: on qualification the lead moves to the next stage, so Qualify is the Finish.
Script it. In
addOnProcessStatusChange, whengetStatus()is "finished", callRetrieveDuplicatesfor account and contact, open the opportunity viaXrm.Navigation.openForm(useQuickCreateForm,createFromEntity= the lead), then in its success callback run QualifyLead with CreateOpportunity false.