[MODUSERS-306] POST and PUT of user object fail with error "Invalid Text format" if the object contains a non-required customFields of type text and the value is an empty string Created: 17/Mar/22  Updated: 13/Jun/22  Resolved: 18/Apr/22

Status: Closed
Project: mod-users
Components: None
Affects versions: None
Fix versions: 18.3.0

Type: Bug Priority: P3
Reporter: Lisa Sjögren Assignee: Javokhir Abdullaev
Resolution: Done Votes: 0
Labels: back-end, epam-spitfire, support
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original estimate: Not Specified

Attachments: File Users - FOLIO - Google Chrome 2022-04-15 15-10-11.mp4     PNG File custom.PNG     PNG File image-2022-03-17-11-28-43-715.png     PNG File image-2022-03-17-11-42-41-826.png     PNG File image-2022-04-15-15-02-40-306.png     PNG File image-2022-04-15-15-02-40-360.png     PNG File image-2022-04-15-15-02-40-406.png     PNG File resp.PNG    
Issue links:
Defines
defines UXPROD-3436 Spitfire - Morning Glory R2 2022 Enh... Closed
Relates
relates to MODUIMP-67 Unable to Update Custom Fields via Us... Closed
Sprint: Spitfire Sprint 137
Story Points: 2
Development Team: Spitfire
Release: Morning Glory (R2 2022)
RCA Group: Requirements change

 Description   

Overview:
POST and PUT of user objects with non-required customFields of type text fail if the value is an empty string. This is inconsistent with how empty strings are treated for other non-required fields on the user record.

This is a problem for libraries with customFields who regularly load users in batch from delimited files that they receive from their institutional student/staff database. The data is likely to contain empty strings for some users/properties.

If FOLIO's API's don't accept those empty strings, the library would need to remove the entire field from the user object before posting it. This, besides being inconsistent with how FOLIO handles other empty strings on the user record, requires scripting conditions and validation and so raises the the bar for batch importing users significantly.

(Given the user and user-import APIs accept empty strings for non-required fields a library pretty much only needs to map the source data fields to the FOLIO json properties in order to be able to iterative over a delimited file to import their users using something like Postman's Collection Runner.)

Steps to Reproduce:

  1. Log into Bugfest Kiwi https://bugfest-kiwi.folio.ebsco.com
  2. Create a non-required customField of type "text"
  3. POST or PUT a user object containing this customField with a value that is an empty string to /users
"customFields": {
                "atheletics_1": "opt_2",
                "quick-note_1": ""
            }

Expected Results:
The POST/PUT is successful. The custom field with the empty string is either not saved to the user at all and does not appear in the UI at all (I think this would be ideal), or it is saved as an empty string.

Actual Results:

The POST/PUT fails with the following error:


{
    "errors": [
        {
            "message": "Invalid Text format",
            "type": "1",
            "code": "-1",
            "parameters": [
                {
                    "key": "quick-note_1",
                    "value": "\"\""
                }
            ]
        }
    ]
}

If I perform the same import using user-import, I get a generic error message that does not explain at all why the import failed.

{
    "message": "Users were imported successfully.",
    "createdRecords": 0,
    "updatedRecords": 0,
    "failedRecords": 1,
    "failedUsers": [
        {
            "username": "10066ddah96",
            "externalSystemId": "100sah6696",
            "errorMessage": "Failed to update user with externalSystemId: 100sah6696"
        }
    ],
    "totalRecords": 1
}

Interested parties: NUST Library



 Comments   
Comment by Ann-Marie Breaux (Inactive) [ 21/Mar/22 ]

Hi Khalilah Gambrell No dev team or specific project assigned to this bug. Do you think it belongs to Users or Custom fields?

Comment by Pavlo Smahin [ 28/Mar/22 ]

Ann-Marie Breaux. it belongs to custom fields.
Khalilah Gambrell, should we fix it in the scope of Lotus or MG?

Comment by Khalilah Gambrell [ 28/Mar/22 ]

Pavlo Smahin - Morning Glory

Comment by Khalilah Gambrell [ 12/Apr/22 ]

Lisa Sjögren can you help with testing this issue? You would need to use snapshot for testing.

Comment by Javokhir Abdullaev [ 15/Apr/22 ]

hi! Lisa Sjögren, Khalilah Gambrell uploaded some screenshots and recorded video that shows no more errors are thrown when creating (updating) user with empty custom field of a type text.  

Comment by Javokhir Abdullaev [ 15/Apr/22 ]

in response, there is no empty custom field

Comment by Javokhir Abdullaev [ 15/Apr/22 ]

Users - FOLIO - Google Chrome 2022-04-15 15-10-11.mp4

Comment by Javokhir Abdullaev [ 15/Apr/22 ]

Generated at Thu Feb 08 22:22:24 UTC 2024 using Jira 1001.0.0-SNAPSHOT#100246-sha1:7a5c50119eb0633d306e14180817ddef5e80c75d.