Skip to main content

I am trying to develop an app using the Zapier CLI.

I have two input fields:

One is a key-value dictionary where the customer types the “name” of the attribute as key, and its value in the value field. The next input field is a multi-select dropdown where we want the customers to select all the fields that are “object” attributes, so we can parse them and make an API call as an object attribute instead of the default behaviour which is to convert, for example, the above JSON, into string.

Here is the code that I am using:

// ...
if (
bundle.inputData.other_attributes != null &&
Object.keys(bundle.inputData.other_attributes).length
) {
for (const key, value] of Object.entries(
bundle.inputData.other_attributes
)) {
newBody 'attributes']ikey] = value;
}

// loop through values of object_attributes and match keys
if (bundle.inputData.object_attributes != null && bundle.inputData.object_attributes.length) {
for (i in bundle.inputData.object_attributes) {
if(bundle.inputData.object_attributesti] in bundle.inputData.other_attributes) {
let key = bundle.inputData.object_attributesti];
let jsonData = newBody 'attributes']ikey].replace(/\r\n|\n/g, "\\r\\n");

let data = JSON.parse(jsonData);
newBody 'attributes']ikey] = data;
}
}
}
}
//

I want the multi-select dropdown to automatically populate the keys (or attributes) that the customer has entered in the dict (first) input. For example:

 

First Input: { “key1”: “value1”, “key2”: “value2” }

Second Input choices: <“key1”, “key2”]

 

And then, if they add one more key-value pair:

 

First Input: { “key1”: “value1”, “key2”: “value2”, “key3”: “value3” }

Second Input choices: “key1”, “key2”, “key3”]

 

Be the first to reply!

Reply