Skip to content

Extract NL customization to object extensions (TrMode)#8933

Open
Alexander-Ya wants to merge 1 commit into
mainfrom
bugs/Extract-NL-customization-to-object-extensions-v2
Open

Extract NL customization to object extensions (TrMode)#8933
Alexander-Ya wants to merge 1 commit into
mainfrom
bugs/Extract-NL-customization-to-object-extensions-v2

Conversation

@Alexander-Ya

@Alexander-Ya Alexander-Ya commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

What & why

Linked work

Fixes #

How I validated this

  • I read the full diff and it contains only changes I intended.
  • I built the affected app(s) locally with no new analyzer warnings.
  • I ran the change in Business Central and confirmed it behaves as expected.
  • I added or updated tests for the new behavior, or explained below why none are needed.

What I tested and the outcome (required — be specific: scenarios, commands, screenshots for UI changes)

Risk & compatibility

@Alexander-Ya Alexander-Ya requested review from a team June 30, 2026 13:39
@Alexander-Ya

Copy link
Copy Markdown
Contributor Author

Fixes AB#640601

@github-actions

Copy link
Copy Markdown
Contributor

Could not find a linked ADO work item. Please link one by using the pattern 'AB#' followed by the relevant work item number. You may use the 'Fixes' keyword to automatically resolve the work item when the pull request is merged. E.g. 'Fixes AB#1234'


var
Text1000000: Label '%1 can only be filled in when %2 %3 is equal to Customer or Vendor.';
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$\textbf{🟡\ Medium\ Severity\ —\ Style} \quad \color{gray}{\texttt{\small Iteration\ 1}}$

Label 'Text1000000' has no approved suffix and is missing a Comment for its three placeholders.

The label is passed to Error() so it must end with the 'Err' suffix (AA0074). Its three placeholders (%1 = FieldCaption('Transaction Mode Code'), %2 = FieldCaption('Account Type'), %3 = FieldCaption('Bal. Account Type')) also require a Comment parameter (AA0470). Rename the label to 'Text1000000Err' and add the Comment, then update the Error() call site to match.

Suggested change
}
Text1000000Err: Label '%1 can only be filled in when %2 %3 is equal to Customer or Vendor.', Comment = '%1 = Field Caption (Transaction Mode Code), %2 = Field Caption (Account Type), %3 = Field Caption (Bal. Account Type)';

Knowledge:

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why

}

var
Text1000001: Label 'It is not allowed to specify %1 when %2 is %3.';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$\textbf{🟡\ Medium\ Severity\ —\ Style} \quad \color{gray}{\texttt{\small Iteration\ 1}}$

Label 'Text1000001' has no approved suffix and is missing a Comment for its three placeholders.

The label is passed to Error() so it must end with the 'Err' suffix (AA0074). Its three placeholders (%1 = Field Caption 'Currency Euro', %2 = Field Caption 'Local Currency', %3 = the option value) also require a Comment parameter (AA0470) so translators can identify each slot. Rename the label to 'Text1000001Err' and add the Comment, then update the Error() call site to match.

Suggested change
Text1000001: Label 'It is not allowed to specify %1 when %2 is %3.';
Text1000001Err: Label 'It is not allowed to specify %1 when %2 is %3.', Comment = '%1 = Field Caption (Currency Euro), %2 = Field Caption (Local Currency), %3 = Local Currency value';

Knowledge:

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why

end;

var
Text001: Label 'must be 0 if %1 is %2';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$\textbf{🟡\ Medium\ Severity\ —\ Style} \quad \color{gray}{\texttt{\small Iteration\ 1}}$

Labels 'MustBe0Lbl', 'MustBeOddLbl', and 'MustBeEvenLbl' carry the 'Lbl' suffix, which is reserved for captions and tooltips, but all three are used as the error-description argument to FieldError() — an error-producing call.

Per the label-suffix guidance, labels consumed in error contexts must use the 'Err' suffix. Rename them to 'MustBe0Err', 'MustBeOddErr', and 'MustBeEvenErr', and update the six FieldError() call sites accordingly.

Knowledge:

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why

TransactionMode: Record "Transaction Mode";
AccountType: Option Customer,Vendor,Employee;
begin
if not TransactionMode.CheckTransactionModePartnerType(AccountType::Vendor, "Transaction Mode Code", "Partner Type") then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$\textbf{🟡\ Medium\ Severity\ —\ Style} \quad \color{gray}{\texttt{\small Iteration\ 1}}$

Label 'PartnerTypeMismatchMsg' uses the 'Msg' suffix, which is reserved for Message() calls, but the label is passed to Confirm().

Per the label-suffix guidance, labels consumed by Confirm() or StrMenu must use the 'Qst' suffix. Note that the parallel label in CustomerNL.TableExt.al is already correctly named 'PartnerTypeMismatchQst'. Rename this label to 'PartnerTypeMismatchQst' and update its Confirm() call site.

Suggested change
if not TransactionMode.CheckTransactionModePartnerType(AccountType::Vendor, "Transaction Mode Code", "Partner Type") then
PartnerTypeMismatchQst: Label 'The Partner Type does not match the Partner Type defined in Transaction Mode. Do you still want to change the Partner Type?';

Knowledge:

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why

VendBankAcc: Record "Vendor Bank Account";
IsHandled: Boolean;
begin
IsHandled := false;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$\textbf{🟡\ Medium\ Severity\ —\ Style} \quad \color{gray}{\texttt{\small Iteration\ 1}}$

Confirm() is called with a StrSubstNo-wrapped format string: 'Confirm(StrSubstNo(UpdateBankAccountsQst, UseFieldCaption))'.

The AL platform's Confirm() accepts a format string and variable arguments directly — wrapping with StrSubstNo hides the placeholder from analyzers and breaks the translation link. Replace with 'Confirm(UpdateBankAccountsQst, false, UseFieldCaption)', passing false as the default-button argument and the caption as the format argument.

Suggested change
IsHandled := false;
if not Confirm(UpdateBankAccountsQst, false, UseFieldCaption) then

Knowledge:

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code suggestion is off. Addressing issue in #8930.

CustBankAcc: Record "Customer Bank Account";
IsHandled: Boolean;
begin
IsHandled := false;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$\textbf{🟡\ Medium\ Severity\ —\ Style} \quad \color{gray}{\texttt{\small Iteration\ 1}}$

Confirm() is called with a StrSubstNo-wrapped format string: 'Confirm(StrSubstNo(UpdateBankAccountsQst, UseFieldCaption))'.

The AL platform's Confirm() accepts a format string and variable arguments directly — wrapping with StrSubstNo hides the placeholder from analyzers and breaks the translation link. Replace with 'Confirm(UpdateBankAccountsQst, false, UseFieldCaption)', passing false as the default-button argument and the caption as the format argument.

Suggested change
IsHandled := false;
if not Confirm(UpdateBankAccountsQst, false, UseFieldCaption) then

Knowledge:

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code suggestion is off. Addressing issue in #8930.

@github-actions

Copy link
Copy Markdown
Contributor

Copilot PR Review

Iteration 1 · Outcome: completed

Knowledge source: https://github.com/microsoft/BCQuality@822cae1b2771ac25f665f73369f69093bd4fd630

Findings by domain

Findings split into Knowledge-backed (cite a BCQuality article) and Agent (the agent's own judgement, no matching BCQuality rule).

Domain Findings Knowledge-backed Agent Inline Fallback
Style 6 6 0 6 0

Totals: 6 knowledge-backed · 0 agent findings.

Orchestrator pre-filter (13 file(s) excluded)

  • layer-disabled (knowledge) : 13 file(s)

Findings produced by the Copilot CLI agent against BCQuality at 822cae1b2771ac25f665f73369f69093bd4fd630. Reply 👎 on any inline comment to flag false positives.

JesperSchulz pushed a commit that referenced this pull request Jun 30, 2026
The model-reported anchor for a single-line suggestion can be off by more
than 8 lines (e.g. PR #8933 VendorNL Confirm() was off by 10, label rename
off by 9). Widen the search window to 40 lines either side so the correct
target within the same procedure is considered, while the 0.5 similarity
floor and 0.1 ambiguity margin keep an unrelated look-alike from winning.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
JesperSchulz pushed a commit that referenced this pull request Jun 30, 2026
Widening the search window exposed a precision problem: a label-rename
suggestion whose added Comment text echoes the field captions at the
Error()/Confirm() call site would re-anchor onto the call site (PR #8933
GenJournalLineNL/GeneralLedgerSetupNL 'Text1000000/1' findings), which is
worse than the original mis-anchor.

Raise the similarity floor to 0.6 and use a bounded window (20). Genuine
edit targets - an edited statement or a renamed declaration - score
~0.75-0.99 and re-anchor confidently (the PR #8933 Confirm() findings and
the PartnerTypeMismatchMsg->Qst rename now land on the right line). Lower-
confidence look-alikes stay below the floor and are suppressed, so the
caller posts a manual snippet instead of a wrong auto-applicable anchor.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants