JavaScript with multiple properties for output

I created an output for my JavaScript flow control, and that output has 2 properties. When creating bindings the system sees the 2 properties fine, but the first one has a value and the second does not.

I used this code to set the values – it sees ABC but not XYZ:

return [0, { prop1: "ABC", prop2 : "XYZ"}]

Instead, if I define the first as an object and give this object 2 properties, it works with this coding:

return [0, { result: { prop1: "ABC", prop2 : "XYZ" } } ]

Why doesn’t the first way work?

Hi @Daniel_Wroblewski, did you remember to add “prop2” to the list of outputs on the right? I tried the following and it works:

Sorry, I cannot get this to work. Here’s is my JavaScript:

Then on the first output, I set a page variable that is bound to a text element. The result2 property is always undefined.

Here is the formula binding:

image

image

According to this video, it seems that if I want to return 2 properties I need to put them in an object. Though I can’t understand how you got it to work. AppGyver: How to Use Custom Javascript - YouTube

Hi, I was able to reproduce the issue now and will report it forward. Looks like it matters if you try to use both properties at once – if I try your formula, the 2nd value is undefined, but if I alert that value alone, the output seems correct. That’s why I didn’t catch it last time :slight_smile:

As you mentioned, the object method works:

1 Like