From f72a4b003ea2527143d6b28155d47a5deccd30f9 Mon Sep 17 00:00:00 2001 From: Esteban Date: Wed, 12 Feb 2025 22:42:11 +0100 Subject: [PATCH] Features/agent tables refactoring (#2923) #### Summary This PR focuses on refactoring virtual tables the app depends on. It mainly consists of renaming timeline-related tables and adjusting fields so that the timeline uses the new log entry table instead of agent task steps: - Rename `Agent Task Timeline Entry` -> `Agent Task Timeline Step`. This also changes fields that reference `Agent Task Step` to reference `Agent Task Log Entry` instead. - Rename `Agent Task Timeline Entry Step` -> `Agent Task Timeline Step Detail`. - Rename internal `Agent Task Step Group Data` -> `Agent Task Timeline Step Data`. #### Work Item(s) Fixes [AB#565441](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/565441) --------- Co-authored-by: Esteban Ardaya Heckl --- .../Interaction/AgentTaskImpl.Codeunit.al | 67 ++++++++------- .../Agent/Interaction/AgentTaskList.Page.al | 18 ++-- ....Page.al => AgentTaskLogEntryList.Page.al} | 39 ++++++--- .../Permissions/AgentObjects.PermissionSet.al | 2 +- .../Agent/TaskPane/AgentTaskDetails.Page.al | 44 +++++----- .../Agent/TaskPane/AgentTaskTimeline.Page.al | 86 +++++++++---------- .../App/Agent/TaskPane/AgentTasks.Page.al | 6 +- src/System Application/App/Agent/dotnet.al | 13 +++ src/System Application/App/app.json | 5 ++ 9 files changed, 155 insertions(+), 125 deletions(-) rename src/System Application/App/Agent/Interaction/{AgentTaskStepList.Page.al => AgentTaskLogEntryList.Page.al} (72%) diff --git a/src/System Application/App/Agent/Interaction/AgentTaskImpl.Codeunit.al b/src/System Application/App/Agent/Interaction/AgentTaskImpl.Codeunit.al index fa28d243c9..79afb13f3f 100644 --- a/src/System Application/App/Agent/Interaction/AgentTaskImpl.Codeunit.al +++ b/src/System Application/App/Agent/Interaction/AgentTaskImpl.Codeunit.al @@ -26,30 +26,30 @@ codeunit 4300 "Agent Task Impl." procedure GetStepsDoneCount(var AgentTask: Record "Agent Task"): Integer var - AgentTaskStep: Record "Agent Task Step"; + AgentTaskLogEntry: Record "Agent Task Log Entry"; begin - AgentTaskStep.SetRange("Task ID", AgentTask."ID"); - AgentTaskStep.ReadIsolation := IsolationLevel::ReadCommitted; - exit(AgentTaskStep.Count()); + AgentTaskLogEntry.SetRange("Task ID", AgentTask."ID"); + AgentTaskLogEntry.ReadIsolation := IsolationLevel::ReadCommitted; + exit(AgentTaskLogEntry.Count()); end; - procedure GetDetailsForAgentTaskStep(var AgentTaskStep: Record "Agent Task Step"): Text + procedure GetDetailsForAgentTaskLogEntry(var AgentTaskLogEntry: Record "Agent Task Log Entry"): Text var ContentInStream: InStream; ContentText: Text; begin - AgentTaskStep.CalcFields(Details); - AgentTaskStep.Details.CreateInStream(ContentInStream, GetDefaultEncoding()); + AgentTaskLogEntry.CalcFields(Details); + AgentTaskLogEntry.Details.CreateInStream(ContentInStream, GetDefaultEncoding()); ContentInStream.Read(ContentText); exit(ContentText); end; - procedure ShowTaskSteps(var AgentTask: Record "Agent Task") + procedure ShowTaskLogEntries(var AgentTask: Record "Agent Task") var - AgentTaskStep: Record "Agent Task Step"; + AgentTaskLogEntry: Record "Agent Task Log Entry"; begin - AgentTaskStep.SetRange("Task ID", AgentTask.ID); - Page.Run(Page::"Agent Task Step List", AgentTaskStep); + AgentTaskLogEntry.SetRange("Task ID", AgentTask.ID); + Page.Run(Page::"Agent Task Log Entry List", AgentTaskLogEntry); end; procedure CreateTask(AgentSecurityID: Guid; TaskTitle: Text[150]; ExternalId: Text[2048]; var NewAgentTask: Record "Agent Task") @@ -98,43 +98,44 @@ codeunit 4300 "Agent Task Impl." StartTaskIfPossible(AgentTask); end; - procedure CreateUserInterventionTaskStep(UserInterventionRequestStep: Record "Agent Task Step") + procedure CreateUserIntervention(UserInterventionRequestEntry: Record "Agent Task Log Entry") begin - CreateUserInterventionTaskStep(UserInterventionRequestStep, '', -1); + CreateUserIntervention(UserInterventionRequestEntry, '', -1); end; - procedure CreateUserInterventionTaskStep(UserInterventionRequestStep: Record "Agent Task Step"; UserInput: Text) + procedure CreateUserIntervention(UserInterventionRequestEntry: Record "Agent Task Log Entry"; UserInput: Text) begin - CreateUserInterventionTaskStep(UserInterventionRequestStep, UserInput, -1); + CreateUserIntervention(UserInterventionRequestEntry, UserInput, -1); end; - procedure CreateUserInterventionTaskStep(UserInterventionRequestStep: Record "Agent Task Step"; SelectedSuggestionId: Integer) + procedure CreateUserIntervention(UserInterventionRequestEntry: Record "Agent Task Log Entry"; SelectedSuggestionId: Integer) begin - CreateUserInterventionTaskStep(UserInterventionRequestStep, '', SelectedSuggestionId); + CreateUserIntervention(UserInterventionRequestEntry, '', SelectedSuggestionId); end; - procedure CreateUserInterventionTaskStep(UserInterventionRequestStep: Record "Agent Task Step"; UserInput: Text; SelectedSuggestionId: Integer) + procedure CreateUserIntervention(UserInterventionRequestEntry: Record "Agent Task Log Entry"; UserInput: Text; SelectedSuggestionId: Integer) var AgentTask: Record "Agent Task"; - AgentTaskStep: Record "Agent Task Step"; - DetailsOutStream: OutStream; - DetailsJson: JsonObject; + AgentALFunctions: DotNet AgentALFunctions; + UserIntervention: DotNet "AgentTaskUserIntervention"; begin - AgentTask.Get(UserInterventionRequestStep."Task ID"); + AgentTask.Get(UserInterventionRequestEntry."Task ID"); - AgentTaskStep."Task ID" := AgentTask.ID; - AgentTaskStep."Type" := AgentTaskStep."Type"::"User Intervention"; - AgentTaskStep.Description := 'User intervention'; - DetailsJson.Add('interventionRequestStepNumber', UserInterventionRequestStep."Step Number"); + UserIntervention := UserIntervention.AgentTaskUserInterventionDetails(); if UserInput <> '' then - DetailsJson.Add('userInput', UserInput); + UserIntervention.UserInput := UserInput; if SelectedSuggestionId >= 0 then - DetailsJson.Add('selectedSuggestionId', SelectedSuggestionId); - AgentTaskStep.CalcFields(Details); - Clear(AgentTaskStep.Details); - AgentTaskStep.Details.CreateOutStream(DetailsOutStream, GetDefaultEncoding()); - DetailsJson.WriteTo(DetailsOutStream); - AgentTaskStep.Insert(); + UserIntervention.SelectedSuggestionId := SelectedSuggestionId; + AgentALFunctions.CreateAgentTaskUserIntervention(AgentTask."Agent User Security ID", AgentTask.ID, UserInterventionRequestEntry.ID, UserIntervention); + end; + + procedure GetUserInterventionRequestDetails(UserInterventionRequestEntry: Record "Agent Task Log Entry"; var UserInterventionRequest: DotNet "AgentTaskUserInterventionRequest") + var + AgentTask: Record "Agent Task"; + AgentALFunctions: DotNet AgentALFunctions; + begin + AgentTask.Get(UserInterventionRequestEntry."Task ID"); + UserInterventionRequest := AgentALFunctions.GetAgentTaskUserInterventionRequest(AgentTask."Agent User Security ID", AgentTask.ID, UserInterventionRequestEntry.ID); end; procedure StopTask(var AgentTask: Record "Agent Task"; AgentTaskStatus: enum "Agent Task Status"; UserConfirm: Boolean) diff --git a/src/System Application/App/Agent/Interaction/AgentTaskList.Page.al b/src/System Application/App/Agent/Interaction/AgentTaskList.Page.al index 85c2b144ad..1cb5a72d35 100644 --- a/src/System Application/App/Agent/Interaction/AgentTaskList.Page.al +++ b/src/System Application/App/Agent/Interaction/AgentTaskList.Page.al @@ -16,7 +16,7 @@ page 4300 "Agent Task List" ModifyAllowed = false; DeleteAllowed = false; AdditionalSearchTerms = 'Agent Tasks, Agent Task, Agent, Agent Log, Agent Logs'; - SourceTableView = sorting("Last Step Timestamp") order(descending); + SourceTableView = sorting("Last Log Entry Timestamp") order(descending); InherentEntitlements = X; InherentPermissions = X; @@ -34,11 +34,11 @@ page 4300 "Agent Task List" { Caption = 'Title'; } - field(LastStepTimestamp; Rec."Last Step Timestamp") + field(LastLogEntryTimestamp; Rec."Last Log Entry Timestamp") { Caption = 'Last Updated'; } - field(LastStepNumber; Rec."Last Step Number") + field(LastLogEntryId; Rec."Last Log Entry ID") { } field(Status; Rec.Status) @@ -73,7 +73,7 @@ page 4300 "Agent Task List" var AgentTaskImpl: Codeunit "Agent Task Impl."; begin - AgentTaskImpl.ShowTaskSteps(Rec); + AgentTaskImpl.ShowTaskLogEntries(Rec); end; } field("Created By"; Rec."Created By Full Name") @@ -113,18 +113,18 @@ page 4300 "Agent Task List" ShowTaskMessages(); end; } - action(ViewTaskSteps) + action(ViewTaskLogEntries) { ApplicationArea = All; - Caption = 'View steps'; - ToolTip = 'Show steps for the selected task.'; + Caption = 'View log entries'; + ToolTip = 'Show log entries for the selected task.'; Image = TaskList; trigger OnAction() var AgentTaskImpl: Codeunit "Agent Task Impl."; begin - AgentTaskImpl.ShowTaskSteps(Rec); + AgentTaskImpl.ShowTaskLogEntries(Rec); end; } action(Stop) @@ -150,7 +150,7 @@ page 4300 "Agent Task List" actionref(ViewTaskMessage_Promoted; ViewTaskMessage) { } - actionref(ViewTaskSteps_Promoted; ViewTaskSteps) + actionref(ViewTaskLogEntries_Promoted; ViewTaskLogEntries) { } } diff --git a/src/System Application/App/Agent/Interaction/AgentTaskStepList.Page.al b/src/System Application/App/Agent/Interaction/AgentTaskLogEntryList.Page.al similarity index 72% rename from src/System Application/App/Agent/Interaction/AgentTaskStepList.Page.al rename to src/System Application/App/Agent/Interaction/AgentTaskLogEntryList.Page.al index 0f212a38ca..b2ab21ca17 100644 --- a/src/System Application/App/Agent/Interaction/AgentTaskStepList.Page.al +++ b/src/System Application/App/Agent/Interaction/AgentTaskLogEntryList.Page.al @@ -5,17 +5,18 @@ namespace System.Agents; -page 4303 "Agent Task Step List" +#pragma warning disable AS0125 +page 4303 "Agent Task Log Entry List" { PageType = List; ApplicationArea = All; - SourceTable = "Agent Task Step"; - Caption = 'Agent Task Steps'; + SourceTable = "Agent Task Log Entry"; + Caption = 'Agent Task Log'; InsertAllowed = false; ModifyAllowed = false; DeleteAllowed = false; Editable = false; - SourceTableView = sorting("Step Number") order(descending); + SourceTableView = sorting("ID") order(descending); Extensible = false; InherentEntitlements = X; InherentPermissions = X; @@ -24,17 +25,31 @@ page 4303 "Agent Task Step List" { area(Content) { - repeater(AgentConversationActionLog) + repeater(LogEntries) { - field(StepNumber; Rec."Step Number") + field(ID; Rec."ID") { - Caption = 'Step Number'; + Caption = 'ID'; + ToolTip = 'Specifies the unique identifier of the log entry.'; } field(TaskID; Rec."Task ID") { Visible = false; Caption = 'Task ID'; } + field(Type; Rec.Type) + { + Caption = 'Type'; + } + field(PageCaption; Rec."Page Caption") + { + Caption = 'Page Caption'; + } + field("User Full Name"; Rec."User Full Name") + { + Caption = 'User Full Name'; + Tooltip = 'Specifies the full name of the user that was involved in performing the step..'; + } field(Description; Rec.Description) { Caption = 'Description'; @@ -49,11 +64,6 @@ page 4303 "Agent Task Step List" Message(DetailsTxt); end; } - field("User Full Name"; Rec."User Full Name") - { - Caption = 'User Full Name'; - Tooltip = 'Specifies the full name of the user that was involved in performing the step..'; - } } } } @@ -72,9 +82,10 @@ page 4303 "Agent Task Step List" var AgentTaskImpl: Codeunit "Agent Task Impl."; begin - DetailsTxt := AgentTaskImpl.GetDetailsForAgentTaskStep(Rec); + DetailsTxt := AgentTaskImpl.GetDetailsForAgentTaskLogEntry(Rec); end; var DetailsTxt: Text; -} \ No newline at end of file +} +#pragma warning restore AS0125 \ No newline at end of file diff --git a/src/System Application/App/Agent/Permissions/AgentObjects.PermissionSet.al b/src/System Application/App/Agent/Permissions/AgentObjects.PermissionSet.al index 4d8e02fc41..b288087e86 100644 --- a/src/System Application/App/Agent/Permissions/AgentObjects.PermissionSet.al +++ b/src/System Application/App/Agent/Permissions/AgentObjects.PermissionSet.al @@ -17,7 +17,7 @@ permissionset 4300 "Agent - Objects" page "Agent Task List" = X, page "Agent Task Message Card" = X, page "Agent Task Message List" = X, - page "Agent Task Step List" = X, + page "Agent Task Log Entry List" = X, codeunit "Agent Impl." = X, codeunit "Agent Task" = X; } \ No newline at end of file diff --git a/src/System Application/App/Agent/TaskPane/AgentTaskDetails.Page.al b/src/System Application/App/Agent/TaskPane/AgentTaskDetails.Page.al index 09248c8125..d070ac4188 100644 --- a/src/System Application/App/Agent/TaskPane/AgentTaskDetails.Page.al +++ b/src/System Application/App/Agent/TaskPane/AgentTaskDetails.Page.al @@ -9,8 +9,8 @@ page 4313 "Agent Task Details" { PageType = ListPart; ApplicationArea = All; - SourceTable = "Agent Task Timeline Entry Step"; - Caption = 'Agent Task Timeline Entry Step'; + SourceTable = "Agent Task Timeline Step Det."; + Caption = 'Agent Task Timeline Step Details'; Editable = false; InsertAllowed = false; ModifyAllowed = false; @@ -23,7 +23,7 @@ page 4313 "Agent Task Details" { area(content) { - repeater(Steps) + repeater(Details) { field(ClientContext; ClientContext) { @@ -44,11 +44,11 @@ page 4313 "Agent Task Details" #pragma warning restore AW0005 { Caption = 'Confirm'; - ToolTip = 'Confirms the timeline entry.'; + ToolTip = 'Confirms the timeline step.'; trigger OnAction() begin - AddUserInterventionTaskStep(); + AddUserIntervention(); end; } #pragma warning disable AW0005 @@ -56,7 +56,7 @@ page 4313 "Agent Task Details" #pragma warning restore AW0005 { Caption = 'Discard step'; - ToolTip = 'Discard the timeline entry.'; + ToolTip = 'Discard the timeline step.'; trigger OnAction() begin SkipStep(); @@ -84,39 +84,39 @@ page 4313 "Agent Task Details" end; end; - local procedure AddUserInterventionTaskStep() + local procedure AddUserIntervention() var - UserInterventionRequestStep: Record "Agent Task Step"; - TaskTimelineEntry: Record "Agent Task Timeline Entry"; + UserInterventionRequestEntry: Record "Agent Task Log Entry"; + TaskTimelineStep: Record "Agent Task Timeline Step"; UserInput: Text; begin - TaskTimelineEntry.SetRange("Task ID", Rec."Task ID"); - TaskTimelineEntry.SetRange(ID, Rec."Timeline Entry ID"); - TaskTimelineEntry.SetRange("Last Step Type", TaskTimelineEntry."Last Step Type"::"User Intervention Request"); - if TaskTimelineEntry.FindLast() then begin - case TaskTimelineEntry."User Intervention Request Type" of - TaskTimelineEntry."User Intervention Request Type"::ReviewMessage: + TaskTimelineStep.SetRange("Task ID", Rec."Task ID"); + TaskTimelineStep.SetRange(ID, Rec."Timeline Step ID"); + TaskTimelineStep.SetRange("Last Log Entry Type", "Agent Task Log Entry Type"::"User Intervention Request"); + if TaskTimelineStep.FindLast() then begin + case TaskTimelineStep."User Intervention Request Type" of + TaskTimelineStep."User Intervention Request Type"::ReviewMessage: UserInput := ''; else UserInput := UserMessage; //ToDo: Will be implemented when we have a message field. end; - if UserInterventionRequestStep.Get(TaskTimelineEntry."Task ID", TaskTimelineEntry."Last Step Number") then - AgentTaskImpl.CreateUserInterventionTaskStep(UserInterventionRequestStep, UserInput); + if UserInterventionRequestEntry.Get(TaskTimelineStep."Task ID", TaskTimelineStep."Last Log Entry ID") then + AgentTaskImpl.CreateUserIntervention(UserInterventionRequestEntry, UserInput); end; end; local procedure SkipStep() var - TaskTimelineEntry: Record "Agent Task Timeline Entry"; + TaskTimelineStep: Record "Agent Task Timeline Step"; AgentTaskMessage: Record "Agent Task Message"; begin - if not TaskTimelineEntry.Get(Rec."Task ID", Rec."Timeline Entry ID") then + if not TaskTimelineStep.Get(Rec."Task ID", Rec."Timeline Step ID") then exit; - case TaskTimelineEntry.Type of - TaskTimelineEntry.Type::OutputMessage: - if AgentTaskMessage.Get(TaskTimelineEntry."Primary Page Record ID") then begin + case TaskTimelineStep.Type of + "Agent Task Timeline Step Type"::OutputMessage: + if AgentTaskMessage.Get(TaskTimelineStep."Primary Page Record ID") then begin AgentTaskMessage.Status := AgentTaskMessage.Status::Discarded; AgentTaskMessage.Modify(true); end; diff --git a/src/System Application/App/Agent/TaskPane/AgentTaskTimeline.Page.al b/src/System Application/App/Agent/TaskPane/AgentTaskTimeline.Page.al index a38f26de54..53f04caf1e 100644 --- a/src/System Application/App/Agent/TaskPane/AgentTaskTimeline.Page.al +++ b/src/System Application/App/Agent/TaskPane/AgentTaskTimeline.Page.al @@ -11,7 +11,7 @@ page 4307 "Agent Task Timeline" { PageType = ListPart; ApplicationArea = All; - SourceTable = "Agent Task Timeline Entry"; + SourceTable = "Agent Task Timeline Step"; Caption = 'Agent Task Timeline'; InsertAllowed = false; DeleteAllowed = false; @@ -34,22 +34,22 @@ page 4307 "Agent Task Timeline" field(Header; Rec.Title) { Caption = 'Header'; - ToolTip = 'Specifies the header of the timeline entry.'; + ToolTip = 'Specifies the header of the timeline step.'; } field(Summary; GlobalPageSummary) { Caption = 'Summary'; - ToolTip = 'Specifies the summary of the timeline entry.'; + ToolTip = 'Specifies the summary of the timeline step.'; } field(PrimaryPageQuery; GlobalPageQuery) { Caption = 'Primary Page Query'; - ToolTip = 'Specifies the primary page query of the timeline entry.'; + ToolTip = 'Specifies the primary page query of the timeline step.'; } field(Description; GlobalDescription) { Caption = 'Description'; - ToolTip = 'Specifies the description of the timeline entry.'; + ToolTip = 'Specifies the description of the timeline step.'; } field(Category; Rec.Category) { @@ -60,23 +60,23 @@ page 4307 "Agent Task Timeline" field(ConfirmationStatus; ConfirmationStatusOption) { Caption = 'Confirmation Status'; - ToolTip = 'Specifies the confirmation status of the timeline entry.'; + ToolTip = 'Specifies the confirmation status of the timeline step.'; OptionCaption = ' ,ConfirmationNotRequired,ReviewConfirmationRequired,ReviewConfirmed,StopConfirmationRequired,StopConfirmed,Discarded'; } field(ConfirmedBy; GlobalConfirmedBy) { Caption = 'Confirmed By'; - ToolTip = 'Specifies the user who confirmed the timeline entry.'; + ToolTip = 'Specifies the user who confirmed the timeline step.'; } field(ConfirmedAt; GlobalConfirmedAt) { Caption = 'Confirmed At'; - ToolTip = 'Specifies the date and time when the timeline entry was confirmed.'; + ToolTip = 'Specifies the date and time when the timeline step was confirmed.'; } field(Annotations; GlobalAnnotations) { Caption = 'Annotations'; - Tooltip = 'Specifies the annotations for the timeline entry, such as additional messages to surface to the user.'; + Tooltip = 'Specifies the annotations for the timeline step, such as additional messages to surface to the user.'; } field(Importance; Rec.Importance) { @@ -84,7 +84,7 @@ page 4307 "Agent Task Timeline" field(UserInterventionRequestType; Rec."User Intervention Request Type") { Caption = 'User Intervention Request Type'; - ToolTip = 'Specifies the type of user intervention request when this entry is an intervention request.'; + ToolTip = 'Specifies the type of user intervention request when this step is an intervention request.'; } field(Suggestions; GlobalSuggestions) { @@ -94,7 +94,7 @@ page 4307 "Agent Task Timeline" field(CreatedAt; Rec.SystemCreatedAt) { Caption = 'First Step Created At'; - ToolTip = 'Specifies the date and time when the timeline entry was created.'; + ToolTip = 'Specifies the date and time when the timeline step was created.'; } } } @@ -112,14 +112,14 @@ page 4307 "Agent Task Timeline" Scope = Repeater; trigger OnAction() var - UserInterventionRequestStep: Record "Agent Task Step"; + UserInterventionRequestEntry: Record "Agent Task Log Entry"; AgentTaskImpl: Codeunit "Agent Task Impl."; SelectedSuggestionIdInt: Integer; begin - if UserInterventionRequestStep.Get(Rec."Task ID", Rec."Last Step Number") then - if UserInterventionRequestStep.Type = "Agent Task Step Type"::"User Intervention Request" then + if UserInterventionRequestEntry.Get(Rec."Task ID", Rec."Last Log Entry ID") then + if UserInterventionRequestEntry.Type = "Agent Task Log Entry Type"::"User Intervention Request" then if Evaluate(SelectedSuggestionIdInt, SelectedSuggestionId) then - AgentTaskImpl.CreateUserInterventionTaskStep(UserInterventionRequestStep, SelectedSuggestionIdInt); + AgentTaskImpl.CreateUserIntervention(UserInterventionRequestEntry, SelectedSuggestionIdInt); end; } @@ -132,12 +132,12 @@ page 4307 "Agent Task Timeline" Scope = Repeater; trigger OnAction() var - UserInterventionRequestStep: Record "Agent Task Step"; + UserInterventionRequestEntry: Record "Agent Task Log Entry"; AgentTaskImpl: Codeunit "Agent Task Impl."; begin - if UserInterventionRequestStep.Get(Rec."Task ID", Rec."Last Step Number") then - if UserInterventionRequestStep.Type = "Agent Task Step Type"::"User Intervention Request" then - AgentTaskImpl.CreateUserInterventionTaskStep(UserInterventionRequestStep); + if UserInterventionRequestEntry.Get(Rec."Task ID", Rec."Last Log Entry ID") then + if UserInterventionRequestEntry.Type = "Agent Task Log Entry Type"::"User Intervention Request" then + AgentTaskImpl.CreateUserIntervention(UserInterventionRequestEntry); end; } @@ -158,8 +158,8 @@ page 4307 "Agent Task Timeline" local procedure SetTaskTimelineDetails() var InStream: InStream; - ConfirmationStepType: Enum "Agent Task Step Type"; - StepNumber: Integer; + ConfirmationLogEntryType: Enum "Agent Task Log Entry Type"; + LogEntryId: Integer; begin // Clear old values GlobalConfirmedBy := ''; @@ -199,52 +199,52 @@ page 4307 "Agent Task Timeline" end; ConfirmationStatusOption := ConfirmationStatusOption::ConfirmationNotRequired; - StepNumber := Rec."Last Step Number"; - if (Rec."Last Step Type" <> "Agent Task Step Type"::Stop) and (Rec."Last User Intervention Step" > 0) then - StepNumber := Rec."Last User Intervention Step" + LogEntryId := Rec."Last Log Entry ID"; + if (Rec."Last Log Entry Type" <> "Agent Task Log Entry Type"::Stop) and (Rec."Last User Intervention ID" > 0) then + LogEntryId := Rec."Last User Intervention ID" else - if Rec."Last Step Type" <> "Agent Task Step Type"::Stop then - // We know that there is no user intervention step for this timeline entry, and the last step is not a stop step. + if Rec."Last Log Entry Type" <> "Agent Task Log Entry Type"::Stop then + // We know that there is no user intervention entry for this timeline entry, and the last entry is not a stop. exit; - if not TryGetConfirmationDetails(StepNumber, GlobalConfirmedBy, GlobalConfirmedAt, ConfirmationStepType) then + if not TryGetConfirmationDetails(LogEntryId, GlobalConfirmedBy, GlobalConfirmedAt, ConfirmationLogEntryType) then exit; case - ConfirmationStepType of - "Agent Task Step Type"::"User Intervention Request": + ConfirmationLogEntryType of + "Agent Task Log Entry Type"::"User Intervention Request": ConfirmationStatusOption := ConfirmationStatusOption::ReviewConfirmationRequired; - "Agent Task Step Type"::"User Intervention": + "Agent Task Log Entry Type"::"User Intervention": ConfirmationStatusOption := ConfirmationStatusOption::ReviewConfirmed; - "Agent Task Step Type"::Stop: + "Agent Task Log Entry Type"::Stop: ConfirmationStatusOption := ConfirmationStatusOption::StopConfirmed; else ConfirmationStatusOption := ConfirmationStatusOption::ConfirmationNotRequired; end; end; - local procedure TryGetConfirmationDetails(StepNumber: Integer; var By: Text[250]; var At: DateTime; var ConfirmationStepType: Enum "Agent Task Step Type"): Boolean + local procedure TryGetConfirmationDetails(LogEntryId: Integer; var By: Text[250]; var At: DateTime; var ConfirmationLogEntryType: Enum "Agent Task Log Entry Type"): Boolean var - TaskTimelineEntryStep: Record "Agent Task Timeline Entry Step"; + TaskTimelineStepDetail: Record "Agent Task Timeline Step Det."; User: Record User; begin - if StepNumber <= 0 then + if LogEntryId <= 0 then exit(false); - TaskTimelineEntryStep.SetRange("Task ID", Rec."Task ID"); - TaskTimelineEntryStep.SetRange("Timeline Entry ID", Rec.ID); - TaskTimelineEntryStep.SetRange("Step Number", StepNumber); - if not TaskTimelineEntryStep.FindLast() then + TaskTimelineStepDetail.SetRange("Task ID", Rec."Task ID"); + TaskTimelineStepDetail.SetRange("Timeline Step ID", Rec.ID); + TaskTimelineStepDetail.SetRange("ID", LogEntryId); + if not TaskTimelineStepDetail.FindLast() then exit(false); - ConfirmationStepType := TaskTimelineEntryStep.Type; - if TaskTimelineEntryStep.Type = "Agent Task Step Type"::"User Intervention Request" then + ConfirmationLogEntryType := TaskTimelineStepDetail.Type; + if TaskTimelineStepDetail.Type = "Agent Task Log Entry Type"::"User Intervention Request" then exit(true); - if ((TaskTimelineEntryStep.Type <> "Agent Task Step Type"::"User Intervention") and - (TaskTimelineEntryStep.Type <> "Agent Task Step Type"::Stop)) then + if ((TaskTimelineStepDetail.Type <> "Agent Task Log Entry Type"::"User Intervention") and + (TaskTimelineStepDetail.Type <> "Agent Task Log Entry Type"::Stop)) then exit(false); - User.SetRange("User Security ID", TaskTimelineEntryStep."User Security ID"); + User.SetRange("User Security ID", TaskTimelineStepDetail."User Security ID"); if User.FindFirst() then if User."Full Name" <> '' then By := User."Full Name" diff --git a/src/System Application/App/Agent/TaskPane/AgentTasks.Page.al b/src/System Application/App/Agent/TaskPane/AgentTasks.Page.al index 2cedbce2df..e22cfd8a60 100644 --- a/src/System Application/App/Agent/TaskPane/AgentTasks.Page.al +++ b/src/System Application/App/Agent/TaskPane/AgentTasks.Page.al @@ -9,7 +9,7 @@ page 4306 "Agent Tasks" { PageType = ListPlus; ApplicationArea = All; - SourceTable = "Agent Task Pane Entry"; + SourceTable = "Agent Task Timeline"; Caption = 'Agent Tasks'; Editable = true; InsertAllowed = false; @@ -57,7 +57,7 @@ page 4306 "Agent Tasks" { Caption = 'Last Step Completed On'; } - field(TaskStepType; Rec."Current Entry Type") + field(TaskStepType; Rec."Current Step Type") { Caption = 'Step Type'; ToolTip = 'Specifies the type of the last step.'; @@ -77,7 +77,7 @@ page 4306 "Agent Tasks" part(Details; "Agent Task Details") { Provider = Timeline; - SubPageLink = "Task ID" = field("Task ID"), "Timeline Entry ID" = field(ID); + SubPageLink = "Task ID" = field("Task ID"), "Timeline Step ID" = field(ID); Editable = true; } } diff --git a/src/System Application/App/Agent/dotnet.al b/src/System Application/App/Agent/dotnet.al index 258384446e..a8bd0f24b8 100644 --- a/src/System Application/App/Agent/dotnet.al +++ b/src/System Application/App/Agent/dotnet.al @@ -15,4 +15,17 @@ dotnet { } } + + assembly("Microsoft.Dynamics.Nav.Types") + { + Culture = 'neutral'; + PublicKeyToken = '31bf3856ad364e35'; + type("Microsoft.Dynamics.Nav.Types.AgentTaskUserInterventionDetails"; "AgentTaskUserIntervention") + { + } + + type("Microsoft.Dynamics.Nav.Types.AgentTaskUserInterventionRequestDetails"; "AgentTaskUserInterventionRequest") + { + } + } } diff --git a/src/System Application/App/app.json b/src/System Application/App/app.json index f16de82bfb..cf2f851a6a 100644 --- a/src/System Application/App/app.json +++ b/src/System Application/App/app.json @@ -26,6 +26,11 @@ "id": "1a3ac64b-0e25-2345-8e9b-eab2a74b9e9a", "name": "Agent Developer Toolkit", "publisher": "Microsoft" + }, + { + "id": "5afe217e-507a-40b4-9aa5-f4325b6e8230", + "name": "Agent Test Library", + "publisher": "Microsoft" } ], "screenshots": [],