[SOA] Show Cc recipients on email messages - #10247
Conversation
| EmailMessage: Codeunit "Email Message"; | ||
| CcRecipients: List of [Text]; | ||
| CcRecipient: Text; | ||
| CcRecipientsText: Text; |
There was a problem hiding this comment.
GetMessageCcRecipients builds the CC list by repeatedly appending to a Text value inside the foreach loop. Use a TextBuilder and convert once after the loop to avoid reallocating the result for every recipient.
Suggested fix (apply manually — could not be anchored as a one-click suggestion):
CcRecipientsTextBuilder: TextBuilder;
begin
SourceAgentTaskMessage := AgentTaskMessage;
if AgentTaskMessage.Type = AgentTaskMessage.Type::Output then
if not SourceAgentTaskMessage.Get(AgentTaskMessage."Task ID", AgentTaskMessage."Input Message ID") then
exit('');
SOAEmail.SetLoadFields("Email Inbox ID");
SOAEmail.SetRange("Task ID", SourceAgentTaskMessage."Task ID");
SOAEmail.SetRange("Task Message ID", SourceAgentTaskMessage.ID);
if not SOAEmail.FindFirst() then
exit('');
EmailInbox.SetLoadFields("Message Id");
if not EmailInbox.Get(SOAEmail."Email Inbox ID") then
exit('');
if not EmailMessage.Get(EmailInbox."Message Id") then
exit('');
EmailMessage.GetRecipients(Enum::"Email Recipient Type"::Cc, CcRecipients);
foreach CcRecipient in CcRecipients do begin
if CcRecipientsTextBuilder.Length() > 0 then
CcRecipientsTextBuilder.Append(';');
CcRecipientsTextBuilder.Append(CcRecipient);
end;
exit(CcRecipientsTextBuilder.ToText());Knowledge:
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.32.4
Agentic PR Review - Round 1Recommendation: AcceptWhat this PR doesThis fixes the Sales Order Agent Cc visibility bug by adding a read-only Cc field to the email details page and loading it from the original inbox email. The code resolves outgoing messages back to their input message, uses the same semicolon format as the Email Viewer, and returns blank when the source email cannot be found. The change is read-only and does not change recipient selection or email sending. SuggestionsNone. Risk assessment and necessityRisk: The regression surface is limited to the Sales Order Agent email card. The new field reads recipients from Email Inbox and Email Message; it does not write data, change reply creation, or affect posting. There is no BaseApp event or publisher dependency. Necessity: The linked bug has a clear repro: reviewers cannot see Cc recipients in the incoming or outgoing SOA email cards, even though the email thread includes them. The scoped UI addition is justified and matches the existing Email Viewer display pattern.
|
What & why
Sales Order Agent email cards did not show Cc recipients, so reviewers could not see everyone included in incoming and outgoing correspondence.
This change adds the standard read-only, Additional-importance Cc field to the email details. It resolves the complete Cc list from the original inbox email for both incoming messages and their outgoing replies, using the same semicolon-separated formatting as the Business Central Email Viewer. The field remains present but blank when there are no Cc recipients.
Linked work
Fixes AB#632233
How I validated this
What I tested and the outcome
git diff --checkpassed, and the committed diff contains only the two intended Sales Order Agent files.Manual Agent Task Creation Type/IAgentManualTaskCreationsymbols and the missingContact List.OnBeforeFindRecordevent introduced by another current-main change.Risk & compatibility
Low. The change is read-only and does not alter email creation, recipient selection, sending, or stored data. Missing inbox/message records produce a blank Cc value. Multiple recipients use the standard semicolon-separated Email Viewer format. Very long lists follow the existing Business Central Email Viewer behavior; no separate recipient-list UX is introduced by this minimal fix.