Announcement

Collapse
No announcement yet.

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

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

  • 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


  • #2
    Hi Antoine,

    You will need to load your field in Service class in loadAdditionalFields method.

    Comment


    • #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


      • #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...
        X