Question

Testing dynamic fields

  • 30 October 2023
  • 5 replies
  • 156 views

Hello,
I have created an action with only one field which is a dynamic field.
I don't know how to do the tests. Unlike the input fields, in the input designer no field appears in the 'zap editor preview':

In the API configuration phase, in step 2 Test your api resquest, no field appears either. Only one field called key appears

 

The code for this dynamic field from the Input Designer step is:

 

// Configure a request to an endpoint of your api that
// returns custom field meta data for the authenticated
// user.  Don't forget to configure authentication!

const options = {
  url: 'https://wtest.xxxx.com/i2mapi/v1_0/getFieldNamesFromElement/0',
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'Authorization': bundle.authData.api_key,
  },
  params: {

  }
}

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

    // modify your api response to return an array of Field objects
    // see https://zapier.github.io/zapier-platform-schema/build/schema.html#fieldschema
    // for schema definition.

    return results.fields;
  });

 

The response is a json object with two fields: 'result' with the result of the API call and 'fields' with the array of json objects describing each of the dynamic fields

 

Gracias por vuestra ayuda,

Carlos


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

For me when using dynamic fields i have to create a Zapp app using the integration in order to see the dynamic fields. It doesnt work in preview or in the api tests. 

The Zapp app has a button to refresh the fields so you can easily refresh it when you make code changes. 

Userlevel 1

I’m struggling with this similar issue. It’s very confusing.

By the way, how do one refer to the selected option based on the dynamic fields and put that to the actual api that utilizes it?

Userlevel 1

Same here, very confusing, I don’t understand why dynamic fields are not available for testing but they are if you make a “real” Zap. In a real Zap, I cannot use z.console.log to inspect some values.

Userlevel 3
Badge +6

Hi @Cyberimpact , 

Thank you for the feedback, and so sorry for the confusion UI here. 

As you hinted, to test dynamic fields, you’ll need to create a real Zap and test the step in the Zap editor.

Your code’s console logs do get invoked from the Zap editor. Those logs should be visible in the Monitoring page.

Userlevel 1

Hi @Cyberimpact , 

Thank you for the feedback, and so sorry for the confusion UI here. 

As you hinted, to test dynamic fields, you’ll need to create a real Zap and test the step in the Zap editor.

Your code’s console logs do get invoked from the Zap editor. Those logs should be visible in the Monitoring page.

It’s sad that this is not documented anywhere. I also noted an other thing that is different when testing an action in the Platform UI design than it is when making a real Zap and I would consider this a bug with Zapier. When testing, bundle.inputDataRaw is not available, but it is when making a real Zap… that took me a while to figure this out. Will this be fixed ? Is there a bug tracking for Zapier somewhere so we could fill bugs ?