Skip to content

[Due for payment 2026-01-05] [$250] Reports - Only one field shown when adding “A” and “a” report fields #74673

Closed

Description

@jponikarchuk

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.2.47-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: #72375
Email or phone of affected tester (no customers): slottwo1alefish@gmail.com
Issue reported by: Applause Internal Team
Device used: Redminote 10s android 6
App Component: Workspace Settings

Action Performed:

  1. Launch app
  2. Go to workspace settings
  3. Tap reports
  4. Enable Report fields
  5. Tap add field
  6. Enter name as "A" in caps
  7. Select type " Text"
  8. Set initial value {field:a}
  9. Tap save
  10. Tap add field
  11. Enter name as "a" in lowercase
  12. Select type as "text"
  13. Set initial value as {field:b}
  14. Note instead of 2 fields, only second added field is shown in lists

Expected Result:

Since both field names are saved successfully, both fields (A and a) should be shown in the list.

Actual Result:

Only the second field (“a”) is shown in the report field list. The first field (“A”) disappears after adding the second field with the same name in lowercase.

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

1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021987959690602612587
  • Upwork Job ID: 1987959690602612587
  • Last Price Increase: 2025-11-10
  • Automatic offers:
    • nyomanjyotisa | Contributor | 109455355

Activity

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

    @melvin-bot

    Triggered auto assignment to @heyjennahay (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. nyomanjyotisa commented on Nov 10, 2025

    @nyomanjyotisa
    Member

    Proposal

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

    Reports - Only one field shown when adding "A" and "a" report fields

    What is the root cause of that problem?

    generateFieldID converts the field name to uppercase when generating the fieldID. This causes fields with names "A" and "a" to generate the same fieldID (field_id_A). Since report fields are stored in the fieldList object using the fieldID as the key, the second field overwrites the first one

    function generateFieldID(name: string) {
    return `field_id_${name.replace(CONST.REGEX.ANY_SPACE, '_').toUpperCase()}`;
    }

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

    We can remove the .toUpperCase call from the generateFieldID to make fieldID generation case-sensitive

    function generateFieldID(name: string) {
        return `field_id_${name.replace(CONST.REGEX.ANY_SPACE, '_')}`;
    }

    function generateFieldID(name: string) {
    return `field_id_${name.replace(CONST.REGEX.ANY_SPACE, '_').toUpperCase()}`;
    }

    What alternative solutions did you explore? (Optional)

    Add case-insensitive validation in the form validation to prevent users from creating fields with names that differ only by case

    } else if (Object.values(policy?.fieldList ?? {}).some((reportField) => reportField.name.toLowerCase() === name.toLowerCase())) {
        errors[INPUT_IDS.NAME] = translate('workspace.reportFields.existingReportFieldNameError');

    } else if (Object.values(policy?.fieldList ?? {}).some((reportField) => reportField.name === name)) {
    errors[INPUT_IDS.NAME] = translate('workspace.reportFields.existingReportFieldNameError');

  4. daledah commented on Nov 10, 2025

    @daledah
    Contributor

    Proposal

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

    Only the second field (“a”) is shown in the report field list. The first field (“A”) disappears after adding the second field with the same name in lowercase.

    What is the root cause of that problem?

    When we create a new report filed, we are getting the ID from generateFieldID and in this function we are using toUpperCase => 'a' and A has the same id

    function generateFieldID(name: string) {
    return `field_id_${name.replace(CONST.REGEX.ANY_SPACE, '_').toUpperCase()}`;
    }

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

    1. we can add the index to the field id by updating
        const fieldID = WorkspaceReportFieldUtils.generateFieldID(`${name}_${Object.keys(previousFieldList).length + 1}`);
    

    const fieldID = WorkspaceReportFieldUtils.generateFieldID(name);

    or we can remove toUpperCase in generateFieldID function

        function generateFieldID(name: string) {
            return `field_id_${name.replace(CONST.REGEX.ANY_SPACE, '_')}`;
        }
    
    1. Then we should remove Str.UCFirst from here to remove capitalized of the first letter when we show the report field

    <MenuItemWithTopDescription
    description={Str.UCFirst(reportField.name)}
    title={reportField.fieldValue}

    Image

    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. thelullabyy commented on Nov 10, 2025

    @thelullabyy
    Contributor

    Proposal

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

    Only the second field (“a”) is shown in the report field list. The first field (“A”) disappears after adding the second field with the same name in lowercase.

    What is the root cause of that problem?

    The generateFieldID function converts field names to uppercase when generating field ID --> caused fields named "A" and "a" to both generate the same field ID: field_id_A. Since report fields are stored in the fieldList object using the field ID as the key, the second field would overwrite the first one.

    function generateFieldID(name: string) {
    return `field_id_${name.replace(CONST.REGEX.ANY_SPACE, '_').toUpperCase()}`;
    }

    Then the validation logic here checks for exact name matches (case-sensitive), which doesn't catch the issue

    if (!isRequiredFulfilled(name)) {
    errors[INPUT_IDS.NAME] = translate('workspace.reportFields.reportFieldNameRequiredError');
    } else if (Object.values(policy?.fieldList ?? {}).some((reportField) => reportField.name === name)) {
    errors[INPUT_IDS.NAME] = translate('workspace.reportFields.existingReportFieldNameError');
    } else if ([...name].length > CONST.WORKSPACE_REPORT_FIELD_POLICY_MAX_LENGTH) {
    // Uses the spread syntax to count the number of Unicode code points instead of the number of UTF-16 code units.
    addErrorMessage(
    errors,
    INPUT_IDS.NAME,
    translate('common.error.characterLimitExceedCounter', {length: [...name].length, limit: CONST.WORKSPACE_REPORT_FIELD_POLICY_MAX_LENGTH}),
    );
    }

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

    We should check for case-insensitive duplicates by comparing the generated field IDs instead of just the field names

                } else {
                    // Check for case-insensitive duplicates by comparing generated field IDs
                    const newFieldID = generateFieldID(name);
                    const existingField = Object.values(policy?.fieldList ?? {}).find((reportField) => reportField.fieldID === newFieldID);
                    if (existingField) {
                        errors[INPUT_IDS.NAME] = translate('workspace.reportFields.existingReportFieldNameError');
                    }
                }
    
                if ([...name].length > CONST.WORKSPACE_REPORT_FIELD_POLICY_MAX_LENGTH) {

    } else if (Object.values(policy?.fieldList ?? {}).some((reportField) => reportField.name === name)) {
    errors[INPUT_IDS.NAME] = translate('workspace.reportFields.existingReportFieldNameError');
    } else if ([...name].length > CONST.WORKSPACE_REPORT_FIELD_POLICY_MAX_LENGTH) {

    What alternative solutions did you explore? (Optional)

    We can generate a unique field ID by appending a counter if the base ID already exists

        let fieldID = WorkspaceReportFieldUtils.generateFieldID(name);
        let counter = 2;
        const existingFieldIDs = Object.values(previousFieldList).map((field) => field.fieldID);
    
        while (existingFieldIDs.includes(fieldID)) {
            fieldID = WorkspaceReportFieldUtils.generateFieldID(`${name}_${counter}`);
            counter++;
        }

    const fieldID = WorkspaceReportFieldUtils.generateFieldID(name);

    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.

  6. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Nov 10, 2025
  7. changed the title [-]Reports - Only one field shown when adding “A” and “a” report fields[/-] [+][$250] Reports - Only one field shown when adding “A” and “a” report fields[/+] on Nov 10, 2025
  8. melvin-bot commented on Nov 10, 2025

    @melvin-bot
  9. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Nov 10, 2025
  10. melvin-bot commented on Nov 10, 2025

    @melvin-bot

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

  11. eVoloshchak commented on Nov 12, 2025

    @eVoloshchak
    Contributor

    @nyomanjyotisa's proposal looks good to me!
    I don't think we need to generate a random ID or append an index, as that will make the existence of multiple identical report fields possible. So @nyomanjyotisa's proposal is simple and effective

    🎀👀🎀 C+ reviewed!

  12. 29 remaining items

  13. heyjennahay commented on Jan 7, 2026

    @heyjennahay
    Contributor

    @eVoloshchak can you please complete the BZ checklist when you have a moment so I can process everyones' payments?

  14. eVoloshchak commented on Jan 8, 2026

    @eVoloshchak
    Contributor

    BugZero Checklist:

    • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to comment: N/A, this is a change to the expected behavior

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion: regression wasn't critical

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    Regression Test Proposal Template

    Regression Test Proposal

    Precondition:

    Test:

    1. Go to workspace settings
    2. Tap reports
    3. Enable Report fields
    4. Tap add field
    5. Enter name as "A" in caps
    6. Select any type
    7. Tap save
    8. Tap add field
    9. Enter name as "a" in lowercase
    10. Select any type
    11. Click "Save" button
    12. Verify that the user can't create fields with names that differ only by case

    Do we agree 👍 or 👎

  15. heyjennahay commented on Jan 13, 2026

    @heyjennahay
    Contributor

    Payment summary

    • @eVoloshchak please request $250 payment through NewDot Manual Requests
    • @nyomanjyotisa paid $250 via Upwork. Confirming the contract and job are both closed

    Thanks everyone!

  16. mallenexpensify commented on Jan 16, 2026

    @mallenexpensify
    Contributor

    @marcaaron lil help plz. #78438 came from this issue. I was asking @eVoloshchak about and he said

    I'd say this is a follow-up. We added a check and an error for it in the original PR, which surfaced this: "Error is cleared when you change the field type".
    I did observe this behavior when reviewing the original PR, but considered it to be expected (the error is dismissed when you change something, the check is re-run when you press save, error appears). But the expected behavior turned out to be different, hence this follow-up

    Can you confirm via a comment, tag me, then close this issue? Thx

  17. marcaaron commented on Jan 17, 2026

    @marcaaron
    Contributor
  18. trjExpensify commented on Jan 31, 2026

    @trjExpensify
    Contributor

    approved $250 for @eVoloshchak.

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