Announcement

Collapse
No announcement yet.

Default Team, Default TeamS possible?

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

  • Default Team, Default TeamS possible?

    Hello,
    in the user card it is possible to select only one default team. Is there a way for one user to have e.g. 2 default teams?
    Thanks for any help

  • #2
    Hi there.
    It is not possible via UI. The workaround here is to set Formula.
    I will move this topic to the Developer Help brunch. Probably someone might have an idea how to rewrite the system logic in order to do this.

    Comment


    • #3
      +1 for out-of-box

      Comment


      • #4
        Originally posted by Maximus View Post
        Hi there.
        It is not possible via UI. The workaround here is to set Formula.
        Maximus Thank you for your interest in the topic.
        Could you explain what this solution would look like?

        Comment


        • #5
          The main logic of the 'Default Team' parameter is to auto-assign a Default user's team to a new record created by the current user.
          So I assumed you need the 'Multy Default Team' parameter to auto-assign multiple teams. So far it is not yet implemented so as a workaround you can use a Formula like this:
          Code:
          $teams_list = list('5fc4e584bc143be8c', '5fc4e064271fb0769', '5fc4e07e34a2abeb1');
          
          ifThen(
              entity\isNew() && assignedUserId == '1',
              entity\addLinkMultipleId('teams', $teams_list)
          );
          BTW, you will need to set this Formula for each entity.
          It is not convenient, so if you have a little experience in codding, you can try to create a global hook with the same logic https://docs.espocrm.com/development.../#global-hooks.


          UPD.
          More proficient workaround.
          It is not convenient to change 'Ids' list in the formula if you want to change the default teams. So you need:
          1. Create a new relationship between User and Teams (One-to-Many). You can call labeled new Meetings link-multiple field like "Default Teams"
          2. Add this new field to the User detail view.
          3. Set either in Formula or Global Hook just to copy defaultTeamIds to teamIds.
          Last edited by Maximus; 03-11-2021, 01:39 PM.

          Comment


          • #6
            Originally posted by Maximus View Post
            1. Create a new relationship between User and Teams (One-to-Many). You can call labeled new Meetings link-multiple field like "Default Teams"
            How to create relationship relationship between User and Teams (One-to-Many)? For entity "User" i dont see foreing entity "Teams":

            Comment


            • #7
              Omg.
              1. Create/edit the file /custom/Espo/Custom/Resources/metadata/scopes/Team.json
              Code:
              {
                  "customizable": true
              }
              2. Administration -> Clear Cache
              3. Press F5 -> try to create the relationship again.

              Comment

              Working...
              X