0

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.

https://xxxx.xxxx.xx/odata/v2/WfRequest(11111L)?$expand=wfRequestUINav I created the request builder as below for the above api:

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

  • Can you please post the complete stacktrace? There should be more information in the logs ("Caused by: Error: something something"). Also the link you posted is not accessible, so a) you might want to consider removing this link, as it looks like an internal one, and b) can you please somehow share the services metadata? Otherwise it's hard to find out what exactly is going wrong. – Dennis H Jun 22 '20 at 05:00
  • Hi Dennis, I have replied in the answers.sap.com. Thanks – user3675416 Jun 23 '20 at 06:50

1 Answers1

1

I guess the answer can be found in the answers.sap.com as mentioned.

Junjie Tang
  • 362
  • 1
  • 15