Best answer

Extract one ID from output to use in next step

  • 20 October 2020
  • 5 replies

Userlevel 1

Hi all,

I’m using Zapier to integrate HubSpot CRM and Pipedrive. I’m currently working on a Zap that triggers from a new deal in HubSpot to create a new deal in Pipedrive. I am also trying to create and associate companies and contacts that are attached to the deal in HubSpot in Pipedrive.

Everything works great as long as there are 1:1:1 relationships between the objects, but a problem arises when there are multiple contacts associated with the deal in HubSpot. In order to get the HubSpot contact data to create a Pipedrive person, I’m using a Zap step to Find Associations in HubSpot, which gives me the following output:

0: 80891751
1: 108876301

These are IDs of contact records in a HubSpot account, so it’s giving me the information I want. However, if I try to use this output in the step to GET the contact record, the request includes both IDs, formatted as “80891751,108876301”. Because HubSpot is expecting only one string of numbers for an ID, it errors , doesn’t get any records, and my Zap can’t move forward.

So, I’m trying to figure out how to extract only the first string of numbers. Ideally, I want Zapier to break on the comma and give me only the first string to use in the following GET step.

I had hoped I could use a Formatter by Zapier step for this, but I haven’t figured out how to only get the first string. All of the options I’ve played with still end up with an output of both IDs together, and HubSpot won’t search for more than one ID at a time. (The specific error is, “Object not found. objectId are usually numeric.”)

I can’t use the formatter options based on length, since the ID number length can change, and even if I try to segment on the comma into separate fields, the output is:



Item 1: 80891751

Item 1: 108876301

...and when I try to use that in the following step, it still is “Output Item 1: 80891751, 108876301”


How do I get Zapier to only produce an output of the first string of numbers, up to the comma? i.e. “Output Item 1: 80891751”



Best answer by CraigNet3 21 October 2020, 23:42

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

5 replies

Userlevel 4
Badge +4

Hi @kaitscott, if you only want the first item, you can still use formatter. All you have to do is use the split text function, using comma as the separator, and return the first segment. Example:

And the Result:

Does that work?

Userlevel 1

Thanks @CraigNet3, that’s exactly what I was looking for. Cheers!

Userlevel 1

Hi @CraigNet3, I knew I should have tried this before replying :laughing:

I’ve set up my Split the same way you did in your screenshot:


But am still getting both strings in the output:


So the Zap is correctly recognizing where to split, but still giving me both values in the output. Any idea how to adjust that?

Userlevel 7
Badge +11

Hi @kaitscott!

In this case, you’re trying to use the Split Text function on line items (you can tell because of the 0 and 1 before the IDs). Those behave differently than text, because even though you see a comma separating the two, it’s not quite the same as plain text.

You can instead use the Line-item to Text function of our Formatter app (within the Utilities category of Formatter), and that will provide you with something like this:

You can use those outputs to get the part(s) you need :)

Userlevel 1

Thanks @nicksimard, this did what I was after. Cheers!