In my project a custom customer attribute was using and save the value in the table on customer registration. Attribute id was phone_number
I want to get this phone number value and send an sms using another module, Event is customer_register_success
In my sms module i am trying to get the attribute value by this
if($myCustomAttribute = $customer->getCustomAttribute('phone_number')) {
$mobileNumber = $myCustomAttribute->getValue();
$this->logger->critical("phone number Is".$mobileNumber);
}else{
$this->logger->critical("No phone number available");
}
Every time i try to register i am getting the message as this No phone number available. But the phone number value was saved in the customer_entity_varchar
table and after redirection i can see the phone number from customer dashboard too.
Which thing prevent me here to access this phone number on this event call? Can you please suggest me a better way to approach this. Kindly note this phone_number attribute is a Custom customer attribute and set value from another table.