Skip to main content

Hi,

I have a scenario that in my input form there is a form with fields Application ID, Entity Name and Entity Type:

Here App ID and Entity Name are static field BUT Entity Type is a dynamic field(or Entity Type Dropdown). Entity Type will get Entity Types from a service. For service there is requirement to have AppId in header to get entity types of specific application so here I am trying to use: 'appId': '{{bundle.inputData.app_id}}'.

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

const options = {
url: 'https://myserver.com:91/api/db/GetAllEntitiesOfDb',
method: 'GET',
headers: {
'Accept': 'application/json',
'appId': '{{bundle.inputData.app_id}}'
},
params: {

}
}

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

for(const en in results.data){
entities.push(en.Entity);
}

let result = {
key: 'entity_type',
choices: entities
};

// 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 [result];
});

 

So when user will enter App ID in form same App ID will be required to get entity list from service, note that I have also enabled ‘Alter Dynamic Field’ check in App ID but this whole thing is not working Dynamic Field is not appearing. Please let me know what I am missing. Please let me know if further details are required.

 

Thanks,
Mustafa

You don’t need curly braces or quotes on the line:

 

'appId': '{{bundle.inputData.app_id}}'

 

It’s an actual JavaScript reference in this context. Give that a shot and see if that doesn’t get you up and running. If not, post some logs from that request and that’ll shed some light on what’s going wrong. 

 

Also, usability design topic unrelated to this issue. When you ask a user to map an ID field, make sure that that is a value that’s going to be present in any triggering app’s data. You’ll likely need to add a search action to allow the user to configure a Zap to lookup this value by some other value that is known to other systems.  For instance an HR system that had a trigger requiring a employee id would likely need a search action to get that id by, say, email address or name because other software is not likely to be passing in an employee id value in its trigger.  


Hi @Zane ,

Thanks for your reply. Actually problem I am facing is not be able to configure the scenario which I want please see the image below, see if it is possible to do in Zapier:

 

 

As you are seeing that initially there will be only 1 field App ID, user will enter App ID then Entity Type drop down will appear and upon selecting particular Entity Type like Account; all the field related to Account entity will appear.

Yes you are right App ID should not be entered by User I will change it to searchable field later. My current scenario is more important than this.

Please let me know if further details are required.

Thanks,

Mustafa


You might confirm `altersDynamicFields` is true on all of the governing fields. ie. field that when the users changes the value, each dynamic field should refresh their values (by rerunning the dynamic field function)

Then make sure that your dynamic field is returning an array of field elements as defined by the schema. https://zapier.github.io/zapier-platform-schema/build/schema.html#fieldschema Sounds like you might have multiple API requests and some conditional logic to implement within that dynamic field function, so it might get a little complex.   

Also see https://zapier.github.io/zapier-platform/#customdynamic-fields