Announcement

Collapse
No announcement yet.

How to get referer entity id using primaryfilter

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

  • How to get referer entity id using primaryfilter

    I need to filter select list to select records in bottom panel, using a field from related entity, using this code:

    PHP Code:
    <?php

    namespace Espo\Custom\Classes\Select\Product\PrimaryFilters;

    use 
    Espo\Core\Select\Primary\Filter;
    use 
    Espo\ORM\Query\SelectBuilder;
    use 
    Espo\ORM\EntityManager;

    class 
    MyFilter implements Filter
    {

        public function 
    apply(SelectBuilder $queryBuilder): void
        
    {
            
            
    $relatedEntityId "HOW_TO_GET_IT"// Get from referer entity

            
    $entityID =  $this->entityManager
                            
    ->getRDBRepository('AnotherEntity')
                            ->
    where([
                                
    'relatedEntityId' => $relatedEntityId,
                            ])
                            ->
    find();

            $queryBuilder
    ->where([
                
    'relatedEntityFieldId=' => $entityId
            
    ]);

        }

    }
    Cananyone help me?

  • #2
    It's not possible by design. https://forum.espocrm.com/forum/deve...primary-filter

    Comment

    Working...
    X