-
Notifications
You must be signed in to change notification settings - Fork 396
feat(PayablesAgent): Add inbound e-documents count and link to setup page #9060
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -154,6 +154,32 @@ page 3304 "Payables Agent Setup" | |
| Editable = false; | ||
| ToolTip = 'Specifies the total number of Copilot credits consumed by the Payables Agent.', Comment = 'Payables Agent is a term, and should not be translated.'; | ||
| } | ||
| field(AgentTasks; AgentTasksText) | ||
| { | ||
| ShowCaption = false; | ||
| Editable = false; | ||
| StyleExpr = true; | ||
| Style = StandardAccent; | ||
| ToolTip = 'Specifies the number of tasks completed by the Payables Agent. Choose this field to open the agent task list.', Comment = 'Payables Agent is a term, and should not be translated.'; | ||
|
|
||
| trigger OnDrillDown() | ||
| begin | ||
| DrillDownAgentTasks(); | ||
| end; | ||
| } | ||
| field(InboundEDocuments; InboundEDocumentsText) | ||
| { | ||
| ShowCaption = false; | ||
| Editable = false; | ||
| StyleExpr = true; | ||
| Style = StandardAccent; | ||
| ToolTip = 'Specifies the number of inbound e-documents processed by the Payables Agent. Choose this field to open the list of inbound e-documents.', Comment = 'Payables Agent is a term, and should not be translated.'; | ||
|
|
||
| trigger OnDrillDown() | ||
| begin | ||
| DrillDownInboundEDocuments(); | ||
| end; | ||
| } | ||
| field(LearnMoreCost; LearnMoreCostLbl) | ||
| { | ||
| ShowCaption = false; | ||
|
|
@@ -481,6 +507,58 @@ page 3304 "Payables Agent Setup" | |
| begin | ||
| CreditsConsumed := PACostEstimate.GetCreditsConsumed(); | ||
| CostEstimateText := PACostEstimate.FormatCreditsConsumed(CreditsConsumed); | ||
| CalcAgentTasks(); | ||
| CalcInboundEDocuments(); | ||
| end; | ||
|
|
||
| local procedure CalcAgentTasks() | ||
| var | ||
| AgentTask: Record "Agent Task"; | ||
| PayablesAgentSetupRec: Record "Payables Agent Setup"; | ||
| TaskCount: Integer; | ||
| begin | ||
| PayablesAgentSetupRec.GetSetup(); | ||
| if IsNullGuid(PayablesAgentSetupRec."User Security Id") then begin | ||
| AgentTasksText := StrSubstNo(AgentTasksLbl, 0); | ||
| exit; | ||
| end; | ||
| AgentTask.SetRange("Agent User Security ID", PayablesAgentSetupRec."User Security Id"); | ||
| TaskCount := AgentTask.Count(); | ||
| AgentTasksText := StrSubstNo(AgentTasksLbl, TaskCount); | ||
| end; | ||
|
|
||
| local procedure DrillDownAgentTasks() | ||
| var | ||
| AgentTask: Record "Agent Task"; | ||
| PayablesAgentSetupRec: Record "Payables Agent Setup"; | ||
| AgentTaskList: Page "Agent Task List"; | ||
| begin | ||
| PayablesAgentSetupRec.GetSetup(); | ||
| if not IsNullGuid(PayablesAgentSetupRec."User Security Id") then | ||
| AgentTask.SetRange("Agent User Security ID", PayablesAgentSetupRec."User Security Id"); | ||
| AgentTaskList.SetTableView(AgentTask); | ||
| AgentTaskList.Run(); | ||
| end; | ||
|
|
||
| local procedure CalcInboundEDocuments() | ||
| var | ||
| EDocument: Record "E-Document"; | ||
| EDocCount: Integer; | ||
| begin | ||
| EDocument.SetRange(Direction, "E-Document Direction"::Incoming); | ||
| EDocument.SetRange(Service, PayablesAgentSetup.GetAgentEDocumentServiceCode()); | ||
| EDocCount := EDocument.Count(); | ||
| InboundEDocumentsText := StrSubstNo(InboundEDocumentsLbl, EDocCount); | ||
| end; | ||
|
|
||
| local procedure DrillDownInboundEDocuments() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CalcInboundEDocuments counts E-Document rows filtered by both Direction = Incoming and Service, and the field caption states 'Based on %1 inbound e-documents'.DrillDownInboundEDocuments, invoked from the same field's OnDrillDown, only filters by Service before calling Page "Inbound E-Documents".SetTableView and Run. Page.SetTableView replaces the target page's own SourceTableView (which itself filters Direction = Incoming on page 6105), so the drill-down list will include both inbound and outbound e-documents for the service, not just the inbound ones the displayed count promises. Impact would otherwise be major (visible user-facing mismatch between the shown count and the drilled-down list), but is capped to minor per agent-finding rules. Recommendation:
Suggested fix (apply manually — could not be anchored as a one-click suggestion): local procedure DrillDownInboundEDocuments()
var
EDocument: Record "E-Document";
InboundEDocuments: Page "Inbound E-Documents";
begin
EDocument.SetRange(Direction, "E-Document Direction"::Incoming);
EDocument.SetRange(Service, PayablesAgentSetup.GetAgentEDocumentServiceCode());
InboundEDocuments.SetTableView(EDocument);
InboundEDocuments.Run();
end;👍 useful · ❤️ especially valuable · 👎 wrong - reply with why |
||
| var | ||
| EDocument: Record "E-Document"; | ||
| InboundEDocumentsPage: Page "Inbound E-Documents"; | ||
| begin | ||
| EDocument.SetRange(Service, PayablesAgentSetup.GetAgentEDocumentServiceCode()); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CalcInboundEDocuments filters E-Document by both Direction = Incoming and Service, but DrillDownInboundEDocuments filters only by Service.Clicking the 'InboundEDocuments' field (tooltip: 'open the list of inbound e-documents') can therefore open a list that also includes outgoing e-documents for that service, contradicting both the field's label and the count shown. Recommendation:
Suggested fix (apply manually — could not be anchored as a one-click suggestion): EDocument.SetRange(Direction, "E-Document Direction"::Incoming);
EDocument.SetRange(Service, PayablesAgentSetup.GetAgentEDocumentServiceCode());👍 useful · ❤️ especially valuable · 👎 wrong - reply with why |
||
| InboundEDocumentsPage.SetTableView(EDocument); | ||
| InboundEDocumentsPage.Run(); | ||
| end; | ||
|
|
||
| /// <summary> | ||
|
|
@@ -542,6 +620,8 @@ page 3304 "Payables Agent Setup" | |
| MailboxAddress: Text; | ||
| TrialProgressText: Text; | ||
| CostEstimateText: Text; | ||
| AgentTasksText: Text; | ||
| InboundEDocumentsText: Text; | ||
| TrialExperienceVisible: Boolean; | ||
| IsEligibleForTrialVisible: Boolean; | ||
| IsInTrialModeVisible: Boolean; | ||
|
|
@@ -565,5 +645,7 @@ page 3304 "Payables Agent Setup" | |
| BenefitNoDisruptionLbl: Label '• No disruption to your current process'; | ||
| SelectFileLbl: Label 'Select file'; | ||
| PdfFileFilterLbl: Label 'PDF Files (*.pdf)|*.pdf'; | ||
| InboundEDocumentsLbl: Label 'Based on %1 inbound e-documents', Comment = '%1 is the number of inbound e-documents processed by the agent.'; | ||
| AgentTasksLbl: Label '%1 agent tasks', Comment = '%1 is the number of tasks completed by the agent.'; | ||
|
|
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DrillDownAgentTasks only applies the 'Agent User Security ID' filter when the setup's User Security Id is not blank; when it is blank, AgentTask is left completely unfiltered and the drill-down opens the Agent Task List showing every agent task in the system.
This contradicts CalcAgentTasks, which displays '0 agent tasks' for the exact same blank-guid condition. A user sees 0 on the field but an unfiltered, unrelated list when they click it.
Recommendation:
Suggested fix (apply manually — could not be anchored as a one-click suggestion):
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why