Merge field for current user

  • 2
  • Question
  • Updated 4 years ago
  • Answered
How do I display attributes of the current user (e.g. full name, alias, id) in a template?

I thought it would be an easy merge field, like {{$User.Id}}. But that, and a gazillion permutations of it, don't work.

Wonder if someone could put me out of my misery please.
Photo of Glenn Elliott

Glenn Elliott, Champion

  • 7,738 Points 5k badge 2x thumb
  • displaying signs of poorly managed anger derived from coding inabilities

Posted 5 years ago

  • 2
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
Unfortunately that doesn't work in the current release, we just added $User as a merge variable in our dev version. In the next release you'll be able to do {{$User.Id}}.

However you can achieve this currently by creating a Model on the User object, e.g. called "RunningUser", to request the fields you want, and have a Condition where User Id is User Id of the Running User.

Then, you can use Global Model Merge syntax to get at the user's Id:

{{$Model.RunningUser.data.0.Id}}
{{$Model.RunningUser.data.0.FirstName}}
{{$Model.RunningUser.data.0.Username}}
Photo of Glenn Elliott

Glenn Elliott, Champion

  • 7,738 Points 5k badge 2x thumb
Thanks Zach, good to know it wasn't me losing my mind.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Note for posterity:  All global merge values are listed here: http://help.skuidify.com/m/11720/l/187263-global-merge-variables-functions