I added an attribute to customer, but when I try to search values of customer code on the backend, nothing comes up. I can’t get my customer attributes to be included in search.
What can I do to get customer data entries to be searchable?
This in my upgradeData
$customerSetup->addAttribute(
Customer::ENTITY,
'customer_code',
(
'type' => 'varchar',
'label' => 'Customer Code',
'input' => 'text',
'required' => 1,
'visible' => 1,
'user_defined' => 1,
'sort_order' => 501,
'position' => 501,
'system' => 0,
'is_used_in_grid' => 1,
'is_visible_in_grid' => 1,
'is_html_allowed_on_front' => 1,
'visible_on_front' => 1,
"is_filterable_in_grid" => true,
"is_searchable_in_grid" => true
)
);
$attribute = $customerSetup->getEavConfig()->getAttribute(Customer::ENTITY, 'customer_code');
$attribute->setData('attribute_set_id', $attributeSetId);
$attribute->setData('attribute_group_id', $attributeGroupId);
$attribute->setData('used_in_forms', (
'adminhtml_customer',
'customer_account_create'
));
$attribute->save();