When removing custom fields in ill request, they get removed in the UI but remain saved in the database. 1) Enable ILLModule 2) Create an ILL request: <staff_url>/cgi-bin/koha/ill/ill-requests.pl?method=create&backend=Standard 3) Pick any type, add '42' for cardnumber and any library 4) Edit item metadata (assuming ID 1): <staff_url>/cgi-bin/koha/ill/ill-requests.pl?op=edititem&illrequest_id=1 5) Click 'Add new field' under 'Custom fields' 6) Add any key value pair but avoid 0 for the value to not run into #41281 7) Click 'Update'. Notice the custom field does show. 8) Edit the item again and remove the created key/value pair. 9) Update the request and you will find the key/value pair still remaining
The code where this should be handled seems to be not implemented at all https://gitlab.com/koha-community/Koha/-/blob/main/Koha/ILL/Backend/Standard.pm?ref_type=heads#L412 There are checks for add_new_custom and custom_delete form values which are never set in the UI.