getRequest()->getParam('id'); if ($notificationId) { try { $this->_objectManager->create( \Magento\AdminNotification\Model\NotificationService::class )->markAsRead( $notificationId ); $this->messageManager->addSuccessMessage(__('The message has been marked as Read.')); } catch (\Magento\Framework\Exception\LocalizedException $e) { $this->messageManager->addErrorMessage($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addExceptionMessage( $e, __("We couldn't mark the notification as Read because of an error.") ); } $this->getResponse()->setRedirect($this->_redirect->getRedirectUrl($this->getUrl('*'))); return; } $this->_redirect('adminhtml/*/'); } }