Agent Message and Task - Fix modifying functions to only modify the target values#7618
Open
BazookaMusic wants to merge 2 commits intomainfrom
Open
Agent Message and Task - Fix modifying functions to only modify the target values#7618BazookaMusic wants to merge 2 commits intomainfrom
BazookaMusic wants to merge 2 commits intomainfrom
Conversation
- Modify methods to Get a fresh record before modifying to avoid overwriting unrelated fields - Add PK-based overloads (TaskID/MessageID/AgentTaskID) to public and impl codeunits - Obsolete old record-based write overloads with #if not CLEAN30 - Add documentation for read-only record overloads noting the record is not re-retrieved
- Replace record-based UpdateText/SetStatusToSent/StopTask/RestartTask/ SetStatusToReady calls with PK-based overloads in AgentTaskMessageCard, SOAEmailMessage, SOASendReplies, and AgentTaskManagementTest
There was a problem hiding this comment.
AL Documentation Audit
Documentation gaps were detected in the following apps:
- Agent-Test: 0% documentation coverage
- Agent: 0% documentation coverage
To generate documentation, run /al-docs init or /al-docs update using GitHub Copilot CLI or Claude Code.
This review is for awareness to help keep documentation in sync with code changes. It is okay to dismiss this request.
qutreson
reviewed
Apr 9, 2026
| UpdateText(AgentTaskMessage, NewMessageText); | ||
| end; | ||
|
|
||
| procedure UpdateText(var AgentTaskMessage: Record "Agent Task Message"; NewMessageText: Text) |
Contributor
There was a problem hiding this comment.
Since this method changed behavior, should we have a unit test for it to ensure we are not modifying all fields, but only the content?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The "Agent Message" and "Agent Task" codeunits had a major issue in the way their API worked. Methods which modified field values were using a var record parameter. What this means is that if the passed in record had modified fields and somebody calls for example
SetStatusToSent, the code will attempt to modify all fields including the status.Fix
Obsolete these methods and replace them with methods that take the PK and the new value. These will refetch the latest value, modify the field and then modify. They return the modified record as a return value.
Work Item(s)
Fixes AB#629278