Skip to content

[Due for payment 2025-12-17] [$250] Advanced Approval workflow can be set via import Member on the Collect plan #69362

Closed

Description

@IuliiaHerets

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.1.98-2
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail: #65398
Issue reported by: Applause Internal Team
Device used: Windows 11 / Chrome, Android 13 / Xiaomi Poco F5, Chrome / Android 13, mac OS 14.5 / MacBook Air 2020, iOS 15.8.3 / iPhone 7 Plus
App Component: Other

Action Performed:

Prerequisite:

  • Prepare the CSV file that has 2 approvers
  1. Create a new workspace with the Collect plan
  2. Go to Members > click More > Import spreadsheet
  3. Choose the CSV file that already prepared
  4. Click Import and dismiss the Import successful modal
  5. Go to Workflows and check the workspace still as Collect plan

Expected Result:

Workflow settings should not be updated when the CSV has advanced approvals uploaded to import Member option on the Collect plan WS, or the workspace plan should be auto-upgraded to the Control plan

Actual Result:

Advanced Approval workflow can be set via import Member on the Collect plan workspace without upgrading to the Control plan

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6924521_1755922088571!Members-no_missing_role-advanced_approvals (2).csv
https://github.com/user-attachments/assets/7fa318c1-7d43-4fa1-8797-ae8a39e911d1

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021995427951648098980
  • Upwork Job ID: 1995427951648098980
  • Last Price Increase: 2025-12-01

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Aug 27, 2025
  2. melvin-bot commented on Aug 27, 2025

    @melvin-bot

    Triggered auto assignment to @RachCHopkins (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  3. aadil42 commented on Aug 27, 2025

    @aadil42
    Contributor

    How do we do this?

    Prepare the CSV file that has 2 approvers

    you say 'the CSV' file is this a specific file? can we get it in the OP?

    Thank you.

  4. Eskalifer1 commented on Aug 27, 2025

    @Eskalifer1
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    Advanced Approval workflow can be set via import Member on the Collect plan

    What is the root cause of that problem?

    At the moment, we have no logic for checking whether we have Advanced approvals and what type of Workspace we have.

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

    We need to add useEffect, which will check whether Workspace has Advanced approvals and is not of the controll type, and if so, update it:

        const isCorporatePolicy = !isControlPolicy(policy);
    
        useEffect(() => {
            if (!policy?.id || !isAdvanceApproval || !isCorporatePolicy) return;
            upgradeToCorporate(policy.id, 'Advanced Approvals');
        }, [policy?.id, isAdvanceApproval, isCorporatePolicy]);

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    N/A

    What alternative solutions did you explore? (Optional)

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  5. lorretheboy commented on Aug 27, 2025

    @lorretheboy
    Contributor

    I think this should be automatically handled by BE, we shouldn't move this logic to FE side

  6. Eskalifer1 commented on Aug 27, 2025

    @Eskalifer1
    Contributor

    I agree with my @lorretheboy, it's best to do this from the backend.

  7. daledah commented on Aug 27, 2025

    @daledah
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    Advanced Approval workflow can be set via import Member on the Collect plan workspace without upgrading to the Control plan

    What is the root cause of that problem?

    We are defining the SubmitTo field as the member who approves

    /** The email of the member who approves this member's expenses */
    submitsTo: string;

    but we are not checking if submitsTo is not the default approver and this is collect policy then we are sending all the submitsTo params to the Back End

    if (isRoleMissing) {
    setImportedSpreadsheetMemberData(allMembers);
    Navigation.navigate(ROUTES.WORKSPACE_MEMBERS_IMPORTED_CONFIRMATION.getRoute(policyID));
    } else {
    setIsImporting(true);
    importPolicyMembers(policyID, allMembers);

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

    We should check the data before sending it to Back End.

    Here we will check if there is a submitsTo that is not the default approver and this is collect policy then we will redirect the user to the upgrade workspace route before continuing to import members by

    1. Define the 2 new states and the confirm modal in ImportedMembersPage component
        const [shouldShowUpgradeModal, setShouldShowUpgradeModal] = useState(false);
        const [isUpgradeModalShown, setIsUpgradeModalShown] = useState(false);
        ...
        <ConfirmModal
            isVisible={isUpgradeModalShown}
            title={'Before you go'}
            prompt={'You are importing multiple approvers so you will have to upgrade your workspace to access this feature'}
            onConfirm={() => {
                setIsUpgradeModalShown(false);
                setShouldShowUpgradeModal(false);
                Navigation.navigate(
                    ROUTES.WORKSPACE_UPGRADE.getRoute(
                        policyID,
                        CONST.UPGRADE_FEATURE_INTRO_MAPPING.approvals.alias,
                        Navigation.getActiveRoute(),
                    ),
                );
            }}
            onCancel={() => {
                setIsUpgradeModalShown(false);
                setShouldShowUpgradeModal(false);
                Navigation.goBack(ROUTES.WORKSPACE_MEMBERS.getRoute(policyID));
            }}
        />
    
    1. Check data before importing
        useEffect(() => {
            const defaultApprover = getDefaultApprover(policy);
            const columns = Object.values(spreadsheet?.columns ?? {});
            const membersSubmitsToColumn = columns.findIndex((column) => column === CONST.CSV_IMPORT_COLUMNS.SUBMIT_TO);
            const membersEmailsColumn = columns.findIndex((column) => column === CONST.CSV_IMPORT_COLUMNS.EMAIL);
            const membersSubmitsTo = membersSubmitsToColumn !== -1 ? spreadsheet?.data[membersSubmitsToColumn].map((submitsTo) => submitsTo) : [];
            spreadsheet?.data[membersEmailsColumn]?.slice(containsHeader ? 1 : 0).forEach((email, index) => {
                let submitsTo = '';
                if (membersSubmitsToColumn !== -1 && membersSubmitsTo?.[containsHeader ? index + 1 : index]) {
                    submitsTo = membersSubmitsTo?.[containsHeader ? index + 1 : index];
                }
                if (submitsTo !== defaultApprover && isCollectPolicy(policy)) {
                    setShouldShowUpgradeModal(true);
                }
            });
        }, [containsHeader, policy, spreadsheet?.columns, spreadsheet?.data]);
    
    1. When the user click import button, we'll show the confirm modal
            if (shouldShowUpgradeModal) {
                setIsUpgradeModalShown(true);
                return;
            }
    

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    None

    What alternative solutions did you explore? (Optional)

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  8. daledah commented on Aug 27, 2025

    @daledah
    Contributor

    To make testing easier here is my branch and the result

    result.mp4
  9. RachCHopkins commented on Aug 28, 2025

    @RachCHopkins
    Contributor

    Historically, you have always been able to import a spreadsheet with an advanced workflow into a Collect workspace on Classic, it just doesn't affect the workflow.

  10. RachCHopkins commented on Aug 28, 2025

    @RachCHopkins
    Contributor

    I can see on New Expensify it does alter the workflow.

    Classic:

    Image

    New:

    Image

    So what should be happening is that the advanced workflow does not apply.

    @lorretheboy does that line up with your understanding, and your feeling that this is BE?

  11. lorretheboy commented on Aug 28, 2025

    @lorretheboy
    Contributor

    Yeah @RachCHopkins, I personally think if user uploads the file that contains Advanced approval workflow, BE should either remove the invalid options automatically based on the WS status OR upgrade the WS

  12. daledah commented on Aug 28, 2025

    @daledah
    Contributor

    @RachCHopkins In my opinion, when a user uploads a file that contains Advanced approval workflow, we should create a pop up notification that it needs to upgrade to control workspace. Can you tag the design team here so we can know expected?

  13. RachCHopkins commented on Aug 28, 2025

    @RachCHopkins
    Contributor

    @Expensify/design what do you guys think?

    FYI everyone, I will be OOO from later today and all next week, if this needs a new BZ in that time, please remove me and add the Bug label again.

  14. 105 remaining items

  15. trjExpensify commented on Jan 19, 2026

    @trjExpensify
    Contributor

    Thanks! We had the one regression right? #76420

  16. trjExpensify commented on Jan 27, 2026

    @trjExpensify
    Contributor
  17. trjExpensify commented on Feb 2, 2026

    @trjExpensify
    Contributor
  18. sobitneupane commented on Feb 3, 2026

    @sobitneupane
    Contributor

    @trjExpensify I think there were at least three regressions, right @nkdengineer?

  19. nkdengineer commented on Feb 3, 2026

    @nkdengineer
    Contributor

    We only have one regression. It's reverted the first time due to the lint error

  20. trjExpensify commented on Feb 5, 2026

    @trjExpensify
    Contributor

    Okay, so payment summary as follows:

    Both paid via NewDot. Go ahead and request!

  21. twisterdotcom commented on Feb 25, 2026

    @twisterdotcom
    Contributor

    @nkdengineer has submitted payment for this report on ND here.

    SO: https://stackoverflowteams.com/c/expensify/questions/7582

    Zapier Logs Run ID: 00040eee-db12-a002-910c-d22b52b01d04
  22. garrettmknight commented on Mar 16, 2026

    @garrettmknight
    Contributor

    $125 approved for @sobitneupane

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions