[Bug Fix] #304: [SOA] Re-resolve new sender to created contact after 'I have added the contact' - #10772
Conversation
…'I have added the contact' Promoted from microsoft/BCAppsBugFix#313 (https://github.com/microsoft/BCAppsBugFix/pull/313)
Good Sense Reviewer - Round 1Recommendation: Accept with SuggestionsWhat this PR doesThis changes the SOA contact-added intervention instruction so the agent returns to the Contact List page, searches for the new contact, proceeds if found, and only then falls back to the Customer List page. That matches the failing flow: after a user creates a contact for a new email sender, the agent must re-resolve contact/customer state instead of staying in stale customer-list context. The AL filtering code already finds contacts by sender email, and Sales Header filtering can use Sell-to Contact No. when no customer exists. This label change therefore targets the right control point, keeps the existing label limits, and does not alter runtime data filters. Problem-solution fitFit: Strong The bug says the failure happens after selecting the contact-added response and continuing. The diff directly changes that response's instruction and makes the contact-first re-resolution order explicit, so the solution fits the described failure without broadening behavior. SuggestionsS1 (🟠 Moderate): Complete the live agent validation Risk assessment and necessityRisk: This is a narrow change to one locked instruction label used by both Customer List and Contact List assistance. The main regression surface is the SOA intervention flow for new senders: unclear wording could still send the agent to the wrong page, but it does not change filters, posting, or customer/contact data. Necessity: The change is necessary because first-time senders can otherwise stay blocked after the user creates the contact. The scope is right for the reported failure: it changes only the instruction that drives the continuation behavior.
|
|
attilatoury
left a comment
There was a problem hiding this comment.
Should we manually validate?
|
Bug Reference
Work item microsoft/BCAppsBugFix#304
Fixes microsoft/BCAppsBugFix#304
Fixes AB#615541
Summary
Sales Order Agent (SOA) failed to recover when an email arrived from a new/unrecognized sender: after the user created the contact from the agent chat and confirmed with the "I have added the contact" suggestion, the agent still reported that it could not find the customer. This fix strengthens the intervention instruction so the agent re-resolves the sender starting from the contact list after the contact is created, instead of remaining in the stale customer-list context.
Root Cause
The AL data resolution is already correct:
AgentTaskMessage.Fromand the newly created contact's"E-Mail"both come fromEmailInbox."Sender Address", soGetSecurityFiltersForContacts(codeunit 4305 "SOA Filters Impl.") finds the new contact on re-resolution, and a contact without a linked customer is already supported (SetFilterOnSalesHeaderin codeunit 4306 falls back to the "Sell-to Contact No." filter; quote creation uses customer templates).The defect was in the agent's continuation behavior, driven by the
SOA-CONTACT-ADDEDintervention instruction text (SOAContactInterventionSuggestionInstructionsLblinSOASetup.Codeunit.al). It only said "Rerun the contact information check on the contact list page and proceed further" and did not explicitly command the agent to navigate back to the contact list and search again before concluding. When the assistance request had been raised from the Customer List page, the agent stayed in that stale context after the contact was created and re-reported "can't find the customer".Changes Made
src/Apps/W1/SalesOrderAgent/app/src/Setup/SOASetup.Codeunit.al: Reworded theSOAContactInterventionSuggestionInstructionsLbllabel (Locked = true,MaxLength = 1024unchanged) to explicitly instruct the agent to navigate to the contact list page, search for the contact again, proceed with the contact if found, and only fall back to the customer list if the contact is still not found. This is the only source change.Implementation Process
Validation Evidence
No-Test Validation Evidence
Lockedlabel consumed as natural-language guidance for the LLM, not deterministic AL branch logic. The underlying AL data resolution and security-filter logic were verified correct, so there is no deterministic AL defect for a red-to-green automated test, and there is no SOA test project in the repository. Reproducing the symptom requires the external email system and the agent/LLM runtime, which the AL test environment cannot control.Validation Coverage
Miapp Propagation
Review Notes
The change is limited to a single agent-instruction label string. Reviewers should focus on the wording of the new instruction to confirm it unambiguously directs the agent to re-resolve from the contact list first and only fall back to the customer list when the contact is still not found.
🤖 Generated by the bc-fix-bug skill
Promoted from microsoft/BCAppsBugFix#313: https://github.com/microsoft/BCAppsBugFix/pull/313