Best answer

Is there a way to populate a dictionary dynamically?

  • 26 December 2023
  • 1 reply
  • 65 views

Hi! I’m working on a new action for our integration. The use case is more or less like this:

We require an action that’s going to create a contact in our app. A contact has certain fields (name, email, birth date, etc.). Some of these fields are standard for all customers, and some of them are custom. We have an API that gives us all those fields. The customer is not required to send all the fields, he may use only a subset of them.

What I’m wondering is, what’s the best way to send this data to create a new contact to our API?

I have been trying to use a “dynamic dictionary”, but didn’t have much success so far. My idea was: use a dynamic dropdown for the dictionary key, populating the dropdown with the fields that our API gave us. The  user selects what field he wants to send, and sets the value for that field using the data from a previous step or manually.

Is this the correct approach, or is there a better alternative to solve this? Is there a similar example that I can follow?

Thanks!

icon

Best answer by Osas 16 January 2024, 15:29

View original

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

1 reply

Userlevel 2
Badge +2

Hi @Bruno Conti 
 

You mentioned that “We have an API that gives us all those fields”, so it seems that you have an endpoint that can return all the standard and custom fields from a user’s account, right?

If that is the case, you would have to use dynamic fields to return all the fields from the users’ accounts (both standard and custom). It’s up to the users to send value to any of the fields when setting up the action.

Fields that contain values would be sent along in the API request, and fields without values would automatically be dropped. You do not need to do anything else, or set up dictionary fields for this.

Hope that helps