Skip to content

[Due for payment 2026-11-25] [$175] [CFI] Invoices - Empty invoice report fields incorrectly display required-field errors in NewDot #106798

Open

Description

@MelvinBot

Problem

NewDot incorrectly displays missing-required-field errors for empty invoice report fields. The supplied screenshots show empty Customer Address and PO Number fields highlighted in red in NewDot, while the same invoice displays those fields without errors in Expensify Classic.

Reported platforms: NewDot web, staging and production.
Version: Not provided.

Steps to reproduce

  1. Open an invoice with empty Customer Address and PO Number invoice report fields in NewDot.
  2. View the invoice's report fields.
  3. Open the same invoice in Expensify Classic and compare.

Expected result

Empty invoice report fields display without missing-required-field errors, consistent with Classic and the invoice exemption described in the report.

Actual result

NewDot highlights the empty fields in red and displays:

  • “Customer Address is required”
  • “PO Number is required”

Classic displays the same empty fields without errors.

Requested frontend fix

Update local report-field validation in src/libs/ReportUtils.ts to respect the invoice exemption:

  • Do not generate missing-required-field errors for empty invoice fields.
  • Preserve required-field validation for expense reports and unrelated validation.
  • Add regression tests covering both report types.

Acceptance criteria

  • Empty Customer Address and PO Number invoice fields do not display required-field errors.
  • Empty required fields on expense reports still display the appropriate errors.
  • Unrelated validation remains unchanged.
  • Regression tests cover invoices and expense reports.

Evidence

Comparison screenshots are available in the source Slack thread. Customer-specific invoice and payment details are omitted from this public issue.

This issue records the reported behavior and requested fix; the code path and backend exemption have not been independently verified.

Slack thread: https://expensify.slack.com/archives/C049HHMV9SM/p1794525278541829

Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @DylanDylann

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Nov 13, 2026
  2. changed the title [-]Invoices - Empty invoice report fields incorrectly display required-field errors in NewDot[/-] [+][CFI] Invoices - Empty invoice report fields incorrectly display required-field errors in NewDot[/+] on Nov 13, 2026
  3. trjExpensify commented on Nov 13, 2026

    @trjExpensify
    Contributor

    @MelvinBot write a proposed solution for this.

  4. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Nov 13, 2026
  5. melvin-bot commented on Nov 13, 2026

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @DylanDylann (External)

  6. changed the title [-][CFI] Invoices - Empty invoice report fields incorrectly display required-field errors in NewDot[/-] [+][$175] [CFI] Invoices - Empty invoice report fields incorrectly display required-field errors in NewDot[/+] on Nov 13, 2026
  7. melvin-bot commented on Nov 13, 2026

    @melvin-bot
  8. MelvinBot commented on Nov 13, 2026

    @MelvinBot
    ContributorAuthor

    Proposal

    What is the root cause of that problem?

    Local report-field validation treats empty invoice fields like empty expense-report fields, without checking whether the report is an invoice. This generates the reported required-field messages and red highlighting.

    Code evidence

    What changes do you think we should make in order to solve the problem?

    Pass the report into getFieldViolation() and return no missing-required-field violation when isInvoiceReport(report) is true. Update both callers above.

    Keep the existing expense-report value/default checks unchanged. Do not suppress API errors, circular-reference validation, or unrelated report violations.

    Regression coverage:

    • Empty invoice fields—including Customer Address and PO Number—remain visible without required-field errors.
    • Empty required expense-report fields still show errors.
    • Empty invoice fields do not generate report-field warning indicators.
    • Populated values and default-value handling remain unchanged.
    Test locations

    What alternative solutions did you explore? (Optional)

    Skip invoice validation separately in each caller. That would work, but centralizing the exemption avoids duplicated logic and keeps field errors and warning indicators consistent.

    Code-based proposal; no changes or tests were run. Classic/backend behavior was not independently verified.


    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/106798#issuecomment-6840205884) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.


    view run

  9. SrkaLo92 commented on Nov 13, 2026

    @SrkaLo92

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    Empty invoice report fields (Customer Address, PO Number) show "X is required" in red in NewDot, while Classic shows them without errors.

    What is the root cause of that problem?

    getFieldViolation flags every empty field as required, it doesn't look at the report type or at the field's own required flag at all:

    https://github.com/Expensify/App/blob/d59adfd8/src/libs/ReportUtils.ts#L14498-L14504

    function getFieldViolation(reportField: PolicyReportField): ReportViolationName | undefined {
        ...
        return (reportField.value ?? reportField.defaultValue) ? undefined : CONST.REPORT_VIOLATIONS.FIELD_REQUIRED;
    }

    It's used for the red error under the field in MoneyRequestViewReportFields (L164) and for the RBR in hasVisibleReportFieldViolations (L11218), and that one runs for invoice reports too (isInvoiceReport(report) ? policy?.areInvoiceFieldsEnabled : ...).

    What's interesting is that the edit page already has its own idea of "required". DynamicEditReportFieldPage uses deletable (which is documented in PolicyReportField as "Tells if the field is required or not"):

    https://github.com/Expensify/App/blob/d59adfd8/src/pages/DynamicEditReportFieldPage.tsx#L139

    const isReportFieldDeletable = reportField.deletable && reportField?.fieldID !== CONST.REPORT_FIELD_TITLE_FIELD_ID;
    ...
    isRequired={!isReportFieldDeletable}

    So we have two different rules for the same thing. The view says every empty field is required, the edit page says only !deletable ones are. On top of that neither of them knows about the invoice exemption Classic has.

    What changes do you think we should make in order to solve the problem?

    Add one helper in ReportUtils and use it everywhere we decide if a report field is required:

    function isReportFieldRequired(reportField: PolicyReportField, report: OnyxEntry<Report>): boolean {
        // Invoice fields are never required, same as Classic
        if (isInvoiceReport(report)) {
            return false;
        }
        return reportField.fieldID === CONST.REPORT_FIELD_TITLE_FIELD_ID || !reportField.deletable;
    }
    1. getFieldViolation(reportField, report): return undefined early when !isReportFieldRequired(reportField, report), the rest stays as is. Update the 2 callers (MoneyRequestViewReportFields, hasVisibleReportFieldViolations) to pass the report, both already have it.
    2. DynamicEditReportFieldPage: use isRequired={isReportFieldRequired(reportField, report)} for the text/date/dropdown pages instead of !isReportFieldDeletable, so you can actually clear an invoice field and save it empty without the form error. The Delete menu item logic stays on isReportFieldDeletable, nothing changes there.

    Expense reports keep the same behaviour: fields created in NewDot are deletable: false (ReportField.ts L226) so they are still required, and the title field is unchanged.

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    ReportUtilsTest:

    • empty invoice field -> getFieldViolation returns undefined, hasVisibleReportFieldViolations false
    • empty expense report field with deletable: false -> fieldRequired, RBR true
    • empty expense report field with deletable: true -> no violation
    • field with value or defaultValue -> no violation (both report types)

    UI test for DynamicEditReportFieldPage: saving an empty value on an invoice field doesn't show "This field is required".

    What alternative solutions did you explore? (Optional)

    Only skip invoices inside getFieldViolation. It fixes the red text and the RBR, but the edit page would still refuse an empty value for the same field (and still ignore deletable), so the view and the edit page would keep disagreeing. Having one helper keeps them in sync.

  10. melvin-bot commented on Nov 13, 2026

    @melvin-bot

    📣 @SrkaLo92! 📣
    Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
    Please follow these steps:

    1. Make sure you've read and understood the contributing guidelines.
    2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
    3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
    4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
      Screen Shot 2022-11-16 at 4 42 54 PM
      Format:
    Contributor details
    Your Expensify account email: <REPLACE EMAIL HERE>
    Upwork Profile Link: <REPLACE LINK HERE>
    
  11. SrkaLo92 commented on Nov 13, 2026

    @SrkaLo92

    Contributor details
    Your Expensify account email: srdjanmarinkovic31@gmail.com
    Upwork Profile Link: https://www.upwork.com/freelancers/srdjanmarinkovic

  12. melvin-bot commented on Nov 13, 2026

    @melvin-bot

    ✅ Contributor details stored successfully. Thank you for contributing to Expensify!

  13. 1 remaining item

  14. TassioSales commented on Nov 13, 2026

    @TassioSales

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    When viewing an invoice in NewDot that contains empty invoice report fields (such as Customer Address and PO Number), NewDot displays required-field errors in red under the inputs, whereas in Expensify Classic empty invoice report fields are exempt from missing-required-field errors and render without errors.

    What is the root cause of that problem?

    In src/libs/ReportUtils.ts, getFieldViolation unconditionally returns CONST.REPORT_VIOLATIONS.FIELD_REQUIRED whenever an empty report field does not have a value or defaultValue, without considering the report context or checking if the report is an invoice report. Consequently, when MoneyRequestViewReportFields.tsx resolves field violations for report fields rendered in an invoice report, it tags the empty fields with FIELD_REQUIRED, causing the UI to display the required field error in red.

    What changes do you think we should make in order to solve the problem?

    1. In src/libs/ReportUtils.ts, update getFieldViolation to accept an optional report?: OnyxEntry<Report> parameter. Inside the function, return undefined early if isInvoiceReport(report) evaluates to true (consistent with Classic's invoice report field exemption).
    2. In src/components/MoneyRequestReportView/MoneyRequestViewReportFields.tsx, pass the existing report prop into getFieldViolation(field, report) when mapping the report fields.

    What alternative solutions did you explore? (Optional)

    Directly checking isInvoiceReport(report) within MoneyRequestViewReportFields.tsx before invoking getFieldViolation. However, centralizing the exemption check inside getFieldViolation in ReportUtils.ts ensures consistent violation evaluation across any present or future consumers.

  15. kevinjosh10 commented on Nov 14, 2026

    @kevinjosh10

    Proposal

    What is the root cause of that problem?

    1. getFieldViolation in src/libs/ReportUtils.ts (lines 14498–14504) does not consider report context or exempt invoice reports:

      function getFieldViolation(reportField: PolicyReportField): ReportViolationName | undefined {
          if (!reportField) {
              return undefined;
          }
      
          return (reportField.value ?? reportField.defaultValue) ? undefined : CONST.REPORT_VIOLATIONS.FIELD_REQUIRED;
      }

      getFieldViolation treats every empty field without a value or defaultValue as violating CONST.REPORT_VIOLATIONS.FIELD_REQUIRED. It does not accept the report object or check whether the report is an invoice report (isInvoiceReport(report)) or whether reportField.target === CONST.REPORT_FIELD_TARGETS.INVOICE.

    2. Callers pass empty fields without passing report context:

      • In src/components/MoneyRequestReportView/MoneyRequestViewReportFields.tsx (line 164), const violation = isFieldDisabled ? undefined : getFieldViolation(field); evaluates violations for invoice fields without passing report, causing empty invoice fields to receive violation = 'fieldRequired' and render the red error message in NewDot.
      • In hasVisibleReportFieldViolations in src/libs/ReportUtils.ts (lines 11186–11219), while lines 11186–11194 explicitly include invoice reports (if (!isGroupPolicyReport && !isInvoiceReport(report)) return false;), line 11218 calls !!getFieldViolation(field) without report context, producing a false report-field violation (RBR) on unpaid invoices with empty fields.
      • In src/hooks/useSaveReportField.ts (line 65), hasOtherViolations flags any empty field (field.value === '') as an active violation without checking isInvoiceReport(report) or getFieldViolation(field, report), incorrectly flagging shouldFixViolations: true for invoice reports.

    What changes do you think we should make in order to solve the problem?

    1. Update getFieldViolation in src/libs/ReportUtils.ts (lines 14498–14504):

      • Update getFieldViolation signature to accept optional report?: OnyxInputOrEntry<Report>:
        function getFieldViolation(reportField: PolicyReportField, report?: OnyxInputOrEntry<Report>): ReportViolationName | undefined {
            if (!reportField || isInvoiceReport(report) || reportField.target === CONST.REPORT_FIELD_TARGETS.INVOICE) {
                return undefined;
            }
        
            return (reportField.value ?? reportField.defaultValue) ? undefined : CONST.REPORT_VIOLATIONS.FIELD_REQUIRED;
        }
      • When the report is an invoice report (isInvoiceReport(report)), or when the field is specifically targeted to invoices (reportField.target === CONST.REPORT_FIELD_TARGETS.INVOICE), return undefined.
      • For all expense reports, existing behavior is 100% preserved.
    2. Pass report to getFieldViolation in Callers:

      • src/components/MoneyRequestReportView/MoneyRequestViewReportFields.tsx (line 164):
        Pass report to getFieldViolation:
        const violation = isFieldDisabled ? undefined : getFieldViolation(field, report);
      • src/libs/ReportUtils.ts (hasVisibleReportFieldViolations, line 11218):
        Pass report to getFieldViolation:
        return !!getFieldViolation(field, report);
      • src/hooks/useSaveReportField.ts (line 65):
        Gate hasOtherViolations so it does not flag empty invoice fields as violations:
        const hasOtherViolations =
            !isInvoiceReport(report) &&
            Object.entries(report.fieldList ?? {}).some(([key, field]) => key !== fieldKey && !!getFieldViolation(field, report) && !isFieldDisabled);
    3. Update & Add Regression Tests:

      • tests/unit/ReportUtilsTest.ts:
        • Update the existing test at lines 27690–27718 ('should return true when an unpaid invoice report has a required field with no value') to expect toBe(false), matching Classic and the invoice exemption specified in the issue.
        • Keep the expense report test at lines 27672–27688 expecting toBe(true).
        • Add dedicated unit tests for getFieldViolation:
          • Returns undefined for empty fields when report is an invoice report.
          • Returns undefined for empty fields when reportField.target === CONST.REPORT_FIELD_TARGETS.INVOICE.
          • Returns CONST.REPORT_VIOLATIONS.FIELD_REQUIRED for empty fields on expense reports.
          • Returns undefined when field has a value or defaultValue on any report type.
      • tests/ui/MoneyRequestViewReportFieldsTest.tsx:
        • Add a UI test verifying that empty invoice report fields (Customer Address, PO Number) on an invoice report render without error text and without red highlighting, while empty required fields on expense reports continue rendering <Field Name> is required.

    What alternative solutions did you explore? (Optional)

    • Changing deletable field semantics across all report types:
      We explored using !reportField.deletable as the required check as proposed by another contributor. However, PolicyReportField.deletable on workspace expense fields indicates whether the field can be removed from a report, and existing UI tests (tests/ui/MoneyRequestViewReportFieldsTest.tsx:401) use deletable: true while asserting that required-field errors display. Conflating deletable with the required status on expense reports introduces regressions in expense-report validation, violating the acceptance criteria ("Preserve required-field validation for expense reports and unrelated validation"). Scoping the exemption specifically to invoices via isInvoiceReport(report) || reportField.target === CONST.REPORT_FIELD_TARGETS.INVOICE is clean, robust, and completely regression-free.

    Contributor details

    Your Expensify account email: lkevinjosh10@gmail.com
    Upwork Profile Link: https://www.upwork.com/freelancers/~0131dae36abcf59374

  16. DylanDylann commented on Nov 17, 2026

    @DylanDylann
    Contributor

    @MelvinBot Implement this

  17. MelvinBot commented on Nov 17, 2026

    @MelvinBot
    ContributorAuthor

    🤖 Web test steps verification results: ❌ fail

    Implemented in draft PR: Avoid required-field errors on empty invoice report fields, assigned to DylanDylann; 1,739 targeted tests and static checks passed. Browser verification was fixture-blocked—all four assertions remain unverified, not confirmed defects—and the full-suite timeout and tooling limitations are documented in the PR.

    Creation menu without an invoice option

    Step Status
    Open an unpaid invoice with empty Customer Address and PO NumberNo invoice fixture or invoice creation option was available.
    Creation menu without an invoice option
    ⚠️
    Invoice fields remain visible without required errors or red highlightingBlocked by unavailable invoice fixture.
    ⚠️
    Empty required expense-report fields still show errorsNo configured required-field fixture was available.
    ⚠️
    Empty invoice fields produce no report-field warning indicatorBlocked by unavailable invoice fixture.
    ⚠️

    view run · no recording available

  18. expensify-chore-bot commented on Nov 17, 2026

    @expensify-chore-bot

    Triggered auto assignment to @carlosmiceli, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

  19. changed the title [-][$175] [CFI] Invoices - Empty invoice report fields incorrectly display required-field errors in NewDot[/-] [+][Due for payment 2026-11-25] [$175] [CFI] Invoices - Empty invoice report fields incorrectly display required-field errors in NewDot[/+] on Nov 18, 2026
  20. melvin-bot commented on Nov 18, 2026

    @melvin-bot

    @DylanDylann

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.5.41-2 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2026-11-25. 🎊

    The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the Contributor+ Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]. If no checklist is needed for this issue, you can click: [no checklist button]

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions