Announcement

Collapse
No announcement yet.

Multiple teams assignment

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

  • Multiple teams assignment

    HI,
    When we create a lead, the default team will be already selected in the field.( Right side, under assigned user )

    i want to auto selected all teams this user has memebr in this field by default.

    presently we need to open team and need to select which all team are applicable.

  • #2
    In Administration > Entity Manager > Lead > Formula > Before Save Custom Script put:
    Code:
    if (entity\isNew()) {
        teamsIds = assignedUser.teamsIds
    }​
    or

    Code:
    if (entity\isNew()) {
        entity\addLinkMultipleId('teams', assignedUser.teamsIds)
    }​​
    Last edited by victor; 04-23-2024, 08:55 AM.

    Comment


    • binshadme
      binshadme commented
      Editing a comment
      this works for new leads. what about old leads.
      i mean, if i want to edit a old lead and assign to another person. then all the teams assigned to him needs to be updated for the lead. how its possible.

  • #3
    For your demands vicor's solution should do it. We assign teams primary to accounts. We want to assign some other account related data to the same teams. Often the relation is n:n.
    Here an example how to assign the teams assigned to accounts also assign to documents (works with customizations to other entities, too) additionally to the existing assigned teams. This is also a Before Save Custom Script:

    Code:
    // Assign Teams from Accounts to documents
    // Info: accounts1Ids is a (additional) relation from Accounts to documents
    
        // get existing teams assignments in documents
    $allTeamIds = teamsIds;
    $allTeamNames = teamsNames;
    
        // get existing account assignments in documents
    $k = 0;
    while($k < array\length(accounts1Ids)) {
        $teamIds = record\attribute('Account', array\at(accounts1Ids, $k), 'teamsIds');
        
        // relate teams to account (Sub-loop)
        $j = 0;
        while ($j < array\length($teamIds)) {
            $teamId = array\at($teamIds, $j);
            $allTeamIds = array\push($allTeamIds, $teamId);
            $teamName = record\attribute('Team', $teamId, 'name');
            object\set($allTeamNames, $teamId, $teamName);
            $j = $j + 1;
        }
        
        $k = $k + 1;
    }
    
        // write team Ids and team names into responsible array
    $allTeamIds = array\unique($allTeamIds);
    teamsIds = $allTeamIds;
    teamsNames = $allTeamNames;

    Comment


    • #4
      thank you

      Comment

      Working...
      X