Getting the list of Teams Assigned to the Current User

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Triggerz
    Member
    • May 2024
    • 64

    Getting the list of Teams Assigned to the Current User

    Hi,

    I am trying to get the list of Teams assigned to the current user. I tried the code below in the Formula Sandbox but I am getting an Error 500.
    I need this to check if a user is assigned to a specific team and use this as a condition to make fields read-only. Please help.

    output\printLine(env\userAttribute('teams'));


    Thanks
  • victor
    Active Community Member
    • Aug 2022
    • 797

    #2
    Code:
    $userTeamsNames = env\userAttribute('teamsNames');
    output\printLine($userTeamsNames);
    Click image for larger version

Name:	image.png
Views:	0
Size:	44.6 KB
ID:	115414

    Comment

    • Triggerz
      Member
      • May 2024
      • 64

      #3
      Hi victor,

      Thank you so much, the code you provided works perfectly.

      I also need to get the role names, I tried executing the code below but I am getting a {} output. Not sure if I have the wrong parameter, please help as well on this please.

      Code:
      $userRolesNames = env\userAttribute('rolesNames');
      output\printLine($userRolesNames);
      Thanks

      Comment

      Working...