Skip to main content

Hi Community - another zap Q! I’m attempting to create a zap where every time an email is sent to a certain inbox it automatically creates an organization in Affinity. 

 

I seem to have gotten most of the zap correct, but I added an AI prompt to remove my email signature when the body content is being pulled into the Affinity note. I tested it within the edited Zap and the AI pull worked, but when I tested with an actual email what showed up in Affinity did not have a note with it. Additionally, I got an error for the zap. 

 

I’m adding screenshots of the zap process, results, and error notification. Any help here would be greatly appreciated!

 

 

Hi ​@LDaring 

Check your Zap Run history to trace the data flow thru each step DATA IN/OUT tabs to help you troubleshoot.

Post screenshots from the Zap Run showing the Zap step with the error. (not the email error notification)

 

FEEDBACK to check

✅ In short: The Zap step is trying to attach a record to a company in Affinity, but the company ID you passed (305727526) isn’t valid inside Affinity.
You’ll need to either fetch the correct Affinity company ID or create the company before linking.

 

The error you’re seeing in your Zap step is coming from Affinity’s API validation:

Error text
Field organization_ids: expected 305727526 to be a valid id for model Affinity::Models::Company: 0 (Affinity::Validator::ModelError)

What it means

  • organization_ids → This is the field in Affinity where you’re trying to link a record to one or more organizations/companies.

  • 305727526 → This is the value your Zap is passing as the organization ID.

  • expected ... to be a valid id for model Affinity::Models::Company → Affinity is checking that the ID you passed exists in their database as a valid company/organization.

  • 0 (Affinity::Validator::ModelError) → Validation failed, so Affinity rejected the request.

Why it happens

  1. The value being passed (305727526) is not actually a valid Affinity company/organization ID.

    • Maybe you’re passing an external system’s ID (e.g., from Shopify, Airtable, or another CRM) instead of Affinity’s internal organization ID.

  2. The Zap step may be mapping the wrong field (e.g., company name or custom field instead of Affinity’s organization_id).

  3. The company might not exist yet in Affinity, so the ID reference is invalid.

How to fix

  • Check your field mapping in Zapier
    Make sure the value you’re sending to organization_ids is an actual Affinity Organization ID (a number assigned by Affinity when the company record was created).

  • Confirm the company exists in Affinity
    If you want to link a record to a company, that company must already exist in Affinity. If not, you’ll need a prior step in the Zap to create the organization first, then use the returned ID.

  • Verify the ID source
    If your Zap is pulling IDs from another system, you may need to add a lookup step (e.g., “Find Organization in Affinity” by name/email domain) to retrieve the correct Affinity organization_id.

 


didnt get any errors that time?

 


Any tips on the AI prompt?

 


Just kidding, when I edit and re-test I get this in the final step?

 


@LDaring 

If the Zap does not have errors during live Zap Runs, then you should be fine.

If you are trying to test the Zap step manually, you may be trying to use a mapped variable with a value for an Affinity Org ID that no longer exists in Affinity.

Make sure to retest each of your Zap steps in order.

 


I noticed when I test run, the org the zap runs in step 8 (era) is not the same email body content in step 9 (AI) or 10 - I think the AI step may be pulling the wrong body content?
 

 


 


@LDaring 

The best way to troubleshoot is to trace the data flow thru the Zap steps whether you are using the Zap Editor and manually testing each step in order or reviewing a live Zap Runs, make sure to check the DATA IN/OUT to help you make sense of how each Zap step is functioning.


Test record:
 

why is this the output with step 2?
 

 


@LDaring 

The output of Zap step 2 depends on how Zap step 2 is configured in the CONFIGURE tab along with the input data, which we would need to see screenshots of.

 


 


@LDaring 

TIP: To help you troubleshoot your Zap steps, you can share screenshots of your Zap step configure, Zap step mapped variable values that are used as inputs, and any errors.

 

TIP: Click field labels to see tooltips with more info about the expected values and formats.

 

What You Configured

  • App: Formatter by Zapier → Text → Extract Pattern

  • Input: The full HTML body content (so it’s scanning everything inside the email or webpage).

  • Pattern: A regex to detect email addresses:

  • Match All: Yes

  • Flags: Multiline (✓), Dotall (✓), Ignorecase (✓)

What Happened

When Formatter runs with Extract Pattern:

  1. It searches through the entire input text using your regex.

  2. Each time it finds a match, it outputs:

    • Output 0 → the actual match (in this case, katie@eranyc.com)

    • Output Start → the character index in the input where the match begins (219)

    • Output End → the character index where the match ends (235)

    • Output Matchedtrue to confirm it found a match

Because you chose Match All = Yes, the output comes back as an array (output → 1 → Output 0...) even though only one match was found. If there had been multiple email addresses, you’d see multiple entries (Output 0, Output 1, etc.).

Why It Looks Like That

So the reason your Step 2 output looks like:

output
1
Output 0 katie@eranyc.com
Output End 235
Output Matched true
Output Start 219

is because Zapier’s Formatter always wraps regex results in that structured object — it doesn’t just return the text string, it returns metadata about the match (the indexes, whether it matched, etc.).

✅ Bottom line: The regex correctly found katie@eranyc.com in your input. Zapier is showing it with start/end positions and “matched: true” because that’s how Extract Pattern is designed to output results. If you only care about the email itself, use Output 0 in later steps.


Reply