Magento 2 - Custom Customer attribute in order create select customer grid












0















I am trying to add a custom column in sales create order customer grid.
When admin trying to place order from back end ,after create order button click we get a customer grid .



enter image description here



I have added a new column Company Name to this grid using below code in




sales_order_create_customer_block.xml




<block class="MagentoBackendBlockWidgetGridColumn" name="adminhtml.customer.grid.columnSet.company_name" as="company_name">
<arguments>
<argument name="header" xsi:type="string" translate="true">Company Name</argument>
<argument name="index" xsi:type="string">company_name</argument>
<argument name="align" xsi:type="string">center</argument>
</arguments>
</block>


Here Company Name is a custom customer attribute I have created .



After adding this I am getting the company name in this grid.
But the company name does not show at first load.
In the above screenshot for customer Id 66, I have set the company name still its displayed none.When I filter it by clicking on company name header it filters and then the company name is displayed for each customer and properly.



enter image description here



And when I reload the page it again displays nothing and I have to filter it again to display it .
I tried giving a different customer field gender in the xml and I am getting Boolean values as expected and no need of filter needed to display it like in case of my custom customer attribute.
Is there any that I have missed out in configuring this ?










share|improve this question





























    0















    I am trying to add a custom column in sales create order customer grid.
    When admin trying to place order from back end ,after create order button click we get a customer grid .



    enter image description here



    I have added a new column Company Name to this grid using below code in




    sales_order_create_customer_block.xml




    <block class="MagentoBackendBlockWidgetGridColumn" name="adminhtml.customer.grid.columnSet.company_name" as="company_name">
    <arguments>
    <argument name="header" xsi:type="string" translate="true">Company Name</argument>
    <argument name="index" xsi:type="string">company_name</argument>
    <argument name="align" xsi:type="string">center</argument>
    </arguments>
    </block>


    Here Company Name is a custom customer attribute I have created .



    After adding this I am getting the company name in this grid.
    But the company name does not show at first load.
    In the above screenshot for customer Id 66, I have set the company name still its displayed none.When I filter it by clicking on company name header it filters and then the company name is displayed for each customer and properly.



    enter image description here



    And when I reload the page it again displays nothing and I have to filter it again to display it .
    I tried giving a different customer field gender in the xml and I am getting Boolean values as expected and no need of filter needed to display it like in case of my custom customer attribute.
    Is there any that I have missed out in configuring this ?










    share|improve this question



























      0












      0








      0








      I am trying to add a custom column in sales create order customer grid.
      When admin trying to place order from back end ,after create order button click we get a customer grid .



      enter image description here



      I have added a new column Company Name to this grid using below code in




      sales_order_create_customer_block.xml




      <block class="MagentoBackendBlockWidgetGridColumn" name="adminhtml.customer.grid.columnSet.company_name" as="company_name">
      <arguments>
      <argument name="header" xsi:type="string" translate="true">Company Name</argument>
      <argument name="index" xsi:type="string">company_name</argument>
      <argument name="align" xsi:type="string">center</argument>
      </arguments>
      </block>


      Here Company Name is a custom customer attribute I have created .



      After adding this I am getting the company name in this grid.
      But the company name does not show at first load.
      In the above screenshot for customer Id 66, I have set the company name still its displayed none.When I filter it by clicking on company name header it filters and then the company name is displayed for each customer and properly.



      enter image description here



      And when I reload the page it again displays nothing and I have to filter it again to display it .
      I tried giving a different customer field gender in the xml and I am getting Boolean values as expected and no need of filter needed to display it like in case of my custom customer attribute.
      Is there any that I have missed out in configuring this ?










      share|improve this question
















      I am trying to add a custom column in sales create order customer grid.
      When admin trying to place order from back end ,after create order button click we get a customer grid .



      enter image description here



      I have added a new column Company Name to this grid using below code in




      sales_order_create_customer_block.xml




      <block class="MagentoBackendBlockWidgetGridColumn" name="adminhtml.customer.grid.columnSet.company_name" as="company_name">
      <arguments>
      <argument name="header" xsi:type="string" translate="true">Company Name</argument>
      <argument name="index" xsi:type="string">company_name</argument>
      <argument name="align" xsi:type="string">center</argument>
      </arguments>
      </block>


      Here Company Name is a custom customer attribute I have created .



      After adding this I am getting the company name in this grid.
      But the company name does not show at first load.
      In the above screenshot for customer Id 66, I have set the company name still its displayed none.When I filter it by clicking on company name header it filters and then the company name is displayed for each customer and properly.



      enter image description here



      And when I reload the page it again displays nothing and I have to filter it again to display it .
      I tried giving a different customer field gender in the xml and I am getting Boolean values as expected and no need of filter needed to display it like in case of my custom customer attribute.
      Is there any that I have missed out in configuring this ?







      magento2 layout attributes grid customer-grid






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 13 '18 at 7:08







      Melvin

















      asked Nov 2 '18 at 19:52









      MelvinMelvin

      72213




      72213






















          1 Answer
          1






          active

          oldest

          votes


















          0














          Im facing the same issue. Did you get any solution for this?



          I tried one approach, that is I made default_sort as company_name and it worked but if we sort with any different column, this wont work.



          <arguments>
          <argument name="default_sort" xsi:type="string">company_name</argument>
          </arguments>


          FYI, even the values aren't displayed but if we search for the company name then the results are fetching properly.



          Thanks






          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "479"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f248927%2fmagento-2-custom-customer-attribute-in-order-create-select-customer-grid%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Im facing the same issue. Did you get any solution for this?



            I tried one approach, that is I made default_sort as company_name and it worked but if we sort with any different column, this wont work.



            <arguments>
            <argument name="default_sort" xsi:type="string">company_name</argument>
            </arguments>


            FYI, even the values aren't displayed but if we search for the company name then the results are fetching properly.



            Thanks






            share|improve this answer




























              0














              Im facing the same issue. Did you get any solution for this?



              I tried one approach, that is I made default_sort as company_name and it worked but if we sort with any different column, this wont work.



              <arguments>
              <argument name="default_sort" xsi:type="string">company_name</argument>
              </arguments>


              FYI, even the values aren't displayed but if we search for the company name then the results are fetching properly.



              Thanks






              share|improve this answer


























                0












                0








                0







                Im facing the same issue. Did you get any solution for this?



                I tried one approach, that is I made default_sort as company_name and it worked but if we sort with any different column, this wont work.



                <arguments>
                <argument name="default_sort" xsi:type="string">company_name</argument>
                </arguments>


                FYI, even the values aren't displayed but if we search for the company name then the results are fetching properly.



                Thanks






                share|improve this answer













                Im facing the same issue. Did you get any solution for this?



                I tried one approach, that is I made default_sort as company_name and it worked but if we sort with any different column, this wont work.



                <arguments>
                <argument name="default_sort" xsi:type="string">company_name</argument>
                </arguments>


                FYI, even the values aren't displayed but if we search for the company name then the results are fetching properly.



                Thanks







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 41 mins ago









                Harshith SHarshith S

                166




                166






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Magento Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f248927%2fmagento-2-custom-customer-attribute-in-order-create-select-customer-grid%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Magento 2 controller redirect on button click in phtml file

                    Polycentropodidae