Skip to Content

How to find who pressed the button

Aug 26, 2017 at 01:05 PM


avatar image

HI ,

I am new to UI5, I have a scenario, where I need to have a button and I need to find who pressed the button or to capture the User ID of the button..

Should I get it through Odata or do I have option here to capture in Java script.

here is the code I have written.

onAssignMe: function(oEvt) {

var oButton = this.getView().byId("userAssign");




10 |10000 characters needed characters left characters exceeded

then what's the scenario.....


Scenario is, when I try to access the URl and click on button I should able to capture my ID and put it as a text field.


who clicked the button? The logged on user. Any action on the view can be used to capture the logged on user by making users access the app from launchp


Hi Sharath,

Yes , as who clicked on the button.. Yes they access the application through URL or Launchpad.

Should I try to capture using this ?


Then, you can get the logged on user in the launchpad.

Check the link:


Why do you capture the username in UI5 app?

* Please Login or Register to Answer, Follow or Comment.

2 Answers

Thomas Arnesen Aug 31, 2017 at 07:46 AM

I would get it through OData, but if getting it on the client side you could use the below to get the client-side user ID:

10 |10000 characters needed characters left characters exceeded
Yoppie Ariesthio Aug 31, 2017 at 07:33 AM

Hi Vijay,

You can use XSJS to get username login on your HANA System.

Just simple ajax request and it will return your username.

Please refer to this link -> get current user login

1. Create XSJS file

$.response.contentType = 'application/json'; 
$.response.setBody( $.session.getUsername() );    
$.response.status = $.net.http.OK;

2. And then at your ui5 app do ajax call to this xsjs.

3. Please take a look at your console tab on your browser to see return.

Best Regards,

Yoppie Ariesthio.

10 |10000 characters needed characters left characters exceeded