Announcement

Collapse
No announcement yet.

Upddate a Listview including a LinkMulti Field

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Upddate a Listview including a LinkMulti Field

    Hi,

    Still playing arround with with some customising ideas.

    I included a custom entity and connected it to Accounts Many-to-Many including the Multifield checkbox.
    Then I went into Espo\custom\Espo\Custom\Resources\layouts\Account\ list.json and included my custom field into the listview.
    so far everything is fine.

    Now when I open the List the linked entries are not shown.
    the strange thing is, that when I open an account it loads the linked entries and when I head back to the list they appear for that particular account.

    I guess there is kind of some Update or Load sequence in the account detailview for foreign entities.
    Not sure if this is something that should be included in the list in general or if this only applies to mine certain case.

    any help is appriciated anyways

    thanks

    Maho

  • #2
    Hi

    In Service class there is a method loadAdditionalFieldsForListView. You need to load linkMultiple fields there.

    Comment


    • #3
      Sorry I dont get it. can you be a little more specific?
      is this something I could copy paste from a different module?

      Comment


      • #4
        nevermind. I figured it out.
        is this possibly somthing that should be included i the Code in general ?
        I just added:

        PHP Code:
        public function loadAdditionalFields(Entity $entity)
            {
                
        parent::loadAdditionalFields($entity);
                
            }

            public function 
        loadAdditionalFieldsForList(Entity $entity)
            {
                
        parent::loadAdditionalFields($entity);
                
            } 
        into \application\Espo\Modules\Crm\Services\Accounts.ph p

        Comment


        • #5
          I also need to add the Link Multi into the export. So I added
          PHP Code:
          public function loadAdditionalFieldsForExport(Entity $entity)
              {
                   
          $entity->loadLinkMultipleField('brands');
              } 
          into Accounts but its not working.
          is it possible to export multilinked fields?

          Comment


          • #6
            Thanks for posting your solution as I'm having this exact problem and I couldn't figure it out. I also couldn't find this thread on my own because I didn't know which words to use in the search. The documentation and developers don't explain any of this. It's crazy how good the software could be if only the documentation would explain how to use it.

            Also, I would say yes to your question, this should be included by default or at least pointed out along the way with a tooltip or something. How the hell would anyone have known to write that code? /sigh

            Comment


            • #7
              By the way, to make this work, you have to add a custom element to this file:
              Code:
              custom/Espo/Custom/Resources/layouts/Contact/list.json
              By default, you can't add the entity 'accounts' to the list in the layout manager even though it is part of the definition; it simply doesn't show up in the list. If you make the aforementioned file and put the following code in it, you'll see an Accounts field in the list view with multiple entries. The php edits a few posts up also must be done in case that wasn't clear.

              Code:
              [
                  {
                      "name": "name",
                      "link": true
                  },
                  {
                      "name": "accounts",
                      "width": 25
                  },
                  {
                      "name": "emailAddress",
                      "width": 20,
                      "notSortable": true
                  },
                  {
                      "name": "phoneNumber",
                      "width": 18,
                      "notSortable": true
                  }
              ]

              Comment

              Working...
              X