on 11-04-2019 5:47 AM
var oUserModel = new sap.ui.model.json.JSONModel("/services/userapi/currentUser");
//By this i am getting the data of the current user.
console.log(oUserModel)
//when i print it in console I get the currentUser data in the oData Section of the object.Can I know how to extract the data.
Hi Amit,
You can get JSON data by this way.
var oUserModel = new sap.ui.model.json.JSONModel("/services/userapi/currentUser");
var data = JSON.parse(oUserModel.getJSON());
Regards,
Manjunatha Devadiga
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Amit,
If you want to view data before databinding.
You should loaddata into json using
var oUserModel =new sap.ui.model.json.JSONModel();
oUserModel.loadData("/services/userapi/currentUser");
//now check data
console.log(oUserModel.getData());
Hope helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Amit,
ok sorry, I thought the service work.
For information about user I'm using this :
sap.ushell.Container.getUser()
without json model.
Sebastiano
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
6 | |
6 | |
5 | |
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.