Showing results for 
Search instead for 
Did you mean: 

Get logged in User details in SAP FIORI app using SAP BAS cloud Foundry

0 Kudos

Hello Experts

I Have tried below blog and was successfully able to get the login details.

The question here is , if i create a simple Custom Fiori application(managed approuter) , how do i get logged in user details in controller.?



Accepted Solutions (0)

Answers (2)

Answers (2)

Active Participant
0 Kudos

Very same like you described, just make the call

onShowCurrentUser: function() {
    var oModel = new sap.ui.model.odata.v2.ODataModel("/path/to/your/service");
    this.getView().setModel(oModel);"/CurrentUser", {
        success: function(oData) {
            // Process the response data, e.g., display in a control
            var currentUserDetails = oData.results[0]; // Assuming the first result is the user data
            // Update your view/control with currentUserDetails
        error: function(oError) {
            // Handle errors, e.g., user not logged in or service not reachable

Active Contributor
0 Kudos

in your controller, make a ajax call to get the data.