I've added the confirmed field with a


<?xml version="1.0" encoding="UTF-8"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <fieldset name="customer">
        <field name="confirmed">
            <argument name="data" xsi:type="array">
                <item name="options" xsi:type="object">Magento\Config\Model\Config\Source\Yesno</item>
                <item name="config" xsi:type="array">
                    <item name="source" xsi:type="string">customer</item>
                    <item name="label" translate="true" xsi:type="string">Confirmed</item>
                    <item name="sortOrder" xsi:type="string">210</item>
                    <item name="formElement" xsi:type="string">select</item>
                    <item name="dataType" xsi:type="string">select</item>

The field is shown, but not with correct values, always the default one. Now I need to change the customer retrieved data to get this field with Yes if the customer is already confirmed and No if not confirmed.

How can I process the data for the form?

EDIT: I have also created an observer (to set the correct value) using the

customer_load_after in adminhtml/events.xml

<event name="customer_load_after">
    <observer name="customerLoad" instance="<Vendor>\<Module>\Observer\Backend\CustomerLoadObserver" />

For testing, I tried changing the customer firstname. But it only worked for the admin page title (in the h1 class="page-title"), the customer form fields still have the values from database.

1 Answer 1


I've found that after v2.3 the admin edit customer info was not using the Magento\Framework\Model\AbstractModel, so it was not dispatching $this->_eventPrefix . '_load_after'.

Instead, it uses the Magento\Customer\Model\Customer\DataProviderWithDefaultAddresses. After this finding this was easy to extend it. In the di.xml

<preference for="Magento\Customer\Model\Customer\DataProviderWithDefaultAddresses" type="Vendor\Module\Model\DataProvider\CustomerDataProviderWithDefaultAddresses"/>

Then created the class Vendor\Module\Model\DataProvider\CustomerDataProviderWithDefaultAddresses with:

namespace Vendor\Module\Model\DataProvider;
class CustomerDataProviderWithDefaultAddresses extends \Magento\Customer\Model\Customer\DataProviderWithDefaultAddresses
    public function getData()
        $res = parent::getData();
        // code ...
        // $res is an array [entity_id] => [entity data]
        return $res;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.