Referring to customjs output I subsequent modules

I’m using customjs to manipulate some text, and the result of the js module is an array that returns a series of 6 variables. The final line of code generating this is
return {firstName,surName,emailAddress,groupName,details,website,};
When I run the code, I get a field to map, but it only shows me a single field, called ‘output’. I’ve tried to use this by adding a number between the square brackets, so when I want to utilise the data for ‘firstName’ I change to ‘output[1]’ but when the scenario runs, this doesn’t pick up the data.

So, how do I refer to the 6 different fields that get returned from the customjs function?

Welcome to the Make community!

How is your CustomJS set up? How does the Output Bundle of module [44] look like?

To allow others to assist you with your scenario, please provide the following:

1. Relevant Screenshots

Could you please share screenshots of your full scenario? Also include screenshots of any error messages, module configuration fields, and any filter settings. We need to see what you’re working with to give you the best advice.

You can upload images here using the Upload icon in the text editor:

2. Scenario Blueprint

Please export the scenario blueprint. Providing your scenario blueprint file will allow others to quickly recreate and see how you have set up the mappings in each module, and also allows us take screenshots or provide module exports of any solutions we have for you in return - this would greatly benefit you in implementing our suggestions as you can simply paste module exports back into your scenario editor!

To export your scenario blueprint, click the three dots at the bottom of the editor then choose ‘Export Blueprint’.

You can upload the file here by clicking on this button:

3. Output Bundles of Modules

Please provide the output bundles of each of the relevant modules by running the scenario (you can also get this without re-running your scenario from the History tab).

Click on the white speech bubbles on the top-right of each module and select “Download input/output bundles”.

A. Upload as a Text File

Save each bundle contents in a plain text editor (without formatting) as a bundle.txt file.

You can upload the file here by clicking on this button:

B. Insert as Formatted Code Block

If you are unable to upload files on this forum, alternatively you can paste the formatted bundles.
These are the two ways to format text so that it won’t be modified by the forum:

  • Method 1: Type code block manually

    Add three backticks ``` before and after the content/bundle, like this:

    ```
    content goes here
    ```

  • Method 2. Highlight and click the format button in the editor

Providing the input/output bundles will allow others to replicate what is going on in the scenario, especially if there are complex data structures (nested arrays and collections) or if external services are involved.

Sharing these details will make it easier for others to assist you.

Here you go. Here’s the blueprint:
blueprint.json (326.3 KB)

and here’s the output of the customjs module:

[
    {
        "output": {
            "firstName": "edie",
            "surName": "Buble",
            "emailAddress": "Edie@communityshares.co.uk",
            "groupName": "The name of your group",
            "details": "we are gonna slay\ndude",
            "website": "www.edieexpert.com"
        }
    }
]

Looks like you’ll either have to manually type out the collection key names, like this:

{{ 44.output.firstName }}
{{ 44.output.surName }}
{{ 44.output.emailAddress }}
{{ 44.output.groupName }}
{{ 44.output.details }}
{{ 44.output.website }}

or you can put the Output variable in a Set Variable module.

Hope this helps! Let me know if there are any further questions or issues.

@samliew

P.S.: Investing some effort into the Make Academy will save you lots of time and frustration using Make.