Skip to main content

Hello, 

 

I’ve created a Custom Action to get a string of text from a 3rd party app.

When I test the custom action it works (see below - text value is in the green box)
 

 

 

But when I go back to the Zap the test returns nothing (see below - te text should be in the orange box)

 

 

Any idea of what I’m doing wrong?

Thanks in advance for the help!

Ben
 

@Starburst are you sure you’re using the correct version of the Custom Action in your Zap? There’s a version selector field in the configuration tab. 


Wait, ignore my previous comment - I was thinking Functions, not Custom Actions. Can you share more context on your custom action and what it’s meant to do, what data is being passed in, etc.?


Hi Dennis,

 

Sure, the Custom Action is supposed to:

  1. Fetch all the notes (string array) in my CRM for a given company id (data in)
  2. Output all the notes (data out). I’ve tried to pass it as an array of strings or as a concat string. Both work in the Custom Action test window. 

​​​​​​The Custom Action when put inside the Zap process, given the same test data as when testing the Custom Action itself, doesn’t output anything (the blank result in screenshot #2).

Thanks for your help in advance!


Hi ​@Starburst 

Which CRM app are you using for the Custom Action? (name)

 

Try copy/pasting the code into ChatGPT to review to see if there are any logic errors.


Hey Troy, thanks

The CRM is Affinity.

The code below works well when I test it.
 

// Fetch ALL notes linked to an organisation and return only the note bodies
export async function getNotesByOrganizationId(
{ organizationId }: { organizationId: number }
): Promise<string[]> {
const contents: string[] = [];
let nextPageToken: string | undefined;

do {
const params = new URLSearchParams({
organization_id: organizationId.toString(),
page_size: '500', // max allowed
...(nextPageToken && { page_token: nextPageToken })
});

const url = `https://api.affinity.co/notes?${params.toString()}`;
const response = await fetchWithZapier(url);
await response.throwErrorIfNotOk();

const { notes, next_page_token } = await response.json();

// grab just the `content` field from every note object
contents.push(
...notes
.map((n: { content: string | null }) => n.content) // keep type-safety
.filter((c): c is string => !!c) // drop null / empty
);

nextPageToken = next_page_token ?? undefined;
} while (nextPageToken);

return contents.join('\n\n'); // string
}

 


@Starburst 

Did you manually edit the Custom Action code or was it all done via AI?

 

Perhaps try creating a different Custom Action to see if that works.
 


Hi, I did modify the custom action, but the test works. Isn’t it what should matter?

I’ve tried creating 3 other custom actions with detailed instructions to perform the same task and ran into API key errors everytime (while it’s managed by Zapier - and that the key is correct).


@Starburst 

If you tried using the same value for testing and live in the Custom Action and got different results, then I’d recommend reaching out to Zapier Support to direct the issue to the Custom Action team: https://zapier.com/app/get-help


Hi there, ​@Starburst! 👋

Just came across this and wanted to check how you’re getting on. I had a look on this end but couldn’t find any recent tickets opened with the Support team about this. Were you since able to get the custom action working?

Want to make sure you’re all set here, so please keep us posted on your progress! 🙂