Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Widget get user name and user id

hurm
Tera Contributor

I want get the current user name and user id ,display in the preview

plase help me 

thanks

 

find_real_file.png

1 ACCEPTED SOLUTION

Hi zhian,

If you look at the screenshot that I posted earlier the fields that are references have two correlating properties. One property displays the sys_id of the referenced record and the other one displays the display value of the record. It's indicated by the suffix of "_dv" at the end of the property name.

So to show the display value of the department it would be user.department_dv instead of user.department.

find_real_file.png

View solution in original post

21 REPLIES 21

ChrisBurks
Giga Sage

There is a user object on scope that has a lot of the logged in user's data.

In the HTML you can just use "user.x" and for the client controller make sure to push in $scope and you can then use $scope.user.x

find_real_file.png

hurm
Tera Contributor

This was helpful.
Thank you very much.

hurm
Tera Contributor

s there a way to add a user's department?

hurm
Tera Contributor

I couldn't get the department, is there a better way?find_real_file.png

Hi zhian,

If you look at the screenshot that I posted earlier the fields that are references have two correlating properties. One property displays the sys_id of the referenced record and the other one displays the display value of the record. It's indicated by the suffix of "_dv" at the end of the property name.

So to show the display value of the department it would be user.department_dv instead of user.department.

find_real_file.png