Skip to Content
0
Jun 21, 2020 at 07:00 AM

Complex Queries for Side-by-Side SuccessFactors extension using SAP Cloud SDK (NodeJS)

38766 Views Last edit Jun 22, 2020 at 09:06 AM 3 rev

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.

  1. https://xxxxxxxxxxxxx/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