on 2022 Aug 26 3:04 PM
Hi Gurus,
I need to read data from UserEntity, but I have to use SecuredExecuton method.
I have the following code right now, but it doesn't work, or rather, for some unknown reason, I get 4 then 1 in the console.
I can't figure out why I am facing catch first and then success.
Would be grateful for any feedback/comments.
Thanks.
this.extensionAPI.securedExecution(this._myFunction(UserID))
.then((oData) => {
console.log(3);
})
.catch((oError) => {
console.log(4);
});
_myFunction: function (UserID) {
var sPath = ${Constants.UserEntity}('${UserID}');
return new Promise((fnResolve, fnReject) => {
this.getView().getModel().read(sPath, {
urlParameters: {
$select: Constants.USER_ID_PROPERTY
},
success: (oData) => {
console.log(1);
fnResolve(oData);
},
error: (oError) => {
console.log(2);
fnReject(oError);
}
});
});
}
securedExecution need function as first parameter. you are doing a function call and the returned promise is passed to the securedExecution as first parameter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
71 | |
10 | |
8 | |
7 | |
7 | |
6 | |
6 | |
6 | |
6 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.