I installed my custom plugin in Magento 2.4, but after that I'm not able to see the order list in the grid. Here below a screenshot: admin order list

My plugin adds three columns in sales_order_grid, here below I'll report the code for the first one as a sample


<?xml version="1.0" encoding="UTF-8"?>
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <listingToolbar name="listing_top"/>  <!-- https://github.com/magento/magento2/issues/5408 -->
    <columns name="sales_order_columns">
        <column name="create_invoice" class="Vendor\App\Ui\Component\Listing\Column\ColumnCreateInvoice">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="label" xsi:type="string" translate="true">Crea fattura</item>
                    <item name="sortOrder" xsi:type="number">600</item>
                    <item name="component" xsi:type="string">Vendor_App/js/grid/columns/create_invoice</item>
                    <item name="sortable" xsi:type="boolean">false</item>
                    <item name="visible" xsi:type="boolean">true</item>
            [... the other two columns]


], function (Column, $, mageTemplate, sendmailPreviewTemplate, ko) {
    'use strict';
    return Column.extend({
        defaults: {
            bodyTmpl: 'ui/grid/cells/html',
            fieldClass: {
                'data-grid-html-cell': true
        getUrl: function (row) {
            return row[this.index+'_Url'];
        getOrderId: function (row) {
            return row[this.index + '_orderId'];
        getLabel: function (row) {
            return row[this.index + '_html']
        preview: function (row)
        getFieldHandler: function (row)
            return this.preview.bind(this, row);



namespace Vendor\App\Ui\Component\Listing\Column;
use Magento\Framework\UrlInterface;
use Magento\Framework\View\Element\UiComponent\ContextInterface;
use Magento\Framework\View\Element\UiComponentFactory;
use Magento\Ui\Component\Listing\Columns\Column;
use \Magento\Sales\Api\OrderRepositoryInterface;

class ColumnCreateInvoice extends Column
    protected $objectManager;
    protected $orderRepository;
    public function __construct
        ContextInterface $context,
        \Magento\Framework\ObjectManagerInterface $objectManager,
        UiComponentFactory $uiComponentFactory,
        OrderRepositoryInterface $orderRepository,
        \Vendor\App\Helper\Data $helper,
        array $components = [],
        array $data = []
        $this->objectManager = $objectManager;
        $this->orderRepository = $orderRepository;
        $this->helper = $helper;
        parent::__construct($context, $uiComponentFactory, $components, $data);
     * Prepare Data Source
     * @param array $dataSource
     * @return array
    public function prepareDataSource(array $dataSource)
        if (isset($dataSource['data']['items']))
            $fieldName = $this->getData('name');
            foreach ($dataSource['data']['items'] as & $item)
                $order  = $this->orderRepository->get($item["entity_id"]);
                $orderId = $order->getId();
                isset($order)? $incrementId = $order->getIncrementId() : $incrementId = $document->getIncrementId();
                // uso il nuovo metodo per recuperare il numero del documento nel gestionale Vendor (registrato nella tabella)
                $docNumber = $this->helper->getF24DocNumber($incrementId); 
                // Costruisco l'url associato al controller CreateInvoice
                $baseUrl = $this->objectManager
                $url = $baseUrl. "vendor/index/createinvoice/id/". $incrementId;

                    $item[$fieldName . '_html'] = "<center>Ordine cancellato</center>";
                    $invoicesIds = $this->helper->getInvoicesIds($incrementId);
                        $numberInvoices = 0;
                        $numberInvoices = count($invoicesIds);
                    if($order->canInvoice() || ($order->hasInvoices() > $numberInvoices))
                        $item[$fieldName . '_html'] = "<center><button class='button' title='Crea la fattura sul server di Vendor'><span>Crea fattura</span></button></center>";
                        //se lo trovo riporto il riferimento al numero della fattura in F24
                        $item[$fieldName . '_html'] = !empty($docNumber)? "<center><b>Ordine fatturato<br><br> Numero doc in Vendor: " . $docNumber . "</b>" : "<center><b>Ordine fatturato</b></center>";

                $item[$fieldName . '_orderId'] = $orderId;
                $item[$fieldName.'_Url'] = $url;
        return $dataSource;

I tried to replace the path in sales_order_grid.xml with Vendor/App/view/base/web/js/grid/columns/ but no change also after bin/magento setup:upgrade and bin/magento setup:di:compile

If I remove my plugin from the environment an then run setup:upgrade and setup:di:compile the admin order grid displays correctly. Any ideas?

2 Answers 2


I think the system throws \Magento\Framework\Exception\NoSuchEntityException in one of your custom logic

Try to add try {} catch(\Exception $e) {} into ColumnCreateInvoice:: prepareDataSource when you work with repository

  • I added try/catch as you suggested and that resolved! Now I'm able to see the grid. Thanks! Jun 7, 2022 at 8:55

It's because there are no any field named create_invoice in sales_order_grid table.

Change this line with any of field already exist in that table or create create_invoice field in sales_order_grid table.

<column name="create_invoice" class="Vendor\App\Ui\Component\Listing\Column\ColumnCreateInvoice">

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.