How can i Know which user has added a particular product in magento2 and show that data in products grid page in magento Catalog > Products

  • I think it not possible using only core/default magento. Have you tried add new product attribute and set the current logged in admin user in it after product save ? Mar 8, 2022 at 6:37
  • yes of course, my colleague suggested me as you suggested. that works fine for me! Mar 8, 2022 at 7:28
  • Glad it works on you .. Mar 8, 2022 at 7:35
  • I have also posted solution below that might help others Mar 8, 2022 at 7:47

1 Answer 1


First of all create a custom attribute called : "updated_by" from magento backend and don't forget to drag that into default attribute set otherwise it will not work!!

Add events.xml file to vendor/module/etc/adminhtml/

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="catalog_product_save_after">
        <observer name="observer_name" instance="vendor\module\Observer\ProductSaveAfter" />

Add ProductSaveAfter.php at vendor/module/Observer/

namespace vendor\module\Observer;
use Magento\Framework\Event\ObserverInterface;
class ProductSaveAfter implements ObserverInterface
    public function execute(\Magento\Framework\Event\Observer $observer)
        $instance = \Magento\Framework\App\ObjectManager::getInstance();
        $productId = (int) $observer->getProduct()->getId();
        $user = $instance->get('Magento\Backend\Model\Auth\Session')->getUser()->getUsername();
        $action = $instance->create('Magento\Catalog\Model\Product\Action');
        $action->updateAttributes([$productId], array('updated_by' => $user), 0);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.