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
- Connect a workspace to NetSuite test account that has vendors
- Do not explicitly pick a Default vendor
- Visit Settings → Workspaces → [workspace] → Accounting → NetSuite → Export → Export company card expenses as.
- Observe the "Default vendor" row shows the name of one of the vendors.
- 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.
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
defaultVendorconfig. 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
Expected
Either:
config.defaultVendoris empty, orconfig.defaultVendorthe moment the Export page renders.Actual
vendorsas if selected, butconfig.defaultVendorremains"".NetSuiteReportProperties.java:414with"Default vendor not set up for a policy. Please visit your NetSuite connected policy(ies) to ensure that a default vendor is selected.".Root cause
PolicyUtils.ts:1403-1406: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, andfindSelectedSageVendorWithDefaultSelect— likely repros on those rows too.