Add Ons and Integrations

Add Ons and Integrations

Ask questions about Control Center, Dynamic View, DataMesh, Pivot App, Calendar App, or WorkApps. Discuss connecting Smartsheet to your other systems with integrations such as Bridge, Data Shuttle, the Jira connector, and the Salesforce connector.

JavaScript Error with Bridge

I am using the API function to return a list of users as an array;

Then I am using the Javascript Module to filter those users whos status is "DEACTIVATED"

But I get the following error: "workflow execution failed: Plugin Error ERR_PROCESSING : failed to execute extension module : require is not defined"

Here is my Javascript code;


function filterDeactivated(users) {
return users
.filter(user => user.status === "DEACTIVATED")
.map(user => ({ name: user.name, status: user.status }));
}

Then my Key & Value is;

Where the value is the object array from the previous API call ({{states.startstate.call_api.make_api_call.response.data}})

@Genevieve P. @Samuel Mueller

Best Answer

  • ✭✭✭✭✭✭
    Answer ✓

    Got it to work with the following code:

    // Filter users with status 'DEACTIVATED'
    const deactivatedUsers = users.filter(user => user.status === 'DEACTIVATED');

    // Map the desired properties (name and status) for each deactivated user
    const result = deactivatedUsers.map(user => ({
    name: user.name,
    status: user.status
    }));

    // Return the result as the output
    return result;

Answers

Trending Posts