How to create a record in entity_team table using workflow?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • prady
    Junior Member
    • Apr 2024
    • 1

    How to create a record in entity_team table using workflow?

    Hi Team,

    I am fairly new to EspoCRM. I am trying to implement the following to restrict access to users.

    When I create an account, I want to create a Team with the same name (which i am able to do). But once the team is created, I want to link the Account and Team. This is where I am having trouble. Below is the formula script I've written under "Update Target Record".

    PHP Code:
    $team = record\findOne('Team', 'createdAt', 'desc', 'name=', name);
    $id = '';
    if ($team) {
        $teamId = object\get($team, 'id');
        record\create('EntityTeam', 'entityId', id, 'teamId', $teamId, 'entityType', 'Account')
    }​​ 
    

    Last edited by prady; 04-05-2024, 04:06 AM. Reason: Pasted incorrect code earlier.
  • lazovic
    Super Moderator
    • Jan 2022
    • 809

    #2
    Hi prady,

    Please tell me how do you want to link Account and the Team? No relationships can be established between these entities by default. Creating new relationships between them is also quite difficult; you need to modify the base EspoCRM code.

    Comment

    Working...