Skip to content

[Master] - [Expense Management] Move missing Employee Posting Group validation to rule violation - #11431

Open
v-rohangarg20 wants to merge 3 commits into
mainfrom
bugs/Bug-645043-expense-user-missing-employee-posting-group
Open

[Master] - [Expense Management] Move missing Employee Posting Group validation to rule violation#11431
v-rohangarg20 wants to merge 3 commits into
mainfrom
bugs/Bug-645043-expense-user-missing-employee-posting-group

Conversation

@v-rohangarg20

@v-rohangarg20 v-rohangarg20 commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Issue

Expense User with missing Employee Posting Group was failing with a hard error during validation and getting stuck during submission.

Cause

TestField("Employee Posting Group") was called directly during field validation on Expense and Expense Report Header, triggering hard errors rather than soft rule violations that allow users to review and resolve issues gracefully.

Solution

  1. Moved Employee Posting Group verification to rule validation logic in Expense Rule Validation codeunit for both Expenses and Expense Report lines.
  2. Added line-level rule re-evaluation when Employee Posting Group is updated on Expense Report Header without annoying confirm dialogs.
  3. Added field Employee Posting Group on Expense Report page.
  4. Added comprehensive test coverage in ExpenseRuleViolationTest.

AB#645043

@v-rohangarg20
v-rohangarg20 requested a review from a team as a code owner September 14, 2026 12:38
@github-actions github-actions Bot added AL: Apps (W1) Add-on apps for W1 Team: Finance GitHub request for Finance area labels Sep 14, 2026
@github-actions github-actions Bot modified the milestone: Version 30.0 Sep 14, 2026
@v-rohangarg20 v-rohangarg20 changed the title [Expense Management] Move missing Employee Posting Group validation to rule violation [Master] - [Expense Management] Move missing Employee Posting Group validation to rule violation Sep 14, 2026
Comment thread src/Apps/W1/ExpenseAgent/app/src/Expense/Tables/Expense.Table.al
Comment thread src/Apps/W1/ExpenseAgent/app/src/Expense/Tables/Expense.Table.al
@github-actions

Copy link
Copy Markdown
Contributor

$\textbf{🟡\ Medium\ Severity\ —\ Error\ Handling}$

Expense User No. now creates a non-blocking rule violation instead of failing immediately, but the branch for clearing Expense User No. does not guarantee a revalidation pass. If the user selects an employee with a blank posting group and then clears Expense User No. again before Expense Category was ever set, the previously inserted Expense Rule Violation record is left behind even though no employee is selected. Revalidate or explicitly clear expense rule violations in the blank-user branch.

Line mapping was unavailable, so this was posted as an issue comment.

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.41.6

@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Good Sense Reviewer - Round 1

Recommendation: Accept

Problem-solution fit: Strong

I reviewed the current diff and the linked work-item metadata for this PR in autonomous mode. I did not find a blocking correctness, data-integrity, security, or compatibility issue in the changed code.

Suggestions

None.

Risk assessment

The change is limited to the files in this PR and includes focused validation or test coverage where the scenario needs it.

Necessity

The change matches the stated Finance/Expense/Sustainability scenario and is reasonable for the target branch.


[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=11431 round=1 by=alexei-dobriansky at=2026-09-14T13:29:29.0587162Z lastSha=36066c3aab674d0b4146383a8a3c846f61e92bf1 reviewKey=9a6d627bd4d998834dda0f373e4df3fae0cf23e6bf84adf17d663da082f820df suggestions=none

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AL: Apps (W1) Add-on apps for W1 Team: Finance GitHub request for Finance area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants