I am working on extension and need to set customer custom attribute value. I tried the following code, but it's not working , can you please help me with this.
$customer = $this->customerFactory->create(); $customer->setId($observer->getEvent()->getCustomer()->getId()); $customerData = $customer->getDataModel(); $customerData->setCustomAttribute('mobilenumber','123465798'); $customer->updateData($customerData); $customer->save();