App icon indicating copy to clipboard operation
App copied to clipboard

[Due for payment 2026-12-08] [$175] Netsuite-Tapping < twice from "Export company card expenses as" leads to "Card details" page

Open applause-bot[bot] opened this issue 1 month ago • 38 comments

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:

  1. Choose the first Mastercard in card feed
  2. Click the assigned card
  3. Click "Netsuite vendor bills export" row
  4. choose another account
  5. Click "Netsuite vendor bills export" row again and choose "default vendor" account
  6. Click "Netsuite vendor bills export" row again
  7. Click the hyperlinked "export option" in the subheader of the list
  8. Click "export company card expense as" -> click "export as" and choose "Journal entries"
  9. 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

View all open jobs on GitHub

Applause Internal Information Exported by: Julia Ponikarchuk Bug ID: 7298573

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

applause-bot[bot] avatar Oct 28 '26 09:10 applause-bot[bot]

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

applause-bot[bot] avatar Oct 28 '26 09:10 applause-bot[bot]

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:

  1. Get the card export destination as nonreimbursableExpensesExportDestination ?? reimbursableExpensesExportDestination.
  2. 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

  1. Card details → account page (.../edit/export/:feed/:cardID).
  2. The "export options" link opens .../edit/export/:feed/:cardID/connections/netsuite/export (NetSuiteExportConfigurationPage) → /expenses/nonreimbursable → /destination/select.
  3. Choosing "Journal entries" sets nonreimbursableExpensesExportDestination to JOURNAL_ENTRY and goes back one screen.
  4. Back press 1: the expenses page goes back to NetSuiteExportConfigurationPage. This is correct.
  5. Back press 2: shouldGoBackToSpecificRoute is true because reimbursable is EXPENSE_REPORT. goBackFromExportConnection.ts:11-17 removes edit/export/:feed/:cardID from 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.


view run

MelvinBot avatar Oct 28 '26 09:10 MelvinBot

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

melvin-bot[bot] avatar Oct 28 '26 09:10 melvin-bot[bot]

Job added to Upwork: https://www.upwork.com/jobs/~022115374223496969925

melvin-bot[bot] avatar Oct 28 '26 09:10 melvin-bot[bot]

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.

Stephen3453 avatar Oct 28 '26 09:10 Stephen3453

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;
  1. Company card expenses are strictly non-reimbursable expenses, but shouldGoBackToSpecificRoute erroneously checks reimbursableExpensesExportDestination. When reimbursable expenses are exported as EXPENSE_REPORT (a standard default configuration), shouldGoBackToSpecificRoute evaluates to true regardless of what company cards are set to.
  2. 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

apoorv-xs avatar Oct 28 '26 09:10 apoorv-xs

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

melvin-bot[bot] avatar Oct 28 '26 09:10 melvin-bot[bot]

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;
  1. In goBackFromExportConnection.ts:12-20, shouldGoBackToSpecificRoute controls 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 as EXPENSE_REPORT).
  2. NetSuite supports per-card account mappings for both VENDOR_BILL and JOURNAL_ENTRY (shouldShowMenuItem: true in src/pages/workspace/companyCards/utils.tsx:315-346).
  3. In companyCards/utils.tsx:313, the effective NetSuite export destination for company cards is resolved using config?.nonreimbursableExpensesExportDestination ?? config?.reimbursableExpensesExportDestination.
  4. However, in NetSuiteExportConfigurationPage.tsx, shouldGoBackToSpecificRoute checks config?.reimbursableExpensesExportDestination === CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORT with an || condition. Since out-of-pocket reimbursable expenses in NetSuite are almost always exported as EXPENSE_REPORT, shouldGoBackToSpecificRoute evaluates to true even when company cards (non-reimbursable) are configured as JOURNAL_ENTRY or VENDOR_BILL.
  5. Because shouldGoBackToSpecificRoute is incorrectly true, goBackFromExportConnection strips 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_ENTRY without the fallback was rejected because when nonreimbursableExpensesExportDestination is undefined, company card exports inherit reimbursableExpensesExportDestination. Using config?.nonreimbursableExpensesExportDestination ?? config?.reimbursableExpensesExportDestination adheres to the exact contract in companyCards/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:

  1. When reimbursableExpensesExportDestination is EXPENSE_REPORT and nonreimbursableExpensesExportDestination is JOURNAL_ENTRY or VENDOR_BILL, goBackFromExportConnection is called with shouldGoBackToSpecificRoute = false, returning to dynamicBackPath.
  2. 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

ayolyn avatar Oct 28 '26 09:10 ayolyn

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

melvin-bot[bot] avatar Oct 28 '26 09:10 melvin-bot[bot]

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?

  1. In src/pages/workspace/companyCards/utils.tsx (lines 314–347), company card export settings resolve their effective destination using netSuiteConfig = config?.nonreimbursableExpensesExportDestination ?? config?.reimbursableExpensesExportDestination. Per-card account selection pages are supported (shouldShowMenuItem: true) for both VENDOR_BILL and JOURNAL_ENTRY.
  2. However, in src/pages/workspace/accounting/netsuite/export/NetSuiteExportConfigurationPage.tsx (lines 56–58), shouldGoBackToSpecificRoute is defined as:
    const shouldGoBackToSpecificRoute =
        config?.reimbursableExpensesExportDestination === CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORT ||
        config?.nonreimbursableExpensesExportDestination === CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORT;
    
  3. Because reimbursable (out-of-pocket) expenses in NetSuite are typically configured as EXPENSE_REPORT, the condition evaluates to true even when company cards (non-reimbursable) are configured as JOURNAL_ENTRY or VENDOR_BILL.
  4. When shouldGoBackToSpecificRoute evaluates to true, goBackFromExportConnection (in src/libs/Navigation/helpers/goBackFromExportConnection.ts:15-18) strips the company card's export route via replaceCompanyCardsRoute and 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 if netSuiteConfig is undefined or another non-mapped type, shouldShowMenuItem is false, and the user should be routed to Card Details. The negative check (!== VENDOR_BILL && !== JOURNAL_ENTRY) strictly mirrors the default: shouldShowMenuItem: false branch in companyCards/utils.tsx:345 and matches DynamicSageIntacctExportPage.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:

  1. When nonreimbursableExpensesExportDestination is JOURNAL_ENTRY or VENDOR_BILL, goBackFromExportConnection is called with shouldGoBackToSpecificRoute = false, returning normally to dynamicBackPath.
  2. When nonreimbursableExpensesExportDestination is EXPENSE_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

andregrunert-ctrl avatar Oct 28 '26 12:10 andregrunert-ctrl

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

melvin-bot[bot] avatar Oct 28 '26 12:10 melvin-bot[bot]

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 in src/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 NetSuiteExportConfigurationPage with reimbursableExpensesExportDestination = EXPENSE_REPORT and nonreimbursableExpensesExportDestination = JOURNAL_ENTRY.
  • Trigger goBack() and assert goBackFromExportConnection is called with shouldGoBackToSpecificRoute = 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

camesenin avatar Oct 28 '26 13:10 camesenin

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

melvin-bot[bot] avatar Oct 28 '26 13:10 melvin-bot[bot]

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?

  1. Company card per-card account export supports both VENDOR_BILL and JOURNAL_ENTRY and resolves via nonreimbursableExpensesExportDestination ?? reimbursableExpensesExportDestination: In src/pages/workspace/companyCards/utils.tsx (lines 304–348), getPolicyCardExportSettings resolves the effective NetSuite company card export destination as:
    const netSuiteConfig = config?.nonreimbursableExpensesExportDestination ?? config?.reimbursableExpensesExportDestination;
    
    In the switch (netSuiteConfig) block (lines 316–347), shouldShowMenuItem is true for both CONST.NETSUITE_EXPORT_DESTINATION.VENDOR_BILL (which maps per-card vendor via NVP_NETSUITE_EXPORT_VENDOR against vendors) and CONST.NETSUITE_EXPORT_DESTINATION.JOURNAL_ENTRY (which maps per-card payable account via NVP_NETSUITE_EXPORT_ACCOUNT against payableList), and false only in the default branch (e.g., EXPENSE_REPORT or undefined).
  2. NetSuiteExportConfigurationPage computes shouldGoBackToSpecificRoute using an || check on reimbursableExpensesExportDestination: In src/pages/workspace/accounting/netsuite/export/NetSuiteExportConfigurationPage.tsx (lines 55–63):
    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);
    };
    
    Because out-of-pocket (reimbursableExpensesExportDestination) expenses in NetSuite default to EXPENSE_REPORT, config?.reimbursableExpensesExportDestination === CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORT evaluates to true even when company card expenses (nonreimbursableExpensesExportDestination) are set to JOURNAL_ENTRY (or VENDOR_BILL).
  3. goBackFromExportConnection strips the per-card account selection route when shouldGoBackToSpecificRoute is true: When the user taps < the first time on DynamicNetSuiteExportExpensesPage (.../edit/export/:feed/:cardID/connections/netsuite/export/expenses/nonreimbursable), Navigation.goBack(backPath) returns to NetSuiteExportConfigurationPage (.../edit/export/:feed/:cardID/connections/netsuite/export). When the user taps < the second time on NetSuiteExportConfigurationPage, goBackFromExportConnection(shouldGoBackToSpecificRoute, backPath) (src/libs/Navigation/helpers/goBackFromExportConnection.ts, lines 11–18) sees shouldGoBackToSpecificRoute === true, calls replaceCompanyCardsRoute(dynamicBackPath) (src/libs/Navigation/helpers/replaceCompanyCardsRoute.ts, lines 13–16) to strip edit/export/:feed/:cardID, and navigates directly to DynamicWorkspaceCompanyCardDetailsPage (Card details), skipping DynamicWorkspaceCompanyCardAccountSelectCardPage (NetSuite journal entries export).

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

  1. Update shouldGoBackToSpecificRoute in src/pages/workspace/accounting/netsuite/export/NetSuiteExportConfigurationPage.tsx (lines 55–59): Resolve the effective company card export destination using config?.nonreimbursableExpensesExportDestination ?? config?.reimbursableExpensesExportDestination—matching getPolicyCardExportSettings in src/pages/workspace/companyCards/utils.tsx (line 314) and DynamicSageIntacctExportPage in src/pages/workspace/accounting/intacct/export/DynamicSageIntacctExportPage.tsx (lines 34–37)—and only skip back to Card details when that destination is neither VENDOR_BILL nor JOURNAL_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);
    
  2. Add test coverage in tests/ui/NetSuiteExportConfigurationPageTest.tsx: In tests/ui/NetSuiteExportConfigurationPageTest.tsx, pass onBackButtonPress through the ConnectionLayout mock and add tests verifying that pressing back calls goBackFromExportConnection with:
    • shouldGoBackToSpecificRoute = false when reimbursableExpensesExportDestination is EXPENSE_REPORT and nonreimbursableExpensesExportDestination is JOURNAL_ENTRY or VENDOR_BILL (returning to the card export account page).
    • shouldGoBackToSpecificRoute = true when the effective card export destination is EXPENSE_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_ENTRY without the ?? config?.reimbursableExpensesExportDestination fallback: Rejected because getPolicyCardExportSettings (src/pages/workspace/companyCards/utils.tsx:314) falls back to reimbursableExpensesExportDestination when nonreimbursableExpensesExportDestination is undefined; omitting the fallback would mismatch shouldShowMenuItem when nonreimbursableExpensesExportDestination is unset.
  • Checking netSuiteConfig === CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORT instead of !== VENDOR_BILL && !== JOURNAL_ENTRY: Rejected because in getPolicyCardExportSettings (src/pages/workspace/companyCards/utils.tsx:316-347), DynamicWorkspaceCompanyCardAccountSelectCardPage blocks access (shouldBeBlocked={!!getConnectedIntegration(policy) && exportMenuItem?.shouldShowMenuItem !== true}) for any value other than VENDOR_BILL or JOURNAL_ENTRY (including undefined), so !== VENDOR_BILL && !== JOURNAL_ENTRY is the exact inverse of shouldShowMenuItem and matches DynamicSageIntacctExportPage.tsx:34-37.

huhuli083-creator avatar Oct 28 '26 13:10 huhuli083-creator

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?

  1. In src/pages/workspace/companyCards/utils.tsx (lines 313-347), getPolicyCardExportSettings resolves the effective NetSuite company card export destination using:
    const netSuiteConfig = config?.nonreimbursableExpensesExportDestination ?? config?.reimbursableExpensesExportDestination;
    
    and sets shouldShowMenuItem: true for both CONST.NETSUITE_EXPORT_DESTINATION.VENDOR_BILL and CONST.NETSUITE_EXPORT_DESTINATION.JOURNAL_ENTRY (only setting shouldShowMenuItem: false in the default branch, such as EXPENSE_REPORT).
  2. However, in src/pages/workspace/accounting/netsuite/export/NetSuiteExportConfigurationPage.tsx (lines 55-63):
    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);
    };
    
    Because reimbursable (out-of-pocket) expenses in NetSuite default to EXPENSE_REPORT, the || check on config?.reimbursableExpensesExportDestination === CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORT evaluates to true even when company card expenses (nonreimbursableExpensesExportDestination) are configured as JOURNAL_ENTRY or VENDOR_BILL.
  3. When the user taps < the second time on NetSuiteExportConfigurationPage, goBackFromExportConnection(shouldGoBackToSpecificRoute, backPath) (src/libs/Navigation/helpers/goBackFromExportConnection.ts:11-18) sees shouldGoBackToSpecificRoute === true, strips edit/export/:feed/:cardID via replaceCompanyCardsRoute(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?.nonreimbursableExpensesExportDestination without ?? config?.reimbursableExpensesExportDestination: rejected because getPolicyCardExportSettings (companyCards/utils.tsx:314) falls back to reimbursableExpensesExportDestination when nonreimbursableExpensesExportDestination is undefined.
  • Checking netSuiteConfig === CONST.NETSUITE_EXPORT_DESTINATION.EXPENSE_REPORT instead of !== VENDOR_BILL && !== JOURNAL_ENTRY: rejected because DynamicWorkspaceCompanyCardAccountSelectCardPage blocks access whenever shouldShowMenuItem !== true (which is true only for VENDOR_BILL and JOURNAL_ENTRY), so !== VENDOR_BILL && !== JOURNAL_ENTRY is the exact inverse of shouldShowMenuItem and matches DynamicSageIntacctExportPage.tsx:34-37.

Enes2553 avatar Oct 28 '26 17:10 Enes2553

@thelullabyy Eep! 4 days overdue now. Issues have feelings too...

melvin-bot[bot] avatar Nov 02 '26 23:11 melvin-bot[bot]

@thelullabyy Huh... This is 4 days overdue. Who can take care of this?

melvin-bot[bot] avatar Nov 03 '26 01:11 melvin-bot[bot]

@thelullabyy Huh... This is 4 days overdue. Who can take care of this?

melvin-bot[bot] avatar Nov 03 '26 03:11 melvin-bot[bot]

@thelullabyy 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

melvin-bot[bot] avatar Nov 05 '26 00:11 melvin-bot[bot]

@thelullabyy Still overdue 6 days?! Let's take care of this!

melvin-bot[bot] avatar Nov 05 '26 02:11 melvin-bot[bot]