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.

UI action on click get user name

hurm
Tera Contributor

Hi All

In CSM screen(case table) , i want to get login user who clicked button in UI action and set it in screen item

Please help me

1 REPLY 1

Allen Andreas
Tera Patron

Hello,

It would have been helpful to see a screenshot of of your UI Action and it's setting so far, as well as where on the CSM form you're talking about that you'd like the login user who clicked the button to be placed.

If the UI Action is client side, then you can review using g_user: https://developer.servicenow.com/dev.do#!/learn/learning-plans/tokyo/servicenow_administrator/app_st... 

and then simply g_form.setValue('field_name', g_user_method_from_link);

Otherwise, if it's a server side UI Action, then you get use the standard GlideSystem User Object API: https://servicenowguru.com/scripting/user-object-cheat-sheet/ and then something like:

current.setValue('field_name', gs.getUserObject_link_method); 

current.update();

 

Please mark reply as Helpful/Accept Solution, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!