I have created an ph:Number customer attribute for the customer registration form . But now i am facing an issue in which that attribute in not showing in the back-end customer grid
the phone number attribute in the above picture is what i created and the code is mentioned below
Method in my Install Schema
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
$customField = "custom_field";
$customFieldLabel = "Phone Number";
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
$eavSetup->removeAttribute(Customer::ENTITY, $customField);
$attributeSetId = $eavSetup->getDefaultAttributeSetId(Customer::ENTITY);
$attributeGroupId = $eavSetup->getDefaultAttributeGroupId(Customer::ENTITY);
$eavSetup->addAttribute(Customer::ENTITY, $customField, [
// Attribute parameters
'type' => 'varchar',
'label' => $customFieldLabel,
'input' => 'text',
'required' => true,
'visible' => true,
'user_defined' => true,
'sort_order' => 990,
'position' => 990,
'system' => 0,
]);
$attribute = $this->eavConfig->getAttribute(Customer::ENTITY, $customField);
$attribute->setData('attribute_set_id', $attributeSetId);
$attribute->setData('attribute_group_id', $attributeGroupId);
$attribute->setData('used_in_forms', [
'adminhtml_customer',
'customer_account_create',
'customer_account_edit'
]);
$this->attributeResource->save($attribute);
}
This customer attribute is missing in the below grid