1

I have added a custom customer attribute on_account. It is displayed as expected in the admin forms: to create a new customer or to edit an existing one, also when creating an Order with a new customer.

However, when I try to save any customer it gives me the error: "On Account" is a required value.

This is how my tables look like:

eav_attribute

attribute_id => 248,
entity_type_id => 1,
attribute_code => on_account,
attribute_model => null,
backend_model => null,
backend_type => int,
backend_table => null,
frontend_model => null,
frontend_input => boolean,
frontend_label => On Account,
frontend_class => null,
source_model => Magento\Eav\Model\Entity\Attribute\Source\Boolean,
is_required => 1,
is_user_defined => 1,
default_value => 0,
is_unique => 0,
note => null

customer_eav_attribute

attribute_id => 248,
is_visible => 1,
input_filter => null,
multiline_count => 0,
validate_rules => null,
is_system => 0,
sort_order => 120,
data_model => null,
is_used_in_grid => 0,
is_visible_in_grid => 0,
is_filterable_in_grid => 0,
is_searchable_in_grid => 0,
is_used_for_customer_segment => 0

customer_eav_attribute_website

attribute_id => 248,
website_id => 10,
is_visible => null,
is_required => null,
default_value => null,
multiline_count => null

customer_form_attribute

form_code => adminhtml_checkout,
attribute_id => 248

form_code => adminhtml_customer,
attribute_id => 248

Any ideas? Thanks in advanced

1
  • Hello, did you find what was missing? I am facing a similar problem.
    – jaxkodex
    May 10 at 4:18
1
  1. There is no meaning to add required for the boolean typ. bcz if it is required then it's value always becomes 1. so is_required should be 0.

  2. Use the backend model: Magento\Customer\Model\Attribute\Backend\Data\Boolean

  3. Use the backend Type: static, or try with varchar.

maybe this will help you to make your attribute workable.

1
  • Makes sense, especially point 1. But still doesn't save the value Jul 2 '20 at 22:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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