@Kusuma Sai 

you should have mentioned that you are using the variable in scoped app

For scoped app use this

javascript: var val; var rec = new GlideRecord('sys_user'); rec.get(gs.getUserID()); val = rec.u_bu; val;

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post