Auto-assign Team based on user Team

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rparaian
    Junior Member
    • May 2025
    • 6

    #1

    Auto-assign Team based on user Team

    Hello everybody,

    I just encountered a new issue which I have not found the solution to yet:

    If I set a role as a normal user, and I am adding an entry to an entity. Is there a way for that entry to be automatically assigned the same Team as that users's Team?

    Click image for larger version

Name:	image.png
Views:	15
Size:	12.4 KB
ID:	118037

    Click image for larger version

Name:	image.png
Views:	17
Size:	14.1 KB
ID:	118036

    In the roles I have set the user Role to be able to Read all the Team entries, but because that is not filled in, and users are forgetting to fill that in, they cannot see what anybody else in the team is filling in.

    Basically this is a database of all of training participants. We have 50 branches, setup as 50 teams, and I want each branch to see only the participants their own trainers are putting in, and​ if the Teams field is empty, only I can see them as administator.


    And secondly, I have a field that is auto-increment and is counting the total number of entries. Is there a way to also count based on each team, separate then the general count?

    Thank you !

  • shalmaxb
    Senior Member
    • Mar 2015
    • 1671

    #2
    I use this for a case as described:

    Formula

    PHP Code:
    //set the Id of the assigned user to the one who is logged in
    ifThen(
    entity\isNew(),
    assignedUserId env\userAttribute('id')
    );

    //set the team of that user according to the role in user record
    teamsIds assignedUser.teamsIds

    Comment

    Working...