cancel
Showing results for 
Search instead for 
Did you mean: 

How to get subaccount ID of SAP Cloud Platform from SAPUI5 app Controller?

former_member514516
Participant
0 Kudos

I have a SAPUI5 / Fiori app deployed in SAP Cloud Platform which we push to 3 subaccounts for Dev, Test and Production.. I need to be able to have the app at runtime determine the subaccount it's in thus need to get this from the app's Controller (Javascript). Any chance how to do this? Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

former_member514516
Participant
0 Kudos

I just used the Javascript code window.location.href to get the URL and from there was able to extract the subaccount technical name using String includes() method.

Answers (1)

Answers (1)

arthursilva
Active Participant
0 Kudos

Hello Michael, hope you're well.

To get current logged user, you might want to use class sap.ushell.services. It allows you to retrieve information about the current logged-in user. Here's an example:

new sap.ushell.services.UserInfo().getId()

Also, more detailed information might be found on new sap.ushell.services.UserInfo(). I tried once, and it worked properly.

KR
Arthur Silva

former_member514516
Participant
0 Kudos

Thanks Arthur. What I was looking for instead is getting the SAP Cloud Platform subaccount ID or name..