Skip to main content
Best answer

How do I get the name of a Dynamic dropdown selected field in another trigger.

  • August 13, 2024
  • 2 replies
  • 46 views

I have a trigger with the inputs:
 

...
{
key: 'client_id',
type: 'string',
required: true,
label: 'Client Id',
dynamic: 'client_ids.id.name',
list: false,
altersDynamicFields: true,
},
{
key: 'merchant_id',
type: 'string',
required: true,
label: 'Merchant Id',
dynamic: 'merchant_ids.id.name',
list: false,
altersDynamicFields: false,
}
...

I have a client_ids trigger returning the following to populate the dropdown:

[

{id: 1, name: ‘one},

{id: 2, name: ‘two},

]

 

In merchant_ids trigger I want to get the name of the field selected from the client_id dropdown."

 

When I do bundle.inputData.client_id I get the id.

 

Is there a way to get the name ?

Best answer by Osas

Hi @hectorconceicao,

You have 2 options here depending on what you want to achieve.

 

  1. If you want the name to be sent on the trigger’s API request instead of the ID, then the `dynamic` value in the input fields should be 'merchant_ids.name.name' and 'client_ids.name.name' respectively.
     
  2. If the ID should be sent in the trigger’s API request but you need the names as well to be used in the trigger’s code, then you would have to send API requests to fetch the client and merchant names using the provided IDs (this depends on if your API can return a client or merchant based on the provided ID). Note that every trigger code and API requests need to be resolved within 30 seconds as seen here: https://platform.zapier.com/build/operating-constraints
     

Hope that helps?

Cheers,

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

2 replies

Forum|alt.badge.img+3
  • Zapier Staff
  • Answer
  • August 14, 2024

Hi @hectorconceicao,

You have 2 options here depending on what you want to achieve.

 

  1. If you want the name to be sent on the trigger’s API request instead of the ID, then the `dynamic` value in the input fields should be 'merchant_ids.name.name' and 'client_ids.name.name' respectively.
     
  2. If the ID should be sent in the trigger’s API request but you need the names as well to be used in the trigger’s code, then you would have to send API requests to fetch the client and merchant names using the provided IDs (this depends on if your API can return a client or merchant based on the provided ID). Note that every trigger code and API requests need to be resolved within 30 seconds as seen here: https://platform.zapier.com/build/operating-constraints
     

Hope that helps?

Cheers,


@Osas Thank you for your response.