Skip to content

in magento 2.4.5 data not saved of custom attribute added by db_schema.xml

Could someone assist me in resolving this issue? I’ve created a custom attribute for customers, but when I attempt to save data from the admin panel for any customer, it doesn’t get saved.
Here is the details

--db_schema.xml
        <?xml version="1.0"?>
    <schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
        <table name="customer_entity">
            <column xsi:type="varchar" name="dataprivacy_attribute" nullable="true" length="255" comment="Data Privacy Status"/>
        </table>
    </schema>

view/adminhtml/ui_component/customer_form.xml

    <?xml version="1.0"?>
    <form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
        <fieldset name="account_information" sortOrder="50">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="label" xsi:type="string" translate="true">Custom Fields</item>
                </item>
            </argument>
            <field name="dataprivacy_attribute">
                <argument name="data" xsi:type="array">
                    <item name="config" xsi:type="array">
                        <item name="sortOrder" xsi:type="number">10</item>
                        <item name="dataType" xsi:type="string">text</item>
                        <item name="dataScope" xsi:type="string">dataprivacy_attribute</item>
                        <item name="formElement" xsi:type="string">input</item>
                        <item name="label" xsi:type="string" translate="true">Custom Attribute</item>
                    </item>
                </argument>
            </field>
        </fieldset>
    </form>