How do I populate a field like gs.getUserID() does?

Shane J
Tera Guru

I'd like to build a Template to allow the auto-fill of Assignment Group from the User record, using a field called 'u_main_group' (similar to using javascript:  gs.getUserID()).  I've used Script Includes to limit options before, but never to populate a field like that.  

How would I do that?  Is that even the right approach?

1 ACCEPTED SOLUTION

SanjivMeher
Kilo Patron
Kilo Patron
You can use the default field to set the assignment group. In the default field set JavaScript: var u = new GlideRecord('sys_user'); u.get(gs.gerUserID());u.u_main_group;

Please mark this response as correct or helpful if it assisted you with your question.

View solution in original post

6 REPLIES 6

With a minor typo fix, this does work:

 

javascript:var u = new GlideRecord('sys_user'); u.get(gs.getUserID());u.u_main_group;

small update: just to change the JavaScript to javascript