resultPageFactory = $resultPageFactory; $this->locationsSyncService = $locationsSyncService; parent::__construct($context, $coreRegistry); } public function execute() { $result = $this->locationsSyncService->sync(); if ($result['error']) { $this->messageManager->addErrorMessage(__('Error while fetching data from NetSuite. ' . $result['message'])); } else { $this->messageManager->addSuccessMessage(__('Data fetched successfully. ' . $result['message'])); } $this->_redirect('jr_netsuite/location/index'); } /** * @return bool */ protected function _isAllowed() { return $this->_authorization->isAllowed(static::MENU_ID); } }