Flow Variable not being picked up by script step - Flow Designer

Robert T
Tera Contributor

Greetings,

We have an action which makes a rest call to our monitoring service.  It then returns a json string, from which we need a single field.

We attempted to use the built-in JSON parser to grab that field, but (at the recommendation of HI support) were told to just use a custom script.

That custom script works, and then it stops working because the step itself refuses to accept the variable (the JSON string).  I made a HI ticket for this problem, but the response is slow and so far not helpful, so I thought I would post here.

Here is the script step and script:

find_real_file.png

 

Here is an execution where that input variable jsonString is acquired and used.  You'll see that accepts the JSON body from the REST string and passes it into the field :

find_real_file.png

 

Then there are occasions where we test the same device and the jsonSTRING input variable is simply not defined by the script step, and the entire flow hangs, waiting indefinitely for that variable that never comes:

 

find_real_file.png

The execution log does not have a row for the input variable.  Obviously, the script does not run because it needs that value.

Any info, help, references, even a suggested change to how we are doing this are welcome.

 

Thanks.

1 ACCEPTED SOLUTION

Hi Robert. Were you able to try out the steps I mentioned to see if that corrects your issue?

View solution in original post

8 REPLIES 8

Ok so the response body isn't making it to your script step?

 

If not I would try to remove the input value passing into the jsonString input parameter then resave. One other thought if your action is not in global scope then update line #3 to:

var jsonObj = global.JSON.parse(jsonString);

Hi Robert. Were you able to try out the steps I mentioned to see if that corrects your issue?

Hi David, the "global" piece to the original script appears to have solved it.  Our systems team is running the entire flow through a lot of paces to make sure, but I think it looks good to go.  Thanks so much for your assistance.

Glad to hear. Im happy to help. --David