How can I get an entity as available field in a list ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • antoine
    Junior Member
    • Sep 2016
    • 3

    How can I get an entity as available field in a list ?

    Hi ! I have some difficulties to find an way to solve my issue, I hope someone will be able to guide me trough it
    1. I created an entity
    2. In Entity Manager section, I created a link with another entity. "Many-to-many" and both "Link multiple field" checked
    3. In Layout Manager, when I go the detail section of the entity I created, the other entity is present as an available field, and I can place it into the panel
    My issue is that I need the other entity to be also present in the list section of the created entity. Can anyone tell how this can be done ?

    Many thanks for your help

    Antoine

  • yuri
    Member
    • Mar 2014
    • 8485

    #2
    Hi Antoine,

    You will need to load your field in Service class in loadAdditionalFields method.
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • antoine
      Junior Member
      • Sep 2016
      • 3

      #3
      Hi Yuri,

      I didn't find a single lead on the whole internet, including Espo forum, that could help me understand what you said, so i could know which file to edit, and then what lines to add. Too bad there is no resources for absolute dummies. Nevermind, this issue was not that big. Thanks for your reply

      Comment

      • yuri
        Member
        • Mar 2014
        • 8485

        #4
        If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

        Comment

        • antoine
          Junior Member
          • Sep 2016
          • 3

          #5
          Hi Yuri, thanks for your help, I feel like an expert now for all the dummies, here is the how-to

          I added the following code in this file /www/crm/custom/Espo/Custom/Resources/layouts/XXX/list.json and the button YYY appears in Enabled column in list section of Layout manager for XXX entity

          Code:
              {
                  "name": "YYY"
              },
          I stated this in /www/crm/custom/Espo/Custom/Services/XXX.php

          Code:
          <?php
          
          namespace Espo\Custom\Services;
          
          class Quote extends \Espo\Core\Templates\Services\Base
          {
          
              public function loadAdditionalFieldsForList(Entity $entity)
              {
                  parent::loadAdditionalFieldsForList($entity);
                  $entity->loadLinkMultipleField('YYY');
              }  
          }
          Several entities to link ?

          Code:
          <?php
          
          namespace Espo\Custom\Services;
          
          class Quote extends \Espo\Core\Templates\Services\Base
          {
          
              public function loadAdditionalFieldsForList(Entity $entity)
              {
                  parent::loadAdditionalFieldsForList($entity);
                  $entity->loadLinkMultipleField('YYY');
                  $entity->loadLinkMultipleField('WWW');
                  $entity->loadLinkMultipleField('ZZZ');
              }  
          }
          Last edited by antoine; 09-08-2016, 02:45 PM.

          Comment

          Working...