'undefined' metadata values causing validation errors

Description

Summary

Setting metadata values to 'undefined' in the set_custom_fields_md_json_trigger db trigger prevents the update of custom field definitions if there is a custom field definition present that does not contain user metadata.

Context

create_custom_fields_table.sql etablishes a db trigger that assigns 'undefined' to the metadata attributes createdByUserId, updatedByUserId, createdByUsername and updatedByUsername if no such values are present on a record update.

The value 'undefined' violates the schema definitions for createdByUserId and updatedByUserId. This leads to a validation error when trying to update such a custom field definition.

Setting unset values to 'undefined' is redundant and adds no additional benefit.

Steps to Reproduce

  1. Login to a folio snapshot environment

  2. Go to Settings -> Orders -> Custom Fields - Purchase Orders

  3. Edit and save the default custom field 'External order number' twice

Expected Result

No error. Updates succeed.

Actual Result

An error is encountered.

Suggested Solution

1. Modify the trigger to leave all four metadata values untouched/empty instead of assigning them 'undefined'.
2. Create a migration script that removes any 'undefined' values from custom fields metadata.

Additonal Actions

  • Add migration script to mod-users

CSP Request Details

None

CSP Rejection Details

None

Potential Workaround

None

Attachments

1

Checklist

hide

TestRail: Results

Activity

Show:
Done

Details

Assignee

Reporter

Priority

Sprint

Development Team

Leipzig

Fix versions

Release

Quesnelia (R1 2024)

RCA Group

TBD

TestRail: Cases

Open TestRail: Cases

TestRail: Runs

Open TestRail: Runs

Created January 11, 2024 at 3:43 PM
Updated January 25, 2024 at 11:41 AM
Resolved January 25, 2024 at 11:34 AM
TestRail: Cases
TestRail: Runs