Announcement

Collapse
No announcement yet.

Access atribute of child entity

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

  • Access atribute of child entity

    Hi,
    i need to get atribute value from this record and it did not work:

    record\attribute('MontazZakazky', childId, 'montazniPartie')


    This one works but it seems quite messy.
    Don´t you know why the first one does not work?

    record\attribute('MontazZakazky', record\findOne('MontazZakazky', 'createdAt', 'desc', 'parentId=', id), 'montazniPartie')

    Thanks a lot



  • #2
    Hi tomas.klicka,

    In fact, there is no childId attribute in EspoCRM, it is not created by default after the Parent-to-Children relationship is established. Learn more about attributes here: https://docs.espocrm.com/administrat...ing/#attribute.

    You can simply bring your formula to the following form for convenience and better understanding:​
    Code:
    $childId = record\findOne('MontazZakazky', 'createdAt', 'desc', 'parentId=', id);
    $montazniPartie = record\attribute('MontazZakazky', $childId, 'montazniPartie');

    Comment


    • #3
      Thanks a lot Iazovic, i didn´t know.

      Comment

      Working...
      X