Skip to Content

Scripting in SCP Workflow Cloud Foundry


I am manipulating data in a script task in SCP Workflow on Cloud Foundry.

I got object stored in the context

$.context.myObj = {
                    key1: val1,
                    key2: val2,
                    key3: val3

Now I try to handle that object as a standard JS object


I got an error

TypeError: [object ContextObject] is not an Object in <eval> at line number 2

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 standard docu)

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    Posted on Sep 16 at 07:24 AM

    Hi Vladimir,

    unfortunately, we inherit a bug from the underlying JavaScript engine that makes Object.keys fail on our kind of context objects.

    Fortunately, there is a workaround that is quite simple in most cases. It just lacks the functional approach you have with forEach.

    You can use the for-in loop:

    for(var key in $.context.myObj) { 
    // use key for something

    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:

    I'll take care that the work-around is documented.

    Thanks for bringing this up.

    Best regards,


    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 15 at 05:36 PM
    Add a comment
    10|10000 characters needed characters exceeded

    • Thanks Yogananda Muthaiah,

      I checked the links, but I would probably need more guiding in these.

      I didnt found anything usefull in github link - just error in ancient nodejs version, which was corrected. But no goodies for me.

      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?

      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.

      Does anybody know how to polish scripts in WF?

  • Posted on 5 days ago

    Hi Vladimir,

    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.

    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.



    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.