<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: SAP Cloud SDK for JavaScript: Custom Query parameters in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/sap-cloud-sdk-for-javascript-custom-query-parameters/qaa-p/12206973#M4567828</link>
    <description>&lt;P&gt;Hello Roberto,&lt;/P&gt;&lt;P&gt;that sounds like a sensible feature. We just planned to work on that, so probably we will release this feature soon. Is this time critical for you and do you still need a workaround for that in the mean time?&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Marika&lt;/P&gt;</description>
    <pubDate>Mon, 06 Apr 2020 08:24:23 GMT</pubDate>
    <dc:creator>marika_marszalkowski</dc:creator>
    <dc:date>2020-04-06T08:24:23Z</dc:date>
    <item>
      <title>SAP Cloud SDK for JavaScript: Custom Query parameters</title>
      <link>https://community.sap.com/t5/technology-q-a/sap-cloud-sdk-for-javascript-custom-query-parameters/qaq-p/12206972</link>
      <description>&lt;P&gt;Hello all,&lt;BR /&gt;as usual, another question is raising while my journey through the SDK is going further.&lt;/P&gt;
  &lt;P&gt;I am using the SDK to consume SuccessFactors OData API, and it is working great. It is an incredibly powerful tool and amazing things can be done leveraging it.&lt;BR /&gt;However, I came across a very specific situation which is currently not supported (fairly, I have to say) by the SDK.&lt;/P&gt;
  &lt;P&gt;In SuccessFactors, we can query for effective-dated entities but the standard behavior is to return only actual records (= records valid as of today) unless two custom query parameters are present in the URL:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;.../EmpJob?$select=startDate,companyNav/externalCode&amp;amp;$format=json&amp;amp;fromDate=2000-01-01&amp;amp;toDate=9999-12-31&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;The two parameters &lt;STRONG&gt;fromDate&lt;/STRONG&gt; and &lt;STRONG&gt;toDate &lt;/STRONG&gt;are instructing the API to actually fetch all records that are falling in the specified interval.&lt;/P&gt;
  &lt;P&gt;From the SDK fluent API, we can construct the full URL of the built query by:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;EmpJob.requestBuilder().getAll().select(...).filter(...).build({}).url()&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;So that custom query parameters can be easily added to it by concatenation.&lt;/P&gt;
  &lt;P&gt;Question is: how can I then shoot the request with the newly defined URL? Or better...is there a way to inject custom query parameters while building the request?&lt;/P&gt;
  &lt;P&gt;Thanks a lot in advance,&lt;/P&gt;
  &lt;P&gt;Roberto.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Apr 2020 16:30:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sap-cloud-sdk-for-javascript-custom-query-parameters/qaq-p/12206972</guid>
      <dc:creator>former_member231229</dc:creator>
      <dc:date>2020-04-02T16:30:11Z</dc:date>
    </item>
    <item>
      <title>Re: SAP Cloud SDK for JavaScript: Custom Query parameters</title>
      <link>https://community.sap.com/t5/technology-q-a/sap-cloud-sdk-for-javascript-custom-query-parameters/qaa-p/12206973#M4567828</link>
      <description>&lt;P&gt;Hello Roberto,&lt;/P&gt;&lt;P&gt;that sounds like a sensible feature. We just planned to work on that, so probably we will release this feature soon. Is this time critical for you and do you still need a workaround for that in the mean time?&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Marika&lt;/P&gt;</description>
      <pubDate>Mon, 06 Apr 2020 08:24:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sap-cloud-sdk-for-javascript-custom-query-parameters/qaa-p/12206973#M4567828</guid>
      <dc:creator>marika_marszalkowski</dc:creator>
      <dc:date>2020-04-06T08:24:23Z</dc:date>
    </item>
    <item>
      <title>Re: SAP Cloud SDK for JavaScript: Custom Query parameters</title>
      <link>https://community.sap.com/t5/technology-q-a/sap-cloud-sdk-for-javascript-custom-query-parameters/qaa-p/12206974#M4567829</link>
      <description>&lt;P&gt;Hello Marika,&lt;BR /&gt;Thank you for you answer. Should I open a feature request in GitHub?&lt;BR /&gt;It would be nice to have a workaround for this in the time being, it would be the final piece to an application I am working on &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In the meanwhile, I am trying to execute the request directly using axios, I'll let you know if it works.&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 06 Apr 2020 10:24:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sap-cloud-sdk-for-javascript-custom-query-parameters/qaa-p/12206974#M4567829</guid>
      <dc:creator>former_member231229</dc:creator>
      <dc:date>2020-04-06T10:24:30Z</dc:date>
    </item>
    <item>
      <title>Re: SAP Cloud SDK for JavaScript: Custom Query parameters</title>
      <link>https://community.sap.com/t5/technology-q-a/sap-cloud-sdk-for-javascript-custom-query-parameters/qaa-p/12206975#M4567830</link>
      <description>&lt;P&gt;Dear  &lt;SPAN class="mention-scrubbed"&gt;marika.marszalkowski&lt;/SPAN&gt; &lt;BR /&gt;I did a quick and dirty test. Something seems to work, but then I got stuck.&lt;/P&gt;&lt;P&gt;I first get the full URL from the request builder:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;    const odataRequest: ODataRequest&amp;lt;ODataGetAllRequestConfig&amp;lt;EmpPayCompRecurring&amp;gt;&amp;gt; = 
      await EmpPayCompRecurring.requestBuilder().getAll().select(
        EmpPayCompRecurring.PAY_COMPONENT,
        EmpPayCompRecurring.PAYCOMPVALUE,
        EmpPayCompRecurring.START_DATE,
        EmpPayCompRecurring.FREQUENCY_NAV.select(
          FoFrequency.ANNUALIZATION_FACTOR
        )
      ).filter(EmpPayCompRecurring.USER_ID.equals(userId))
       .build({ destinationName: this.configService.get&amp;lt;string&amp;gt;('ACTIVE_DESTINATION')});&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;From the request, the URL and Headers can easily be taken by:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;    const fullUrl = `${odataRequest.url()}&amp;amp;fromDate=1970-01-01&amp;amp;toDate=9999-12-31`;
    const headers = await odataRequest.headers();&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And the Axios request:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;    const odataResult: axios.AxiosResponse&amp;lt;any&amp;gt; = await axios.default.get(fullUrl, {
       method: odataRequest.config.method,
       headers: headers
    });&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I am able to get results, the response is there.&lt;BR /&gt;But now I got stuck in deserializing the entity...I tried using:&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;deserializeEntity(d, EmpJob.requestBuilder()._entityConstructor);
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But it fails with:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Error Cannot read property '_allFields' of undefined&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;I believe I did something wrong &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Hope you can point me in any direction!&lt;/P&gt;&lt;P&gt;Thanks,&lt;BR /&gt;Roberto.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Apr 2020 11:56:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sap-cloud-sdk-for-javascript-custom-query-parameters/qaa-p/12206975#M4567830</guid>
      <dc:creator>former_member231229</dc:creator>
      <dc:date>2020-04-06T11:56:54Z</dc:date>
    </item>
    <item>
      <title>Re: SAP Cloud SDK for JavaScript: Custom Query parameters</title>
      <link>https://community.sap.com/t5/technology-q-a/sap-cloud-sdk-for-javascript-custom-query-parameters/qaa-p/12206976#M4567831</link>
      <description>&lt;P&gt;Hello Roberto,&lt;/P&gt;&lt;P&gt;I was actually already working on this today, you can find the according pull request here: &lt;A href="https://github.com/SAP/cloud-sdk/pull/74"&gt;https://github.com/SAP/cloud-sdk/pull/74&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;We should be able to merge this tomorrow. For your workaround, I am not sure what might be the issue, maybe you can try&lt;/P&gt;&lt;P&gt;deserializeEntity(d, EmpJob);&lt;/P&gt;&lt;P&gt;If this doesn't work it might be interesting to know what the data looks like?&lt;/P&gt;&lt;P&gt;UPDATE:&lt;/P&gt;&lt;P&gt;This feature is available with version 1.19.0, use:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;EmpJob.requestBuilder().withCustomQueryParameters({ param: value }).&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Apr 2020 16:16:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sap-cloud-sdk-for-javascript-custom-query-parameters/qaa-p/12206976#M4567831</guid>
      <dc:creator>marika_marszalkowski</dc:creator>
      <dc:date>2020-04-06T16:16:25Z</dc:date>
    </item>
    <item>
      <title>Re: SAP Cloud SDK for JavaScript: Custom Query parameters</title>
      <link>https://community.sap.com/t5/technology-q-a/sap-cloud-sdk-for-javascript-custom-query-parameters/qaa-p/12206977#M4567832</link>
      <description>&lt;P&gt;Hello Marika,&lt;BR /&gt;Yes, it works! Thank you!&lt;/P&gt;&lt;P&gt;I will live with this waiting for the merge.&lt;/P&gt;&lt;P&gt;Thank you so much!&lt;/P&gt;&lt;P&gt;Roberto&lt;/P&gt;</description>
      <pubDate>Tue, 07 Apr 2020 08:57:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sap-cloud-sdk-for-javascript-custom-query-parameters/qaa-p/12206977#M4567832</guid>
      <dc:creator>former_member231229</dc:creator>
      <dc:date>2020-04-07T08:57:52Z</dc:date>
    </item>
    <item>
      <title>Re: SAP Cloud SDK for JavaScript: Custom Query parameters</title>
      <link>https://community.sap.com/t5/technology-q-a/sap-cloud-sdk-for-javascript-custom-query-parameters/qaa-p/12206978#M4567833</link>
      <description>&lt;P&gt;After upgrading to 1.19.0 everything works perfectly.&lt;/P&gt;&lt;P&gt;For SuccessFactors API consumers, here is how you can fetch also historical records from the system (this is an example using entity EmpPayCompRecurring):&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;EmpPayCompRecurring.requestBuilder().getAll().select(
      EmpPayCompRecurring.PAY_COMPONENT,
      EmpPayCompRecurring.PAYCOMPVALUE,
      EmpPayCompRecurring.START_DATE,
      EmpPayCompRecurring.FREQUENCY_NAV.select(
        FoFrequency.ANNUALIZATION_FACTOR
      )
    ).filter(EmpPayCompRecurring.USER_ID.equals(userId)).withCustomQueryParameters({ fromDate: '1970-01-01', toDate: '9999-12-31'})
    .execute({ destinationName: this.configService.get&amp;lt;string&amp;gt;('ACTIVE_DESTINATION')});&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Hands up for the SDK team! &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Apr 2020 12:50:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sap-cloud-sdk-for-javascript-custom-query-parameters/qaa-p/12206978#M4567833</guid>
      <dc:creator>former_member231229</dc:creator>
      <dc:date>2020-04-07T12:50:48Z</dc:date>
    </item>
  </channel>
</rss>

