Array variable in Query Library

Hi all,

I'm building a shared query to send an email.

The To field can take multiple email address, comma-seperated.
The Headers field takes key:value pairs.

How do I write this in javascript?

It would make sense that both fields would take an array of emails and key:value pairs, respectively, see screenshot below.

Clearly its not working for me.. Any help would be awesome!

Want to be clear, this is in the Query Library.

Hey @dsoliman! I notice a couple things that might put us in the right direction.

First, in your first screenshot, the .join(", ") must be inside the double curlies since it's Javascript and Javascript only works inside the double curly brackets.

Second, you shouldn't actually need to surround the variables in [brackets], as long as you're passing in an array to start. How are you currently populating these values?

Thanks for the response, @victoria .

When I remove the [brackets] and bring in the .join, it throws an error and doesn't show up in variables.

Currently, I'm only putting in a string, but I'd like to have multiple emails (via array), in the To and Bcc and Cc fields.

No idea how to create a key:value pair variable.

Ah, so I think the .join(" ," ) should go in the JS query where you're writing the additionalScope meaning we'd pass in the properly formatted data before it lands in the QL.

Would you mind sharing a screenshot of your JS query with the additionalScope? :slight_smile: