Best answer

Can dictionary key's be pulled from a trigger?

  • 21 March 2021
  • 3 replies
  • 24 views

Is it possible to have the keys for a dictionary type to be values retrieved via a trigger?

 

Use Case: Perform a GET for preset values which are presented to the user when specifying a dictionary key.

icon

Best answer by Zane 22 March 2021, 18:10

I believe dynamic fields are going to be your best option here.

View original

3 replies

Userlevel 5
Badge +9

I believe dynamic fields are going to be your best option here.

Our current integration offers 5 questions and answers to be added but some customers have requested for more than 5. We would like to allow for an unknown number of questions and answers to be submitted.

The dictionary input appears to be the only one that supports a dynamic collection of questionIds and answerIds to be submitted. Which would be ideal, if the available dictionary keys could be driven by a dropdown list that derives it’s values (questionIds) from an API request.

As some of our clients have many defined questions, I would prefer an approach that avoids death by a thousand fields.

Userlevel 5
Badge +9

I think the best option for what it sounds like you want to accomplish is to use dynamic fields.  This is precisely what that feature is for! And rather than presenting those as a dictionary, you can retrieve custom field definitions from your API and render them as normal input fields. Rather than using a trigger for the purpose you write a function make the request to your API and return one or more field definitions

I posted an example the other day here

Let us know if you have any questions getting that set up.

Reply