In a Magento 2.4.5, I’ve (successfully) added a custom field (opening_mon) to the AdminHtml form for a Source (MSI), using view/adminhtml/ui_component/inventory_source_form.xml. I do see the field in the form.
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<fieldset name="opening_times" sortOrder="40">
<settings>
<label translate="true">Opening times</label>
<collapsible>true</collapsible>
<opened>false</opened>
<dataScope>general</dataScope>
</settings>
<field name="opening_mon" formElement="input" sortOrder="50">
<settings>
<dataScope>extension_attributes.opening_mon</dataScope>
<dataType>string</dataType>
<label translate="true">Opening times Monday</label>
</settings>
</field>
</fieldset>
</form>
I’ve also added a field in the database table inventory_source (using etc/db_schema.xml). I see the field in the database table.
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
<table name="inventory_source">
<column xsi:type="varchar" name="opening_mon" length="50" nullable="true" comment="opening times monday" />
</table>
</schema>
When I enter a value in the custom field and save the form, I get confirmation the form is saved (‘The Source has been saved.’) but I don’t see the value in the database table (inventory_source). My expectation is that I would see this value in the database table.
How to save value entered in custom field in the Source (MSI) form? I’ve tried many suggestions from internet.
Also I need to know how to show the value from the database field opening_mon in the form field.
A working example for M2.4 is highly appreciated or documentation I can use.
Thanks in advance.
Kind regards.