Hi, I created a new custom attribute for the customer entity with the following code inside a InstallData.php in one of my custom modules:
$customerSetup->addAttribute(Customer::ENTITY, self::DOCUMENT_NUMBER, [
'type' => 'varchar',
'label' => 'Document Number',
'input' => 'text',
'required' => true,
'visible' => true,
'user_defined' => true,
'searchable' => true,
'visible_on_front' => true,
'unique' => true,
'sort_order' => 31,
'position' => 31,
'system' => 0,
]);
The attribute is being shown in the customer admin form, and I can save data to it. But if try to edit any on an already created cutomer it says the document number for that particular customer must be unique. Is there an additional parameter to addAttribute where I can say the attribute is unique but avoid the check when editing and the document number is unchanged?
Thanks.