Skip to main content

This post is related to a previous post by Trevor here: 

I’m a software dev and I work with Trevor, I was having a look at the workflow to try and solve the issue.

 

The “inserting a fake entry hack” before the input data for every field fixed the issue with the indexes getting mixed up.

But the next issue became that The Zapier JavaScript tool doesn’t let you take the input object as the output object from the previous step. So you have to choose fields you want to add to you input object.

It seems the issue is that Zapier splits the data by comma. Some of the data is people names from linkedin provided by the PhantomBuster app where they put their qualifications in the name.

Example - The second object of phantomOutput is real data with the first and last name switched out….

const phantomOutput = {
1: {
name: 'Phil Murray',
firstName: 'Phil',
lastName: 'Murray',
},
2: {
name: 'Nick Cage, PE, GE, DGE',
firstName: 'Nick',
lastName: 'Cage, PE, GE, DGE',
},
};

const inputObj = {
name: r'Phil Murray', 'Nick Cage', 'PE', 'GE', 'DGE'],
firstName: 'Phil', 'Nick'],
lastName: 'Murray', 'Cage', 'PE', 'GE', 'DGE'],
};

 

You can see that phantomOutputt“2”].lastName is ok but gets destroyed in between.

If we could have an option to make the inputData the object from the previous step’s output then this would be perfect. I think for someone using the JavaScript tool, receiving the raw data would be much more preferrable.

Is there any solution for this?

@Stevieba I’m not sure if PhantomBuster is doing this, or id you copied and pasted the information wrong in your code block…

 

There is a world of difference between:

lastName: N'Murray', 'Cage', 'PE', 'GE', 'DGE']

and

lastName: N'Murray', 'Cage, PE, GE, DGE']

You are suggesting that either Zapier or Phantombuster are putting quotes within the content. 

If the content is actually coming through like the second line I have listed above then you can do some find/replace of 

', '

With something like 

'TTHHHHTTTTHHHT '

And then you can split that array on the “TTHHHHTTTTHHHT” and the commas won’t mess with you. 


Thanks for getting back @Paul.

I understand what is happening here and what I wrote is correct.

I’m trying to implement the solution you proposed however using the text-action as an intermediate step doesn't let you apply it to multiple fields. I can enter all the fields I want to use replace on, into that one “fields to search for replace” text field but then all the data again becomes mixed into one giant array on the output. I can’t add multiple fields to the input like you can with the code tool.

Phantom outputs the data in an ideal format, but as a developer trying to use the Zapier JavaScript action, I would prefer that Zapier didn't touch the data in between and just provided the phantom output object as the JS inputObject, I imagine all developers would agree that the data shouldn't be tampered with.  Instead, Zapier takes phantoms output object and seems to use a split by comma function on it, then provides a bunch of arrays where the strings have been incorrectly split.

Can I post this as a bug somewhere?

Apologies if this sounds blunt - not my intention.


Reply