I have tried the below code with static datatype but it has consequences as mentioned below:
$customerSetup->addAttribute(Customer::ENTITY, self::APPROVE_ACCOUNT,
[
'type' => 'static',
'label' => 'Approve Account',
'input' => 'select',
"source" => "RBC\Customersegment\Model\Config\Source\CustomerYesNoOptions",
'required' => false,
'default' => '1',
'visible' => true,
'user_defined' => true,
'sort_order' => 215,
'position' => 215,
'system' => false,
]);
Using static datatype in attribute will solve the problem in grid export but will throw error while reindexing as the the attribute type is static, it will look into customer_entity table for this field which you might not have created. So in your case, you can follow the suggestions as mentioned below.
It seems that you have not created field in customer_entity table, you are using attribute here, so make sure you have not added field in customer_listing layout in ui_component directory. Also you don't have to add the field in indexer.xml as for attributes, it automatically updates data in customer_grid_flat table.
I hope this helps you with your problem.
please override Download.php file from the vendor.
1. Magento\ImportExport\Controller\Adminhtml\Export\File\Download.php
add changes to in.
public function execute()
{
if (empty($fileName = $this->getRequest()->getParam('filename'))) {
throw new LocalizedException(__('Please provide export file
name'));
}
try {
$path = 'export/' . $fileName;
$directory =
$this->filesystem->getDirectoryRead(DirectoryList::VAR_DIR);
if ($directory->isFile($path)) {
return $this->fileFactory->create(
*$fileName,*
$directory->readFile($path),
DirectoryList::VAR_DIR,
'application/octet-stream'
);
}
} catch (LocalizedException | \Exception $exception) {
throw new LocalizedException(__('There are no export file with
such name %1', $fileName));
}
}
Hopefully, it works for you.
Best Answer
I have face same issue and resolved using below solution and every thing working fine
please change some code in below file small "m" to capital "M".