Formula explanation and samples

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MitoTakatori
    Junior Member
    • Jul 2018
    • 25

    Formula explanation and samples

    Hi. I just want for these formulas to be expounded and given some samples. Thank you.
    entity\addLinkMultipleId

    entity\addLinkMultipleId(LINK, ID) Adds ID to Link Multiple field. For example, add 'someTeamId' to 'teams' field.

    entity\addLinkMultipleId(LINK, ID_LIST) Adds the list of ids. (since version 4.8.3) entity\hasLinkMultipleId

    entity\hasLinkMultipleId(LINK, ID) Checks whether Link Multiple field has specific ID. entity\removeLinkMultipleId

    entity\removeLinkMultipleId(LINK, ID) Removes a specific ID from the Link Multiple field. entity\isRelated

    entity\isRelated(LINK, ID) Checks whether target entity is related with another entity represented by LINK and ID.
  • tanya
    Senior Member
    • Jun 2014
    • 4308

    #2
    Hi

    entity\addLinkMultipleId('teams', 'id1');
    entity\addLinkMultipleId('teams', list('id1', 'id2'));
    entity\addLinkMultipleId('teams', account.teamsIds);

    ID means a string like '1231' or a field name of the record like accountId
    ID_LIST means array (to build array with string values you need to use list() function as in 2nd example) or a linkMultiple field like account.teamsIds
    LINK - is a string with the name of the needed link like 'teams' (you can find link names in Entity manager)

    Comment

    • MitoTakatori
      Junior Member
      • Jul 2018
      • 25

      #3
      Originally posted by tanya
      Hi

      entity\addLinkMultipleId('teams', 'id1');
      entity\addLinkMultipleId('teams', list('id1', 'id2'));
      entity\addLinkMultipleId('teams', account.teamsIds);

      ID means a string like '1231' or a field name of the record like accountId
      ID_LIST means array (to build array with string values you need to use list() function as in 2nd example) or a linkMultiple field like account.teamsIds
      LINK - is a string with the name of the needed link like 'teams' (you can find link names in Entity manager)
      Thank you very much tanya. This helped a lot!

      Comment

      • NonTau
        Junior Member
        • Aug 2018
        • 22

        #4
        Hello all,

        I've been trying to replicate the above without success. Our workflows run fine except for the addLinkMultipleId function.

        We have tried variations of this - associatedathleteScores=entity\addLinkMultipleId(' associatedjobsDistribution', 'associatedjobsDistribution.associatedathleteScore sNames');

        So in Entity Co-ordinator Report (1), we have a relationship with entity Jobs Distribution (2) & athlete scores (3).

        Entity (2) has a one-many relationship with (3) and the same with (1).

        When entity (1) is saved, we want the system to look at the associatedathleteScores between (3) and (2) and add them to (1). Nothing ever happens, does anyone know where our mistake is?

        I have added 3 images A, B & C to show what we are trying to achieve. Thanks in advance for your assistance.

        Kind regards

        Taurai
        Attached Files

        Comment


        • NonTau
          NonTau commented
          Editing a comment
          Ok so if we change the formula to - entity\addLinkMultipleId('associatedathleteScores' , 'associatedjobsDistribution.associatedathleteScore sIds');

          it pastes "associatedjobsDistribution.associatedathleteScore sIds" into the correct place so we are getting warmer. We just need it to return the records as opposed to the typed text.

        • NonTau
          NonTau commented
          Editing a comment
          Ok got it, the following worked in the end - entity\addLinkMultipleId('associatedathleteScores' , associatedjobsDistribution.associatedathleteScores Ids);

          The final bit needs to be a link without quotes.

          Just a suggestion to the Espo team - entity\addLinkMultipleId(FIELD, LINKID) - I feel that would make it clearer how the function works.

          Thanks again
      • kumaresan
        Junior Member
        • Aug 2018
        • 18

        #5
        Hi
        This is related to opportunity Entity.

        I have field named "type" with ENUM values "New" & "Renewal"
        I also have team named "Renewal"

        I need the Opportunity Team to get updated if the Type field is "Renewal" else leave the team as it is.

        I used the following;
        ifThen(type == "Renewal",entity\addLinkMultipleId("teams", "Renewal"));

        Expected Results : Team is updated with "Renewal" with existing
        Whats Happening is : Yes Team is added with "Renewal" but when i refresh the team goes back to normal as it was.

        Where I am wrong; can tanya help me.



        Comment

        Working...