Skip to content

NetSuite: Default vendor row shows vendor name even when config.defaultVendor is empty #88357

@blimpich

Description

@blimpich

Summary

The "Default vendor" row on the NetSuite → Export → "Export company card expenses as: Vendor bills" page displays a vendor name even when no vendor has actually been persisted to the policy's defaultVendor config. The display is a fallback to "the first vendor in the list", which misleads admins into thinking they're configured when they aren't.

Reproduction

  1. Connect a workspace to NetSuite test account that has vendors
  2. Do not explicitly pick a Default vendor
  3. Visit Settings → Workspaces → [workspace] → Accounting → NetSuite → Export → Export company card expenses as.
  4. Observe the "Default vendor" row shows the name of one of the vendors.
  5. Submit & export a report with non-reimbursable (company card) expenses

Expected

Either:

  • The "Default vendor" row shows an empty / "Not selected" state when config.defaultVendor is empty, or
  • Selecting a fallback on display is fine and that selection is persisted to config.defaultVendor the moment the Export page renders.

Actual

  • The row renders the first vendor in vendors as if selected, but config.defaultVendor remains "".
  • Export fails at NetSuiteReportProperties.java:414 with "Default vendor not set up for a policy. Please visit your NetSuite connected policy(ies) to ensure that a default vendor is selected.".
  • Admin has no in-UI signal that their config is actually empty until export fails.

Root cause

PolicyUtils.ts:1403-1406:

function findSelectedVendorWithDefaultSelect(vendors: NetSuiteVendor[] | undefined, selectedVendorId: string | undefined) {
    const selectedVendor = (vendors ?? []).find(({id}) => id === selectedVendorId);
    return selectedVendor ?? vendors?.[0] ?? undefined;
}

The function returns vendors[0] when nothing is explicitly selected, and the caller (DynamicNetSuiteExportExpensesPage.tsx:82) uses that fallback as the row's title with no "unselected" fallback text.

The same pattern also exists for findSelectedBankAccountWithDefaultSelect, findSelectedInvoiceItemWithDefaultSelect, findSelectedTaxAccountWithDefaultSelect, and findSelectedSageVendorWithDefaultSelect — likely repros on those rows too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions