Javascript In Zapier: Split into "-" into multiple outputs

I am trying to take the text in a line like this:

"- Data 1 - Data 2 - Data 3"

And separate each of them using javascript into your own "output" for zapier. The goal is to be able to accept this data, and each row of data is used to pre-fill the form for the client as follows:

theinternet.com/exampleform/?input1=Data%201&input2=Data%202&input3=Data%203

I need to be able to use javascript to create a url, or have multiple outputs that I can use to integrate with another zap.

Up to 20 rows of data can exist, or just 1, so why scale?

Maybe there is a better way to do this other than javascript?

Does anyone have any ideas?

+4
source share
1 answer

The problem is solved with a friend from work. I'm not sure I understand enough to explain this. But it did what we needed.

var string = inputData.data
var obj = {}

string
    .split("- ")
    .forEach(function(item, i) {
        obj[i] = item
    })

output = [obj]
Run codeHide result
0
source

Source: https://habr.com/ru/post/1664468/


All Articles