Zend certified PHP/Magento developer

Update product main entry data inside catalog_product_save_after event

I’m trying to update 2 custom field I have created by the db_schema.xml file into my catalog_product_entity thats part working as its shut be and everything are working smooth.

Now I’m trying to call a event on catalog_product_save_after and trying to update a my to new fields.

The problem is I can’t find a way around for it, I hope some one can help me here.

My code is this, I’m trying with my very simple code here and need the last part of it, but can’t find a way for it.

<?php

namespace SmartPackWMSEvent;

use MagentoFrameworkEventObserverInterface;

class ProductChanged implements ObserverInterface
{
    public function __construct()
    {
        // Observer initialization code...
        // You can use dependency injection to get any class this observer may need.
    }

    public function execute(MagentoFrameworkEventObserver $observer)
    {
        $product = $observer->getProduct();
        $sku = $product->getSku();
        $name = $product->getName();
        $id = $product->getId();

        echo 'productId: ' . $id;

        exit;
    }
}