[Due for payment 2026-12-08] [$175] Netsuite-Tapping < twice from "Export company card expenses as" leads to "Card details" page
If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.
Version Number: v9.5.24-2 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/test-runs/80939792/folder/13176706/41236846/1917999345?sort=%2Bidentifier Email or phone of affected tester (no customers): [email protected] Issue reported by: Applause Internal Team Bug source: Regression TC Execution Device used: Windows 11 / Chrome App Component: Workspace Settings
Action Performed:
Preconditions:
- Logged in to ND using [email protected] account
- Connect "Company Cards tests - DO NOT DELETE!" workspace to Netsuite in accounting
- Navigate to Company Cards
Steps:
- Choose the first Mastercard in card feed
- Click the assigned card
- Click "Netsuite vendor bills export" row
- choose another account
- Click "Netsuite vendor bills export" row again and choose "default vendor" account
- Click "Netsuite vendor bills export" row again
- Click the hyperlinked "export option" in the subheader of the list
- Click "export company card expense as" -> click "export as" and choose "Journal entries"
- Tap back button "<" twice
Expected Result:
user should be landed to "NetSuite journal entries export" RHP page and there're account lists there
Actual Result:
User landed to "Card details" RHP page
Workaround:
Unknown
Platforms:
- [ ] Android: App
- [ ] Android: mWeb Chrome
- [ ] iOS: App
- [ ] iOS: mWeb Safari
- [ ] iOS: mWeb Chrome
- [x] Windows: Chrome
- [x] MacOS: Chrome Safari
Screenshots/Videos
https://github.com/user-attachments/assets/abb049cc-2653-42ac-9ae3-6879c788e542
Applause Internal Information Exported by: Julia Ponikarchuk Bug ID: 7298573
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022115374223496969925
- Upwork Job ID: 2115374223496969925
- Last Price Increase: 2026-10-28
Issue Owner
Current Issue Owner: @thelullabyy
While Applause doesn't embed attachments for this bug, here are the links for quick view: https://platform.applause.com/services/links/v1/external/ed0dad3a56e63bd2f0cd54e718095980125576672908aecd44785920d2736eff
Proposal
What is the root cause of that problem?
On the NetSuite export settings page, back goes straight to "Card details" when either the reimbursable or the non-reimbursable destination is "Expense report". The check is at NetSuiteExportConfigurationPage.tsx:56-58.
The reimbursable destination is usually "Expense report", so this check is true even when company card expenses export as "Journal entries". The card's account page is still valid for "Journal entries", so it should not be skipped. The card export logic decides that page using nonreimbursable ?? reimbursable (companyCards/utils.tsx:314-346). The back check does not use the same rule.
What changes do you think we should make in order to solve the problem?
In NetSuiteExportConfigurationPage, use the same rule as getExportMenuItem:
- Get the card export destination as
nonreimbursableExpensesExportDestination ?? reimbursableExpensesExportDestination. - Go back to "Card details" only when that destination is not "Vendor bill" or "Journal entry". Otherwise, go back normally.
Sage Intacct already does this in DynamicSageIntacctExportPage.tsx:34-37.
Add a test where reimbursable is "Expense report" and non-reimbursable is "Journal entry" or "Vendor bill". Back should return to the account page.
Investigation details
Navigation sequence
- Card details → account page (
.../edit/export/:feed/:cardID). - The "export options" link opens
.../edit/export/:feed/:cardID/connections/netsuite/export(NetSuiteExportConfigurationPage) →/expenses/nonreimbursable→/destination/select. - Choosing "Journal entries" sets
nonreimbursableExpensesExportDestinationtoJOURNAL_ENTRYand goes back one screen. - Back press 1: the expenses page goes back to
NetSuiteExportConfigurationPage. This is correct. - Back press 2:
shouldGoBackToSpecificRouteis true because reimbursable isEXPENSE_REPORT. goBackFromExportConnection.ts:11-17 removesedit/export/:feed/:cardIDfrom the path. It then goes back to Card details and skips the account page.
Ruled out
- The account page does not navigate away by itself. It shows "Journal entries" correctly.
- The "Export as" select page and the expenses page both go back one screen normally.
- The "export options" link keeps the account page as its base path.
Origin: The || check came from [Internal QA]: Add QBD to company card export, merged April 2025. This is a long-standing bug, not a recent regression. It likely also happens with "Vendor bills" and no changes, if reimbursable is "Expense report". The tester's reimbursable setting was not checked in Onyx.
Next Steps for Contributor+ team:
To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/105241) to create a draft PR.
To refine: @MelvinBot <your feedback>
To reject: Explain why you are rejecting Melvin's proposal.
Triggered auto assignment to Contributor-plus team member for initial proposal review - @thelullabyy (External)
Job added to Upwork: https://www.upwork.com/jobs/~022115374223496969925
Proposal
What is the root cause of that problem?
NetSuiteExportConfigurationPage.tsx:56-58 sets shouldGoBackToSpecificRoute to true when the reimbursable OR the non-reimbursable destination is EXPENSE_REPORT. goBackFromExportConnection.ts:11-17 then strips edit/export/:feed/:cardID via replaceCompanyCardsRoute and goes back to Card details. This skips the per-card account page.
Reimbursable is usually "Expense report", so the check is true even when company cards export as "Journal entries". But the card account page is still valid for that destination: getExportMenuItem in companyCards/utils.tsx:314-346 picks the page from nonreimbursableExpensesExportDestination ?? reimbursableExpensesExportDestination and shows it for VENDOR_BILL and JOURNAL_ENTRY. The back handler and the page logic use different rules, so the second back press lands on Card details.
What changes do you think we should make in order to solve the problem?
In NetSuiteExportConfigurationPage, derive the flag from the same rule as getExportMenuItem:
const cardDestination = config?.nonreimbursableExpensesExportDestination ?? config?.reimbursableExpensesExportDestination;
const shouldGoBackToSpecificRoute =
cardDestination !== CONST.NETSUITE_EXPORT_DESTINATION.VENDOR_BILL && cardDestination !== CONST.NETSUITE_EXPORT_DESTINATION.JOURNAL_ENTRY;
DynamicSageIntacctExportPage.tsx:34-37 already does the same for Intacct. goBackFromExportConnection needs no change.
Test: put the check in a small pure helper in netsuite/utils and unit test it. Reimbursable EXPENSE_REPORT with non-reimbursable JOURNAL_ENTRY or VENDOR_BILL must return false (back goes to the account page). Non-reimbursable EXPENSE_REPORT must return true.
What alternative solutions did you explore? (Optional)
MelvinBot's proposal finds the same root cause and the same fix. Mine differs by moving the rule into a helper with a unit test, so the page and getExportMenuItem cannot drift apart again. Alternative: removing shouldGoBackToSpecificRoute entirely and always going back one screen. I rejected it because it would break the case where the destination is Expense report, which has no account page.
Proposal
Please re-state the problem that we are trying to solve in this issue.
When navigating from a company card's NetSuite export settings (e.g. from "NetSuite vendor bills export") into "Export company card expenses as", changing the export type to "Journal entries", and pressing the back button < twice, the user is unexpectedly navigated all the way back to the "Card details" page instead of returning to the "NetSuite journal entries export" configuration page.
What is the root cause of that problem?
In src/pages/workspace/accounting/netsuite/export/NetSuiteExportConfigurationPage.tsx (lines 56–58):
const shouldGoBackToSpecificRoute =
config?.reimbursableExpensesExportDestination === CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORT ||
config?.nonreimbursableExpensesExportDestination === CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORT;
- Company card expenses are strictly non-reimbursable expenses, but
shouldGoBackToSpecificRouteerroneously checksreimbursableExpensesExportDestination. When reimbursable expenses are exported asEXPENSE_REPORT(a standard default configuration),shouldGoBackToSpecificRouteevaluates totrueregardless of what company cards are set to. - In
src/libs/Navigation/helpers/goBackFromExportConnection.ts:
function goBackFromExportConnection(shouldGoBackToSpecificRoute: boolean, dynamicBackPath?: Route) {
if (!shouldGoBackToSpecificRoute || !dynamicBackPath) {
return Navigation.goBack(dynamicBackPath);
}
const cardDetailsPage = replaceCompanyCardsRoute(dynamicBackPath);
return Navigation.goBack(cardDetailsPage, {compareParams: false});
}
goBackFromExportConnection only redirects straight to Card Details (replaceCompanyCardsRoute) when company cards export to an unsupported type that lacks per-card account mapping.
3. According to src/pages/workspace/companyCards/utils.tsx (lines 316–348), NetSuite supports per-card account mapping for both VENDOR_BILL and JOURNAL_ENTRY (shouldShowMenuItem: true). Therefore, when company card expenses are exported as either VENDOR_BILL or JOURNAL_ENTRY, the per-card account export selection page exists and should be returned to (shouldGoBackToSpecificRoute must be false).
4. Because NetSuiteExportConfigurationPage.tsx unconditionally sets shouldGoBackToSpecificRoute to true whenever reimbursableExpensesExportDestination === EXPENSE_REPORT, goBackFromExportConnection strips the card export route suffix and skips back to "Card details".
What changes do you think we should make in order to solve the problem?
In src/pages/workspace/accounting/netsuite/export/NetSuiteExportConfigurationPage.tsx:
Update shouldGoBackToSpecificRoute to only evaluate the non-reimbursable destination (company cards), returning true only when the destination is neither VENDOR_BILL nor JOURNAL_ENTRY (mirroring the pattern used in Sage Intacct at DynamicSageIntacctExportPage.tsx lines 36–37):
--- a/src/pages/workspace/accounting/netsuite/export/NetSuiteExportConfigurationPage.tsx
+++ b/src/pages/workspace/accounting/netsuite/export/NetSuiteExportConfigurationPage.tsx
@@ -54,8 +54,8 @@ function NetSuiteExportConfigurationPage({policy}: WithPolicyConnectionsProps)
const config = policy?.connections?.netsuite?.options.config;
const shouldGoBackToSpecificRoute =
- config?.reimbursableExpensesExportDestination === CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORT ||
- config?.nonreimbursableExpensesExportDestination === CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORT;
+ config?.nonreimbursableExpensesExportDestination !== CONST.NETSUITE_EXPORT_DESTINATION.VENDOR_BILL &&
+ config?.nonreimbursableExpensesExportDestination !== CONST.NETSUITE_EXPORT_DESTINATION.JOURNAL_ENTRY;
const backPath = useDynamicBackPath(DYNAMIC_ROUTES.POLICY_ACCOUNTING_NETSUITE_EXPORT.path);
const goBack = () => {
What alternative solutions did you explore? (Optional)
None needed; scoping shouldGoBackToSpecificRoute strictly to supported non-reimbursable export destinations aligns NetSuite with the established Sage Intacct and QBO implementations.
What automated tests can you add to prevent this from re-occurring?
Add a unit test in tests/unit/NetSuiteExportConfigurationPageTest.tsx asserting that when reimbursableExpensesExportDestination is EXPENSE_REPORT and nonreimbursableExpensesExportDestination is JOURNAL_ENTRY or VENDOR_BILL, goBackFromExportConnection is invoked with shouldGoBackToSpecificRoute = false, ensuring back navigation returns to the expected per-card export page.
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01f7d7991785f2ee01
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Proposal
Please re-state the problem that we are trying to solve in this issue.
When navigating from a company card's NetSuite export settings (e.g. from "NetSuite vendor bills export") into "Export company card expenses as", changing the export type to "Journal entries", and tapping the back button < twice, the user is unexpectedly redirected all the way back to the "Card details" page instead of returning to the "NetSuite journal entries export" account list page.
What is the root cause of that problem?
In src/pages/workspace/accounting/netsuite/export/NetSuiteExportConfigurationPage.tsx:56-58:
const config = policy?.connections?.netsuite?.options.config;
const shouldGoBackToSpecificRoute =
config?.reimbursableExpensesExportDestination === CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORT ||
config?.nonreimbursableExpensesExportDestination === CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORT;
- In
goBackFromExportConnection.ts:12-20,shouldGoBackToSpecificRoutecontrols whether back navigation returns to the intermediate card export page (Navigation.goBack(dynamicBackPath)) or skips straight back to the root Card Details view (replaceCompanyCardsRoute(dynamicBackPath)). Skipping to Card Details is only intended when company cards export to an unsupported destination that lacks a per-card account mapping page (such asEXPENSE_REPORT). - NetSuite supports per-card account mappings for both
VENDOR_BILLandJOURNAL_ENTRY(shouldShowMenuItem: trueinsrc/pages/workspace/companyCards/utils.tsx:315-346). - In
companyCards/utils.tsx:313, the effective NetSuite export destination for company cards is resolved usingconfig?.nonreimbursableExpensesExportDestination ?? config?.reimbursableExpensesExportDestination. - However, in
NetSuiteExportConfigurationPage.tsx,shouldGoBackToSpecificRoutechecksconfig?.reimbursableExpensesExportDestination === CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORTwith an||condition. Since out-of-pocket reimbursable expenses in NetSuite are almost always exported asEXPENSE_REPORT,shouldGoBackToSpecificRouteevaluates totrueeven when company cards (non-reimbursable) are configured asJOURNAL_ENTRYorVENDOR_BILL. - Because
shouldGoBackToSpecificRouteis incorrectlytrue,goBackFromExportConnectionstrips the card's per-account export route and jumps back to "Card details".
What changes do you think we should make in order to solve the problem?
In src/pages/workspace/accounting/netsuite/export/NetSuiteExportConfigurationPage.tsx:
Resolve the effective company card export destination using config?.nonreimbursableExpensesExportDestination ?? config?.reimbursableExpensesExportDestination (consistent with companyCards/utils.tsx:313), and set shouldGoBackToSpecificRoute to true only when that effective destination is EXPENSE_REPORT:
--- a/src/pages/workspace/accounting/netsuite/export/NetSuiteExportConfigurationPage.tsx
+++ b/src/pages/workspace/accounting/netsuite/export/NetSuiteExportConfigurationPage.tsx
@@ -53,9 +53,8 @@ function NetSuiteExportConfigurationPage({policy}: WithPolicyConnectionsProps)
const {isBetaEnabled} = usePermissions();
const config = policy?.connections?.netsuite?.options.config;
- const shouldGoBackToSpecificRoute =
- config?.reimbursableExpensesExportDestination === CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORT ||
- config?.nonreimbursableExpensesExportDestination === CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORT;
+ const effectiveCompanyCardExportDestination = config?.nonreimbursableExpensesExportDestination ?? config?.reimbursableExpensesExportDestination;
+ const shouldGoBackToSpecificRoute = effectiveCompanyCardExportDestination === CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORT;
const backPath = useDynamicBackPath(DYNAMIC_ROUTES.POLICY_ACCOUNTING_NETSUITE_EXPORT.path);
const goBack = () => {
What alternative solutions did you explore? (Optional)
- Checking only
config?.nonreimbursableExpensesExportDestination !== VENDOR_BILL && ... !== JOURNAL_ENTRYwithout the fallback was rejected because whennonreimbursableExpensesExportDestinationis undefined, company card exports inheritreimbursableExpensesExportDestination. Usingconfig?.nonreimbursableExpensesExportDestination ?? config?.reimbursableExpensesExportDestinationadheres to the exact contract incompanyCards/utils.tsx:313.
What automated tests can you add to prevent this from re-occurring?
Add a unit test in tests/unit/pages/workspace/accounting/NetSuiteExportConfigurationPageTest.tsx verifying that:
- When
reimbursableExpensesExportDestinationisEXPENSE_REPORTandnonreimbursableExpensesExportDestinationisJOURNAL_ENTRYorVENDOR_BILL,goBackFromExportConnectionis called withshouldGoBackToSpecificRoute = false, returning todynamicBackPath. - When both or the fallback are
EXPENSE_REPORT,shouldGoBackToSpecificRoute = true, correctly returning to the Card Details route.
Contributor details
Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~0105126232377c4c5c
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Proposal
Please re-state the problem that we are trying to solve in this issue.
When navigating from a company card's NetSuite export settings (e.g. from "NetSuite vendor bills export") into "Export company card expenses as", changing the export type to "Journal entries", and pressing the back button < twice, the user is unexpectedly navigated all the way back to the "Card details" page instead of returning to the card's per-account mapping page ("NetSuite journal entries export").
What is the root cause of that problem?
- In
src/pages/workspace/companyCards/utils.tsx(lines 314–347), company card export settings resolve their effective destination usingnetSuiteConfig = config?.nonreimbursableExpensesExportDestination ?? config?.reimbursableExpensesExportDestination. Per-card account selection pages are supported (shouldShowMenuItem: true) for bothVENDOR_BILLandJOURNAL_ENTRY. - However, in
src/pages/workspace/accounting/netsuite/export/NetSuiteExportConfigurationPage.tsx(lines 56–58),shouldGoBackToSpecificRouteis defined as:const shouldGoBackToSpecificRoute = config?.reimbursableExpensesExportDestination === CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORT || config?.nonreimbursableExpensesExportDestination === CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORT; - Because reimbursable (out-of-pocket) expenses in NetSuite are typically configured as
EXPENSE_REPORT, the condition evaluates totrueeven when company cards (non-reimbursable) are configured asJOURNAL_ENTRYorVENDOR_BILL. - When
shouldGoBackToSpecificRouteevaluates totrue,goBackFromExportConnection(insrc/libs/Navigation/helpers/goBackFromExportConnection.ts:15-18) strips the company card's export route viareplaceCompanyCardsRouteand prematurely navigates all the way back to the "Card details" page.
What changes do you think we should make in order to solve the problem?
In src/pages/workspace/accounting/netsuite/export/NetSuiteExportConfigurationPage.tsx, align the shouldGoBackToSpecificRoute check with the canonical company cards contract in companyCards/utils.tsx (lines 314–347) and mirror the established pattern from DynamicSageIntacctExportPage.tsx (lines 34–36):
Only route back to the specific "Card details" page when the effective card export destination does not support a per-card account mapping page (i.e. neither VENDOR_BILL nor JOURNAL_ENTRY):
--- a/src/pages/workspace/accounting/netsuite/export/NetSuiteExportConfigurationPage.tsx
+++ b/src/pages/workspace/accounting/netsuite/export/NetSuiteExportConfigurationPage.tsx
@@ -53,9 +53,9 @@ function NetSuiteExportConfigurationPage({policy}: WithPolicyConnectionsProps)
const {isBetaEnabled} = usePermissions();
const config = policy?.connections?.netsuite?.options.config;
+ const netSuiteConfig = config?.nonreimbursableExpensesExportDestination ?? config?.reimbursableExpensesExportDestination;
const shouldGoBackToSpecificRoute =
- config?.reimbursableExpensesExportDestination === CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORT ||
- config?.nonreimbursableExpensesExportDestination === CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORT;
+ netSuiteConfig !== CONST.NETSUITE_EXPORT_DESTINATION.VENDOR_BILL && netSuiteConfig !== CONST.NETSUITE_EXPORT_DESTINATION.JOURNAL_ENTRY;
const backPath = useDynamicBackPath(DYNAMIC_ROUTES.POLICY_ACCOUNTING_NETSUITE_EXPORT.path);
const goBack = () => {
What alternative solutions did you explore? (Optional)
- Checking only
netSuiteConfig === CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORT: Rejected because ifnetSuiteConfigis undefined or another non-mapped type,shouldShowMenuItemisfalse, and the user should be routed to Card Details. The negative check (!== VENDOR_BILL && !== JOURNAL_ENTRY) strictly mirrors thedefault: shouldShowMenuItem: falsebranch incompanyCards/utils.tsx:345and matchesDynamicSageIntacctExportPage.tsx:34-36.
What automated tests can you add to prevent this from re-occurring?
Add unit tests in tests/unit/pages/workspace/accounting/NetSuiteExportConfigurationPageTest.tsx to verify navigation behavior:
- When
nonreimbursableExpensesExportDestinationisJOURNAL_ENTRYorVENDOR_BILL,goBackFromExportConnectionis called withshouldGoBackToSpecificRoute = false, returning normally todynamicBackPath. - When
nonreimbursableExpensesExportDestinationisEXPENSE_REPORT(or neither vendor bill nor journal entry),shouldGoBackToSpecificRoute = true, redirecting to the Card Details route.
Contributor details
Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~015c92a110b06ee5b3
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a workspace connected to NetSuite is configured to export company card expenses (non-reimbursable) as "Journal entries", changing the export option and tapping the back button < twice skips the "NetSuite journal entries export" account list page and unexpectedly lands the user on the "Card details" page.
What is the root cause of that problem?
In src/pages/workspace/accounting/netsuite/export/NetSuiteExportConfigurationPage.tsx (lines 56–58):
const shouldGoBackToSpecificRoute =
config?.reimbursableExpensesExportDestination === CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORT ||
config?.nonreimbursableExpensesExportDestination === CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORT;
shouldGoBackToSpecificRoute is passed to goBackFromExportConnection(shouldGoBackToSpecificRoute, backPath). When true, goBackFromExportConnection redirects straight to the Card Details page via replaceCompanyCardsRoute(dynamicBackPath).
However, the OR (||) condition incorrectly marks shouldGoBackToSpecificRoute as true whenever reimbursableExpensesExportDestination === EXPENSE_REPORT, even when the active company card export destination (nonreimbursableExpensesExportDestination) is JOURNAL_ENTRY (a supported export type with selectable accounts).
Company card integration export in src/pages/workspace/companyCards/utils.tsx (line 314) prioritizes:
const netSuiteConfig = config?.nonreimbursableExpensesExportDestination ?? config?.reimbursableExpensesExportDestination;
Because line 56 uses || instead of evaluating the effective export destination used by company cards, it falsely bypasses the valid account configuration page.
What changes do you think we should make in order to solve the problem?
In src/pages/workspace/accounting/netsuite/export/NetSuiteExportConfigurationPage.tsx:
Align shouldGoBackToSpecificRoute with company card export resolution logic by evaluating the effective card export destination (nonreimbursableExpensesExportDestination ?? reimbursableExpensesExportDestination):
--- a/src/pages/workspace/accounting/netsuite/export/NetSuiteExportConfigurationPage.tsx
+++ b/src/pages/workspace/accounting/netsuite/export/NetSuiteExportConfigurationPage.tsx
@@ -53,6 +53,7 @@ function NetSuiteExportConfigurationPage({policy}: WithPolicyConnectionsProps) {
const {isBetaEnabled} = usePermissions();
const config = policy?.connections?.netsuite?.options.config;
- const shouldGoBackToSpecificRoute =
- config?.reimbursableExpensesExportDestination === CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORT ||
- config?.nonreimbursableExpensesExportDestination === CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORT;
+ const effectiveExportDestination = config?.nonreimbursableExpensesExportDestination ?? config?.reimbursableExpensesExportDestination;
+ const shouldGoBackToSpecificRoute = effectiveExportDestination === CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORT;
const backPath = useDynamicBackPath(DYNAMIC_ROUTES.POLICY_ACCOUNTING_NETSUITE_EXPORT.path);
What alternative solutions did you explore? (Optional)
- MelvinBot's proposal: MelvinBot noted the root cause in lines 56–58 but left the exact implementation ambiguous. By defining
effectiveExportDestination = config?.nonreimbursableExpensesExportDestination ?? config?.reimbursableExpensesExportDestination, we match the exact pattern insrc/pages/workspace/companyCards/utils.tsx:314, preventing regressions across other accounting integrations. - Checking both destinations independently: Fails because reimbursable and non-reimbursable export configurations can diverge; company card flows only care about the fallback hierarchy.
What automated tests can you add to prevent this from re-occurring?
In tests/unit/NetSuiteExportConfigurationPageTest.tsx:
- Render
NetSuiteExportConfigurationPagewithreimbursableExpensesExportDestination = EXPENSE_REPORTandnonreimbursableExpensesExportDestination = JOURNAL_ENTRY. - Trigger
goBack()and assertgoBackFromExportConnectionis called withshouldGoBackToSpecificRoute = false, ensuring navigation returns to the accounts list page rather than card details.
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~0170d6b02e9440e604
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a workspace connected to NetSuite is opened from a company card's details page (Card details -> NetSuite vendor bills export -> export options link in the subheader -> Export company card expenses as -> Export as -> Journal entries), tapping the back button < twice skips the card's per-account mapping page (NetSuite journal entries export) and lands directly on the Card details RHP page instead.
What is the root cause of that problem?
- Company card per-card account export supports both
VENDOR_BILLandJOURNAL_ENTRYand resolves vianonreimbursableExpensesExportDestination ?? reimbursableExpensesExportDestination: Insrc/pages/workspace/companyCards/utils.tsx(lines 304–348),getPolicyCardExportSettingsresolves the effective NetSuite company card export destination as:
In theconst netSuiteConfig = config?.nonreimbursableExpensesExportDestination ?? config?.reimbursableExpensesExportDestination;switch (netSuiteConfig)block (lines 316–347),shouldShowMenuItemistruefor bothCONST.NETSUITE_EXPORT_DESTINATION.VENDOR_BILL(which maps per-card vendor viaNVP_NETSUITE_EXPORT_VENDORagainstvendors) andCONST.NETSUITE_EXPORT_DESTINATION.JOURNAL_ENTRY(which maps per-card payable account viaNVP_NETSUITE_EXPORT_ACCOUNTagainstpayableList), andfalseonly in thedefaultbranch (e.g.,EXPENSE_REPORTorundefined). NetSuiteExportConfigurationPagecomputesshouldGoBackToSpecificRouteusing an||check onreimbursableExpensesExportDestination: Insrc/pages/workspace/accounting/netsuite/export/NetSuiteExportConfigurationPage.tsx(lines 55–63):
Because out-of-pocket (const config = policy?.connections?.netsuite?.options.config; const shouldGoBackToSpecificRoute = config?.reimbursableExpensesExportDestination === CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORT || config?.nonreimbursableExpensesExportDestination === CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORT; const backPath = useDynamicBackPath(DYNAMIC_ROUTES.POLICY_ACCOUNTING_NETSUITE_EXPORT.path); const goBack = () => { return goBackFromExportConnection(shouldGoBackToSpecificRoute, backPath); };reimbursableExpensesExportDestination) expenses in NetSuite default toEXPENSE_REPORT,config?.reimbursableExpensesExportDestination === CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORTevaluates totrueeven when company card expenses (nonreimbursableExpensesExportDestination) are set toJOURNAL_ENTRY(orVENDOR_BILL).goBackFromExportConnectionstrips the per-card account selection route whenshouldGoBackToSpecificRouteistrue: When the user taps<the first time onDynamicNetSuiteExportExpensesPage(.../edit/export/:feed/:cardID/connections/netsuite/export/expenses/nonreimbursable),Navigation.goBack(backPath)returns toNetSuiteExportConfigurationPage(.../edit/export/:feed/:cardID/connections/netsuite/export). When the user taps<the second time onNetSuiteExportConfigurationPage,goBackFromExportConnection(shouldGoBackToSpecificRoute, backPath)(src/libs/Navigation/helpers/goBackFromExportConnection.ts, lines 11–18) seesshouldGoBackToSpecificRoute === true, callsreplaceCompanyCardsRoute(dynamicBackPath)(src/libs/Navigation/helpers/replaceCompanyCardsRoute.ts, lines 13–16) to stripedit/export/:feed/:cardID, and navigates directly toDynamicWorkspaceCompanyCardDetailsPage(Card details), skippingDynamicWorkspaceCompanyCardAccountSelectCardPage(NetSuite journal entries export).
What changes do you think we should make in order to solve the problem?
- Update
shouldGoBackToSpecificRouteinsrc/pages/workspace/accounting/netsuite/export/NetSuiteExportConfigurationPage.tsx(lines 55–59): Resolve the effective company card export destination usingconfig?.nonreimbursableExpensesExportDestination ?? config?.reimbursableExpensesExportDestination—matchinggetPolicyCardExportSettingsinsrc/pages/workspace/companyCards/utils.tsx(line 314) andDynamicSageIntacctExportPageinsrc/pages/workspace/accounting/intacct/export/DynamicSageIntacctExportPage.tsx(lines 34–37)—and only skip back to Card details when that destination is neitherVENDOR_BILLnorJOURNAL_ENTRY:const config = policy?.connections?.netsuite?.options.config; // Skip the per-card list on back unless NetSuite is exporting as Vendor bill or Journal entry (see the NETSUITE case in getPolicyCardExportSettings) const netSuiteConfig = config?.nonreimbursableExpensesExportDestination ?? config?.reimbursableExpensesExportDestination; const shouldGoBackToSpecificRoute = netSuiteConfig !== CONST.NETSUITE_EXPORT_DESTINATION.VENDOR_BILL && netSuiteConfig !== CONST.NETSUITE_EXPORT_DESTINATION.JOURNAL_ENTRY; const backPath = useDynamicBackPath(DYNAMIC_ROUTES.POLICY_ACCOUNTING_NETSUITE_EXPORT.path); - Add test coverage in
tests/ui/NetSuiteExportConfigurationPageTest.tsx: Intests/ui/NetSuiteExportConfigurationPageTest.tsx, passonBackButtonPressthrough theConnectionLayoutmock and add tests verifying that pressing back callsgoBackFromExportConnectionwith:shouldGoBackToSpecificRoute = falsewhenreimbursableExpensesExportDestinationisEXPENSE_REPORTandnonreimbursableExpensesExportDestinationisJOURNAL_ENTRYorVENDOR_BILL(returning to the card export account page).shouldGoBackToSpecificRoute = truewhen the effective card export destination isEXPENSE_REPORT(skipping the card export account page and returning to Card details).
What alternative solutions did you explore? (Optional)
- Checking only
config?.nonreimbursableExpensesExportDestination !== VENDOR_BILL && ... !== JOURNAL_ENTRYwithout the?? config?.reimbursableExpensesExportDestinationfallback: Rejected becausegetPolicyCardExportSettings(src/pages/workspace/companyCards/utils.tsx:314) falls back toreimbursableExpensesExportDestinationwhennonreimbursableExpensesExportDestinationis undefined; omitting the fallback would mismatchshouldShowMenuItemwhennonreimbursableExpensesExportDestinationis unset. - Checking
netSuiteConfig === CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORTinstead of!== VENDOR_BILL && !== JOURNAL_ENTRY: Rejected because ingetPolicyCardExportSettings(src/pages/workspace/companyCards/utils.tsx:316-347),DynamicWorkspaceCompanyCardAccountSelectCardPageblocks access (shouldBeBlocked={!!getConnectedIntegration(policy) && exportMenuItem?.shouldShowMenuItem !== true}) for any value other thanVENDOR_BILLorJOURNAL_ENTRY(includingundefined), so!== VENDOR_BILL && !== JOURNAL_ENTRYis the exact inverse ofshouldShowMenuItemand matchesDynamicSageIntacctExportPage.tsx:34-37.
Proposal
Please re-state the problem that we are trying to solve in this issue.
When navigating from a company card's details page (Card details -> NetSuite vendor bills export -> export options link in the subheader -> Export company card expenses as -> Export as -> Journal entries), tapping the back button < twice skips the card's per-account selection page (NetSuite journal entries export) and lands directly on the Card details RHP page.
What is the root cause of that problem?
- In
src/pages/workspace/companyCards/utils.tsx(lines 313-347),getPolicyCardExportSettingsresolves the effective NetSuite company card export destination using:
and setsconst netSuiteConfig = config?.nonreimbursableExpensesExportDestination ?? config?.reimbursableExpensesExportDestination;shouldShowMenuItem: truefor bothCONST.NETSUITE_EXPORT_DESTINATION.VENDOR_BILLandCONST.NETSUITE_EXPORT_DESTINATION.JOURNAL_ENTRY(only settingshouldShowMenuItem: falsein thedefaultbranch, such asEXPENSE_REPORT). - However, in
src/pages/workspace/accounting/netsuite/export/NetSuiteExportConfigurationPage.tsx(lines 55-63):
Because reimbursable (out-of-pocket) expenses in NetSuite default toconst config = policy?.connections?.netsuite?.options.config; const shouldGoBackToSpecificRoute = config?.reimbursableExpensesExportDestination === CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORT || config?.nonreimbursableExpensesExportDestination === CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORT; const backPath = useDynamicBackPath(DYNAMIC_ROUTES.POLICY_ACCOUNTING_NETSUITE_EXPORT.path); const goBack = () => { return goBackFromExportConnection(shouldGoBackToSpecificRoute, backPath); };EXPENSE_REPORT, the||check onconfig?.reimbursableExpensesExportDestination === CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORTevaluates totrueeven when company card expenses (nonreimbursableExpensesExportDestination) are configured asJOURNAL_ENTRYorVENDOR_BILL. - When the user taps
<the second time onNetSuiteExportConfigurationPage,goBackFromExportConnection(shouldGoBackToSpecificRoute, backPath)(src/libs/Navigation/helpers/goBackFromExportConnection.ts:11-18) seesshouldGoBackToSpecificRoute === true, stripsedit/export/:feed/:cardIDviareplaceCompanyCardsRoute(dynamicBackPath), and jumps straight back to Card details, skipping NetSuite journal entries export.
What changes do you think we should make in order to solve the problem?
In src/pages/workspace/accounting/netsuite/export/NetSuiteExportConfigurationPage.tsx (lines 55-59), derive shouldGoBackToSpecificRoute from the effective company card export destination (config?.nonreimbursableExpensesExportDestination ?? config?.reimbursableExpensesExportDestination)—matching getPolicyCardExportSettings in src/pages/workspace/companyCards/utils.tsx:314 and DynamicSageIntacctExportPage.tsx:34-37:
--- a/src/pages/workspace/accounting/netsuite/export/NetSuiteExportConfigurationPage.tsx
+++ b/src/pages/workspace/accounting/netsuite/export/NetSuiteExportConfigurationPage.tsx
@@ -53,8 +53,9 @@ function NetSuiteExportConfigurationPage({policy}: WithPolicyConnectionsProps) {
const {isBetaEnabled} = usePermissions();
const config = policy?.connections?.netsuite?.options.config;
+ const netSuiteConfig = config?.nonreimbursableExpensesExportDestination ?? config?.reimbursableExpensesExportDestination;
const shouldGoBackToSpecificRoute =
- config?.reimbursableExpensesExportDestination === CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORT ||
- config?.nonreimbursableExpensesExportDestination === CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORT;
+ netSuiteConfig !== CONST.NETSUITE_EXPORT_DESTINATION.VENDOR_BILL && netSuiteConfig !== CONST.NETSUITE_EXPORT_DESTINATION.JOURNAL_ENTRY;
const backPath = useDynamicBackPath(DYNAMIC_ROUTES.POLICY_ACCOUNTING_NETSUITE_EXPORT.path);
What alternative solutions did you explore? (Optional)
- Checking only
config?.nonreimbursableExpensesExportDestinationwithout?? config?.reimbursableExpensesExportDestination: rejected becausegetPolicyCardExportSettings(companyCards/utils.tsx:314) falls back toreimbursableExpensesExportDestinationwhennonreimbursableExpensesExportDestinationis undefined. - Checking
netSuiteConfig === CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORTinstead of!== VENDOR_BILL && !== JOURNAL_ENTRY: rejected becauseDynamicWorkspaceCompanyCardAccountSelectCardPageblocks access whenevershouldShowMenuItem !== true(which is true only forVENDOR_BILLandJOURNAL_ENTRY), so!== VENDOR_BILL && !== JOURNAL_ENTRYis the exact inverse ofshouldShowMenuItemand matchesDynamicSageIntacctExportPage.tsx:34-37.
@thelullabyy Eep! 4 days overdue now. Issues have feelings too...
@thelullabyy Huh... This is 4 days overdue. Who can take care of this?
@thelullabyy Huh... This is 4 days overdue. Who can take care of this?
@thelullabyy 6 days overdue. This is scarier than being forced to listen to Vogon poetry!
@thelullabyy Still overdue 6 days?! Let's take care of this!