env\userAttribute Function for ManyToMany link

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • k.rakviashvili@gmail.com
    Junior Member
    • Apr 2020
    • 5

    env\userAttribute Function for ManyToMany link

    Hi All.
    I tried to use env\userAttribute() function to filter some data in report with MultiEnum type attribute and it works good. It's great solution.
    But now i am trying to make the same with many to many related to user entity. Is there any solution to get the same as userAttribute for related entity?
  • Maximus
    Senior Member
    • Nov 2018
    • 2731

    #2
    Hi,
    No, it is not supported for the link-multiple relation.

    Comment

    • yuri
      Member
      • Mar 2014
      • 8440

      #3
      You can utilize multiple functions:

      Code:
      $userId = env\userAttribute('id');
      
      // find first related record
      $id = record\findRelatedOne('User', $id, 'yourLink', 'userName', 'asc', 'someField=', 'someValue');
      
      ifThen( // check if $id is not empty
          $id,
          $value = record\attribute('YourEntityType', $id, 'yourAttribute')
      )
      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

      • GrandQuail
        Junior Member
        • May 2020
        • 2

        #4
        Originally posted by yurikuzn
        You can prepaidcardstatus utilize multiple functions:

        Code:
        $userId = env\userAttribute('id');
        
        // find first related record
        $id = record\findRelatedOne('User', $id, 'yourLink', 'userName', 'asc', 'someField=', 'someValue');
        
        ifThen( // check if $id is not empty
        $id,
        $value = record\attribute('YourEntityType', $id, 'yourAttribute')
        )
        It was a great help ! Thank you very much for sharing this !

        Comment

        Working...