Repository navigation
Description
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: v9.3.44-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #80996
Email or phone of affected tester (no customers): n/a
Issue reported by: Applause Internal Team
Bug source: Exploratory - Critical User Impact
Device used: MacBook Air 15.2.1
App Component: Workspace Settings
Action Performed:
Prerequisite: accounting feature is enabled and Netsuite is connected on the workspace
- Go to https://staging.new.expensify.com
- Go to the workspace > Accounting > Import > Custom segments/records > Add custom segment/record
- Finish the flow and click Confirm
Expected Result:
After adding a custom segment/record the Netsuite connecting should synchronize successfully.
Actual Result:
Netsuite synchronization fails after adding a custom segment/record.
Workaround:
Unknown
Platforms:
- Android: App
- Android: mWeb Chrome
- iOS: App
- iOS: mWeb Safari
- iOS: mWeb Chrome
- Windows: Chrome
- MacOS: Chrome / Safari
Screenshots/Videos
Bug7113086_1774458496598.Recording__1887.mp4
Issue Owner
Current Issue Owner: @youssef-lrUpwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022036899455912557492
- Upwork Job ID: 2036899455912557492
- Last Price Increase: 2026-05-20
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
MelvinBot commentedon Mar 25, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a user adds a custom segment/record in Workspace > Accounting > Import > Custom segments/records > Add custom segment/record, the NetSuite synchronization fails after completing the flow and clicking Confirm.
What is the root cause of that problem?
Based on investigation of the App-side code, the custom segment addition flow works as follows:
customSegmentvscustomRecord) in Step 0 (ChooseSegmentTypeStep)segmentName,internalID,scriptID, andmappingin subsequent stepshandleFinishStepatNetSuiteImportAddCustomSegmentContent.tsx:56-78constructs the new segment object and callsupdateNetSuiteCustomSegmentsupdateNetSuiteCustomSegmentsatNetSuiteCommands.ts:597-618sendsAPI.write('UpdateNetSuiteCustomSegments', {policyID, customSegments: JSON.stringify(records)})to the backendThe
segmentType(whether it's acustomSegmentorcustomRecord) is not included in the API payload. TheNetSuiteCustomSegmenttype only has 4 fields:segmentName,internalID,scriptID,mapping. The segment type is stored in the form draft and used for UI display but is never sent to the backend.The frontend correctly sends the data as defined by the type system. The frontend does not trigger a sync — only
API.write('UpdateNetSuiteCustomSegments')is called. The backend likely triggers the NetSuite sync automatically after processing this write command. Since this bug is reproducible in production (not just staging), the sync failure likely originates on the server side when the backend tries to configure the custom segment/record in NetSuite without knowing whether it's a segment or record.Note: This is a pre-existing issue — the
segmentTypefield has never been part of theNetSuiteCustomSegmenttype. This was not introduced by the recent useSubPage refactor PR, which only changed the navigation model (fromuseSubSteptouseSubPage) without modifying the data submission logic.What changes do you think we should make in order to solve the problem?
This requires investigation on the server side to determine:
Does the
UpdateNetSuiteCustomSegmentsbackend handler need the segment type? If so, the fix would involve:segmentTypeto theNetSuiteCustomSegmenttype insrc/types/onyx/Policy.tssegmentTypein the segment object built inhandleFinishStepatNetSuiteImportAddCustomSegmentContent.tsx:59-65Is the sync failure caused by something else on the backend? — Server logs for the
UpdateNetSuiteCustomSegmentscommand should be checked to see the exact error during the sync attempt.What alternative solutions did you explore? (Optional)
I also investigated whether the
useSubPagerefactor in PR #80996 could cause timing issues (stale closures, premature navigation). While the refactor changed the navigation paradigm from in-memory state to URL-based routing, the corehandleFinishStepfunction and its data construction are unchanged and function correctly. The fact that this bug reproduces in production (which wouldn't have the refactor yet) confirms the refactor is not the cause.Additionally, I found a secondary bug: the edit form validation in
NetSuiteImportCustomFieldEdit.tsx:107-113always checks uniqueness againstcustomSegmentseven when editing acustomList— but this is a separate issue and wouldn't cause sync failures.Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR,@MelvinBot <your feedback>to refine this analysis, or explain why you are rejecting Melvin's proposal.melvin-bot commentedon Mar 25, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @abdulrahuman5196 (
External)[-]Netsuite - Sync fails after adding a custom segment/record[/-][+][$250] Netsuite - Sync fails after adding a custom segment/record[/+]melvin-bot commentedon Mar 25, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022036899455912557492
trasnake87 commentedon Mar 26, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a user adds a custom segment or custom record via Workspace > Accounting > NetSuite > Import > Custom segments/records, the subsequent NetSuite synchronization fails.
What is the root cause of that problem?
The
segmentTypefield (which distinguishes acustomSegmentfrom acustomRecord) is collected from the user in step 0 of the flow but is never included in the segment object sent to the backend. InNetSuiteImportAddCustomSegmentContent.tsx#L59-L65, the object constructed for the API call only includessegmentName,internalID,scriptID, andmapping— omittingsegmentType. TheNetSuiteCustomSegmenttype also lacks this field entirely. Without knowing whether the entry is a custom segment or custom record, the backend cannot issue the correct NetSuite API calls during sync.What changes do you think we should make in order to solve the problem?
segmentTypeto theNetSuiteCustomSegmenttype insrc/types/onyx/Policy.ts:segmentTypein the object built inhandleFinishStepinNetSuiteImportAddCustomSegmentContent.tsx:No other changes needed — the value is already JSON-stringified before being sent via
API.write, so the backend will automatically receive the new field.What alternative solutions did you explore? (Optional)
We considered whether the backend could infer the segment type from the
scriptIDformat, but this would be fragile and the data is already available on the frontend — it simply is not being forwarded.trasnake87 commentedon Mar 26, 2026
Contributor details
Your Expensify account email: trasnake87@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~010f770315ab181656
melvin-bot commentedon Mar 26, 2026
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
BarryArinze commentedon Mar 26, 2026
Proposal
### 1) Please re-state the problem that we are trying to solve in this issue.
When a user adds a custom segment or custom record via Workspace > Accounting > NetSuite > Import > Custom segments/records, the subsequent NetSuite synchronization fails.
### 2) What is the root cause of that problem?
I identified several potential root causes:
Missing Sync Stage for Custom Segments: In the CONST.POLICY.CONNECTIONS.SYNC_STAGE_NAME constants, there are sync stages for NETSUITE_SYNC_IMPORT_CUSTOM_LISTS but no corresponding sync stage for custom segments. The custom segments addition triggers the updateNetSuiteCustomSegments function but there's no dedicated sync stage to handle the synchronization process.
Incomplete Sync Progress Tracking: The updateNetSuiteCustomSegments function in NetSuiteCommands.ts updates the configuration but doesn't initiate a proper sync progress state using POLICY_CONNECTION_SYNC_PROGRESS like other NetSuite operations do.
Missing Sync Trigger: After adding custom segments via NetSuiteImportAddCustomSegmentContent.tsx, the code only updates the configuration but doesn't trigger the actual synchronization process that would validate the connection and sync the new custom segment data.
### 3) What changes do you think we should make in order to solve the problem?
typescript
Add Backend Sync Logic: Ensure the backend handles the new NETSUITE_SYNC_IMPORT_CUSTOM_SEGMENTS stage to properly synchronize custom segment data with NetSuite.
Add Validation in Custom Segment Flow: In NetSuiteImportAddCustomSegmentContent.tsx, add validation to ensure the NetSuite connection is still valid before attempting to add custom segments.
Improve Error Handling: Add better error handling and user feedback when sync fails after custom segment addition.
### 4) What alternative solutions did you explore? (Optional)
Manual Sync Trigger: Consider adding a "Sync Now" button after custom segment addition to manually trigger synchronization, but this would be a poor user experience compared to automatic sync.
Batch Processing: Instead of immediate sync, queue the custom segment changes and process them during the next regular sync cycle, but this could cause data inconsistency issues.
Separate Sync Process: Create a completely separate sync process for custom segments independent of the main NetSuite sync, but this would add complexity and potential race conditions.
BarryArinze commentedon Mar 26, 2026
🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.
82 remaining items
melvin-bot commentedon Jul 21, 2026
@youssef-lr Huh... This is 4 days overdue. Who can take care of this?
youssef-lr commentedon Jul 22, 2026
No update from customer yet.
melvin-bot commentedon Jul 28, 2026
@youssef-lr Eep! 4 days overdue now. Issues have feelings too...
youssef-lr commentedon Jul 29, 2026
No update
melvin-bot commentedon Aug 4, 2026
@youssef-lr Eep! 4 days overdue now. Issues have feelings too...
youssef-lr commentedon Aug 5, 2026
Going to close this for now until. It looks like this was user error when entering the wrong ID.