Auto assign team from linked entity

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • deserttechpros
    Junior Member
    • Sep 2019
    • 4

    Auto assign team from linked entity

    I have several custom entities (authorizations, claim status, certifications) that all correlate to one entity (clients). The clients will be assigned to 3-4 different teams (primary location, and some external groups that will each be given their own team to limit access). What I need to create through a workflow or formula, is a way to auto assign the teams linked to the client, to the other entities.

    I've tried using the various versions of "addLinkMultipleId" that I have found on the forums but can't seem to get the phrasing right.

    Can someone help me out with this?
    Thanks!
  • yuri
    Member
    • Mar 2014
    • 8495

    #2
    Presume your entity has a link named 'client'

    Then in formula for your entity:

    entity\addLinkMultipleId('teams', client.teamsIds);


    But fields you need to check whether client exists:

    Code:
    ifThen(
      client.teamsIds,
      entity\addLinkMultipleId('teams', client.teamsIds)
    );
    Last edited by yuri; 09-13-2019, 06:19 AM.
    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

    • deserttechpros
      Junior Member
      • Sep 2019
      • 4

      #3
      Still not getting it to pull the teams from the client entity. Here are some screenshots of my environment. Am I starting the formula from the wrong area?

      Thanks for any help you guys can give.

      Comment

      • yuri
        Member
        • Mar 2014
        • 8495

        #4
        I supposed you have one-to-many relationship. With many-to-many this formula won't work out. Could you explain more detail. Do you need to copy all teams from all Clients to one Authorization?
        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

        • deserttechpros
          Junior Member
          • Sep 2019
          • 4

          #5
          An authorization will only ever be linked to one client. A client will be linked to at least one team, but possibly more. I need the authorizations to auto-pull the teams that their client has been assigned to.

          Comment

          • deserttechpros
            Junior Member
            • Sep 2019
            • 4

            #6
            Nvm, setting it as a many to one worked. Thanks!

            Comment

            Working...