3 weeks ago
Hello everyone,
I'm using CAP(Node.js) with Fiori elements. I have a cap action that returns a string :
HTTP/1.1 200 OK
odata-version: 4.0
content-type: application/json;odata.metadata=minimal
{"@odata.context":"../$metadata#Edm.String","value":"TEST"}
But inside my custom handler the result variable shows :
d {oModel: T, sPath: '/TestService(ID=6f76d291-9e2e-423a-bd16-1c7b7…true)/TestService.CapAction(...)', bForceRefresh: false, sDeepPath: '', oBinding: c, …}
And the string "TEST" isn't being returned anywhere in this object. Any ideas how i can get the returned value ?
Request clarification before answering.
The return value of the 'invokeAction()' function is an ODataV4Context on which the 'getObject()' function will return the data object.
See: https://sapui5.hana.ondemand.com/1.135.0/#/api/sap.ui.model.odata.v4.Context%23methods/getObject
So in your code you can do
this.editFlow
.invokeAction(sActionName, oParameters)
.then(result => {
const data = result?.getObject()
console.log(data?.value)
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
70 | |
21 | |
9 | |
7 | |
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.