link entity by formula

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hi-ko
    Member
    • May 2015
    • 90

    link entity by formula

    I have an entity 'Revision' with a n:1 relationship with User as 'revisionApprover' and I try to set the approver by formular but can't get it to work. There is a entity\addLinkMultipleId but I need the same for a 1:n relation so I tried record\relate in both directions. I get always 'true' as response but the Revision is not being updated with that userId on the field defined in the relation.
    Code:
    output\printLine(record\relate('Revision', id, 'revisionApprover', $approverId));
    Setting the id directly is also not available.

    What is the supported way to set a n:1 or 1:n relation by formular?
  • lazovic
    Super Moderator
    • Jan 2022
    • 809

    #2
    Hi hi-ko,

    You can use the following formulas:

    For Revision:User as N:1 in Revision Formula:
    Code:
    revisionApproverId = 'user-id';
    For User:Revision as 1:N in User Formula:
    Code:
    revisionsIds = array\push(revisionsIds, 'revision-id');
    Please keep in mind that linking / unlinking records to each other is best tested immediately in the Formula of a particular entity.

    Comment

    • hi-ko
      Member
      • May 2015
      • 90

      #3
      Why make it simple when it can also be made more complicated?

      I read somewhere that setting the id directly is no longer supported and from the fields menu / autocomplete the id field is not offered.

      The obvious way, by just assigning the id (still) works ...

      Thanks lazovic

      Comment

      Working...