on 06-12-2018 7:56 PM
Hi!
I am creating an SAPUI5 application to extend SUCCESS FACTORS. Within the application, I am using the User SCP API, to obtain the logged in user.
But when I test the application in SuccessFactors, the api returns 404 error.
Inside attachRequestCompleted, it always returns error: 404 - Error report
My code:
var oModel = new sap.ui.model.json.JSONModel();
// Load the data
oModel.loadData("/services/userapi/currentUser");
// Add a completion handler to log the json and any errors
oModel.attachRequestCompleted(function onCompleted(oEvent) {
if (oEvent.getParameter("success")) {
var _User = oModel.getData();
this.setData({
"json": this.getJSON(),
"status": "Success"
}, true);
} else {
var msg = oEvent.getParameter("errorObject").textStatus;
if (msg) {
this.setData("status", msg);
} else {
this.setData("status", "Unknown error retrieving user info");
}
}
});
I FOUND THE SOLUTIN!
window.sap.ushell.Container.getUser().getId();
WARNING! This works in the application inside SF but it does not work when it is being tested in WEBIDE.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.