on 06-21-2020 8:00 AM
Hi All,
I am trying to create request builders using SAP Cloud SDK for calling Successfactors Odata APIs. I am facing issues with complex OData querying that includes $expand and maybe custom fields.
WfRequest.requestBuilder()
.getByKey(11111)
.select(
WfRequest.WF_REQUEST_UI_NAV
)
.execute({
destinationName: "sfapi"
});
I am getting the below error:
OData get by key request failed!
So I modified the code by adding TO_ to WF_REQUEST_UI_NAV as below:
WfRequest.TO_WF_REQUEST_UI_NAV
but still getting the same error. So I thought it may be a custom field and changed the code as below:
const WF_REQUEST_UI_NAV = WfRequest.customField('wfRequestUINav');
function getWFRequestsDetail() {
return WfRequest
.requestBuilder()
.getByKey(11111)
.select(
WF_REQUEST_UI_NAV
)
.execute({
destinationName: "sfapi"
});
}
I got the below output, but not the expanded result:
{
"wfRequestUINav": {
"__deferred": {
"uri": "https://api12preview.sapsf.eu/odata/v2/WfRequest(11111L)/wfRequestUINav"
}
}
}
Can anyone help in fixing this issue?
Thanks & Regards,
Harish
Hi harish_k824,
it seems that this service does not allow to select all fields, which is denoted by '*'. As other services do not allow this I will have to check back with the team whether and how we can solve this. In the meantime you can obtain the same results with the following:
WfRequest
.requestBuilder()
.getByKey(11111)
.withCustomQueryParameters({
$expand: WfRequest.WF_REQUEST_UI_NAV._fieldName,
$select: WfRequest.WF_REQUEST_UI_NAV._fieldName
})
.execute({ destinationName: 'sfapi' });
Please also note, that for productive purposes selecting all properties of an entity is not recommended, consider doing the following. It will also spare you using the workaround:
WfRequest
.requestBuilder()
.getByKey(11111)
.select(WfRequest.WF_REQUEST_UI_NAV.select(
LinkedEntityName.SOME_PROPERTY
))
.execute({ destinationName: 'sfapi' });
I hope that helps!
P. S. On the EDMX file I couldn't find any property that would correspond to WF_REQUEST_UI_NAV therefore it is possible that there are other issues as well.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
9 | |
8 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.