<?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: Scripting in  SCP Workflow Cloud Foundry in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/scripting-in-scp-workflow-cloud-foundry/qaa-p/12273753#M4597983</link>
    <description>&lt;P&gt;Hi Tobias.&lt;/P&gt;&lt;P&gt;I have tried with you suggested method to iterate over keys in context object and to delete any that includes specific text, but the returned error says key.includes is not a function. Is that also some limitation? &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;for(var keyin$.context.myObj){
if(key.includes("string") {
delete $.context[key]
}
}&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 10 Mar 2021 10:14:59 GMT</pubDate>
    <dc:creator>former_member527246</dc:creator>
    <dc:date>2021-03-10T10:14:59Z</dc:date>
    <item>
      <title>Scripting in  SCP Workflow Cloud Foundry</title>
      <link>https://community.sap.com/t5/technology-q-a/scripting-in-scp-workflow-cloud-foundry/qaq-p/12273747</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
  &lt;P&gt;I am manipulating data in a script task in SCP Workflow on Cloud Foundry.&lt;/P&gt;
  &lt;P&gt;I got object stored in the context&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;$.context.myObj = {
                    key1: val1,
                    key2: val2,
                    key3: val3
};
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;Now I try to handle that object as a standard JS object&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;Object.keys($.context.myObj).forEach(.....)&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;I got an error&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;TypeError: [object ContextObject] is not an Object in &amp;lt;eval&amp;gt; at line number 2&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;Where can I find the specification of that special kind of object and how to handle them? Is there some specification, documentation or at least some information (beside that &lt;A href="https://help.sap.com/viewer/e157c391253b4ecd93647bf232d18a83/Cloud/en-US/ca9a4381628a40908ffe1f74bde9f3ce.html" target="_blank"&gt;standard&lt;/A&gt; docu)&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2020 15:49:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/scripting-in-scp-workflow-cloud-foundry/qaq-p/12273747</guid>
      <dc:creator>vbalko-claimate</dc:creator>
      <dc:date>2020-09-15T15:49:57Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting in  SCP Workflow Cloud Foundry</title>
      <link>https://community.sap.com/t5/technology-q-a/scripting-in-scp-workflow-cloud-foundry/qaa-p/12273748#M4597978</link>
      <description>&lt;P&gt;Hi  &lt;SPAN class="mention-scrubbed"&gt;vbalko_effiis&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;This link may help to your question. &lt;/P&gt;&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/23838914/cant-inherit-from-context-object" target="test_blank"&gt;https://stackoverflow.com/questions/23838914/cant-inherit-from-context-object&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/nodejs/node/issues/5679" target="test_blank"&gt;https://github.com/nodejs/node/issues/5679&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2020 17:36:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/scripting-in-scp-workflow-cloud-foundry/qaa-p/12273748#M4597978</guid>
      <dc:creator>Yogananda</dc:creator>
      <dc:date>2020-09-15T17:36:15Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting in  SCP Workflow Cloud Foundry</title>
      <link>https://community.sap.com/t5/technology-q-a/scripting-in-scp-workflow-cloud-foundry/qaa-p/12273749#M4597979</link>
      <description>&lt;P&gt;Thanks  &lt;SPAN class="mention-scrubbed"&gt;yoganandamuthaiah&lt;/SPAN&gt;,&lt;/P&gt;&lt;P&gt;I checked the links, but I would probably need more guiding in these.&lt;/P&gt;&lt;P&gt;I didnt found anything usefull in github link - just error in ancient nodejs version, which was corrected. But no goodies for me.&lt;/P&gt;&lt;P&gt;Stackoverflow - as usually - is full of guidance, but in this case, all solutions seems to me overcomplicated - to create huge function just to access objects members?&lt;/P&gt;&lt;P&gt;It has to be better way. It is pitty, that try fail method in this case is extremly time consuming. For every try I have to build, deploy and start wf again. 3 - 5 minutes per cycle. Also no console - just helper variables in context.&lt;/P&gt;&lt;P&gt;Does anybody know how to polish scripts in WF?&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2020 19:39:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/scripting-in-scp-workflow-cloud-foundry/qaa-p/12273749#M4597979</guid>
      <dc:creator>vbalko-claimate</dc:creator>
      <dc:date>2020-09-15T19:39:08Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting in  SCP Workflow Cloud Foundry</title>
      <link>https://community.sap.com/t5/technology-q-a/scripting-in-scp-workflow-cloud-foundry/qaa-p/12273750#M4597980</link>
      <description>&lt;P&gt;Hi Vladimir,&lt;/P&gt;&lt;P&gt;unfortunately, we inherit a bug from the underlying JavaScript engine that makes Object.keys fail on our kind of context objects.&lt;/P&gt;&lt;P&gt;Fortunately, there is a workaround that is quite simple in most cases. It just lacks the functional approach you have with forEach.&lt;/P&gt;&lt;P&gt;You can use the for-in loop:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;for(var key in $.context.myObj) { 
// use key for something
}&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The help pages are basically our specification. Due to restrictions and bugs of the underlying engine, it is more a "specification by example". For reading the context, see here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.sap.com/viewer/e157c391253b4ecd93647bf232d18a83/Cloud/en-US/36fa9a00893f42939fa17516a33f2a94.html" target="test_blank"&gt;https://help.sap.com/viewer/e157c391253b4ecd93647bf232d18a83/Cloud/en-US/36fa9a00893f42939fa17516a33f2a94.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I'll take care that the work-around is documented.&lt;/P&gt;&lt;P&gt;Thanks for bringing this up.&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Tobias&lt;/P&gt;</description>
      <pubDate>Wed, 16 Sep 2020 07:24:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/scripting-in-scp-workflow-cloud-foundry/qaa-p/12273750#M4597980</guid>
      <dc:creator>tobias_breyer</dc:creator>
      <dc:date>2020-09-16T07:24:52Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting in  SCP Workflow Cloud Foundry</title>
      <link>https://community.sap.com/t5/technology-q-a/scripting-in-scp-workflow-cloud-foundry/qaa-p/12273751#M4597981</link>
      <description>&lt;P&gt;Thank you  &lt;SPAN class="mention-scrubbed"&gt;tobias.breyer&lt;/SPAN&gt; it is exactly what I needed. &lt;/P&gt;&lt;P&gt;Please put that info to the documentation, it is really worth it.&lt;/P&gt;&lt;P&gt;And just out of curiosity - what is that engine, which does not contains Object.keys prototype? And why it does not have it?&lt;/P&gt;</description>
      <pubDate>Wed, 16 Sep 2020 14:05:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/scripting-in-scp-workflow-cloud-foundry/qaa-p/12273751#M4597981</guid>
      <dc:creator>vbalko-claimate</dc:creator>
      <dc:date>2020-09-16T14:05:05Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting in  SCP Workflow Cloud Foundry</title>
      <link>https://community.sap.com/t5/technology-q-a/scripting-in-scp-workflow-cloud-foundry/qaa-p/12273752#M4597982</link>
      <description>&lt;P&gt;Hi Vladimir,&lt;/P&gt;&lt;P&gt;I cannot share implementation details, because then people start relying on it. It is not too difficult to guess, but guessing is a different thing from SAP documenting it and then being bound to that.&lt;/P&gt;&lt;P&gt;The engine does have Object.keys, but it only works on native JS objects, but not on the special objects that come out of our context API.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Tobias&lt;/P&gt;</description>
      <pubDate>Fri, 18 Sep 2020 06:45:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/scripting-in-scp-workflow-cloud-foundry/qaa-p/12273752#M4597982</guid>
      <dc:creator>tobias_breyer</dc:creator>
      <dc:date>2020-09-18T06:45:21Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting in  SCP Workflow Cloud Foundry</title>
      <link>https://community.sap.com/t5/technology-q-a/scripting-in-scp-workflow-cloud-foundry/qaa-p/12273753#M4597983</link>
      <description>&lt;P&gt;Hi Tobias.&lt;/P&gt;&lt;P&gt;I have tried with you suggested method to iterate over keys in context object and to delete any that includes specific text, but the returned error says key.includes is not a function. Is that also some limitation? &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;for(var keyin$.context.myObj){
if(key.includes("string") {
delete $.context[key]
}
}&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Mar 2021 10:14:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/scripting-in-scp-workflow-cloud-foundry/qaa-p/12273753#M4597983</guid>
      <dc:creator>former_member527246</dc:creator>
      <dc:date>2021-03-10T10:14:59Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting in  SCP Workflow Cloud Foundry</title>
      <link>https://community.sap.com/t5/technology-q-a/scripting-in-scp-workflow-cloud-foundry/qaa-p/12273754#M4597984</link>
      <description>&lt;P&gt;Hi Shanir,&lt;/P&gt;&lt;P&gt;Array.includes is ES6, but we only support ES5.1 &lt;/P&gt;&lt;P&gt;See &lt;/P&gt;&lt;P&gt;&lt;A href="https://help.sap.com/viewer/e157c391253b4ecd93647bf232d18a83/Cloud/en-US/ca9a4381628a40908ffe1f74bde9f3ce.html" target="test_blank"&gt;https://help.sap.com/viewer/e157c391253b4ecd93647bf232d18a83/Cloud/en-US/ca9a4381628a40908ffe1f74bde9f3ce.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;You can use indexOf which has slightly different behavior, but usually can do most of the same tasks. See for example:&lt;/P&gt;&lt;P&gt;&lt;A href="https://betterprogramming.pub/array-includes-method-in-javascript-38d919b59c41" target="test_blank"&gt;https://betterprogramming.pub/array-includes-method-in-javascript-38d919b59c41&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Tobias&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 10:36:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/scripting-in-scp-workflow-cloud-foundry/qaa-p/12273754#M4597984</guid>
      <dc:creator>tobias_breyer</dc:creator>
      <dc:date>2021-03-10T10:36:45Z</dc:date>
    </item>
  </channel>
</rss>

