Question

Zap works perfectly except not delivering dynamic field data to server when testing action

  • 21 January 2023
  • 3 replies
  • 71 views

This post has been edited by a moderator to remove personal information. Please remember that this is a public forum and to remove any sensitive information prior to posting.

I created a new Action for the first time using dynamic fields. Testing that and my Zap appears to be working perfectly, right up to the point where some of the data fields are not being delivered to the server.

I am using a webhook as the trigger, and test data is being delivered correctly to the trigger test.

My action captures that data, all fields are mapped properly, as you can see in the attached picture. But then when I test the action and look at the data delivered to the server, some of the fields are missing.

The missing data comes from dynamic fields, so I assume that's my problem, but the action shows all of the expected key/value fields properly. How can it display all of that properly, but then not deliver the data to the server? I’m not sure where to look for the problem since the tests all show the proper data.

Any help appreciated, but please don’t bother pointing me to the documentation for dynamic fields. I have read all that and still don’t see what’s missing since all of the tests work.

 

 

 

 


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

3 replies

Userlevel 7
Badge +14

FYI: Related article and see comments for context.

 

OK, so over the weekend I solved the problem. I will post my solution here in case anyone is following in my footsteps and runs into the same issue.

The problem seems to be that when using dynamic fields in an Action, you can’t use the “Form Mode” when configuring the Action’s “API Configuration.” The “Form Mode” only lists the non-dynamic data fields. You have to switch to “Code Mode.” I’m sure the documentation for dynamic fields says that somewhere, somehow, but I didn’t see it or understand what it was telling me.

As soon as you click on “Switch to Code Mode” it will generate some code for you, but that code only lists the standard “non-dynamic” data fields. I have included my final code below. What I did was replace the body section it had generated for me with that one line which returns all of the data, including the dynamic fields.

Now my Action is working perfectly, and I have learned some new Zapier skills. Hope this saves someone else from a lot of frustration.

const options = {
  url: 'https://my_url_goes_here',
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'X-API-KEY': bundle.authData.api_key
  },
  params: {

  },
  body: {
    'zapdata':bundle.inputData   <<<---- I replaced what was generated automatically with this
  }
}

return z.request(options)
  .then((response) => {
    response.throwForStatus();
    const results = response.json;

    // You can do any parsing you need for results here before returning them

    return results;
  });

Userlevel 4
Badge +9

Hi @Blackpool 👋

Thanks very much for sharing your detailed solution here, the Community appreciates it 🎉

You’re quite right that using Code Mode is necessary when including dynamic fields in API Calls: https://platform.zapier.com/docs/input-designer#how-to-include-dynamic-fields-in-api-calls 

In the default Form Mode, clicking Show Options allows you to see what is being included in a call: