access user info in javascript?

  • 1
  • Question
  • Updated 4 years ago
  • Answered
Anyone with a quick pointer on how to access {{$User.userName}} in javascript?

Thanks!
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb

Posted 4 years ago

  • 1
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
skuid.utils.userInfo.name
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
You're the best, Pat!
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
Also, see the docs on the $User global merge variable, which mention that this data is sources from the skuid.utils.userInfo object in JavaScript.
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Nice. I should have looked at the documentation more carefully!
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
Note: 
skuid.utils.userInfo.userName will give you a User's Username, something like "joe@somewhere.com"
skuid.utils.userInfo.name will give you a User's Full Name, something like "Joe Smith"
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Yeah... Pat gave me what I actually wanted, despite the fact that I asked for the wrong thing!