Dynamic Parameters

Dynamic parameters allow you to pass along variable values when using a custom function. You can then configure fields within a button, form, or pop-up form component to populate the values for a dynamic parameter. 


Internal will create a dynamic parameter out of the Javascript expressions used when you defined a custom function (either HTTP or DB). Whenever you create a dynamic parameter, you’ll see it appear in the list of Parameters at the bottom of the modal. You can choose what type of data the parameter is — this will affect what inputs are considered valid when using this function in a Space. 


When you create a custom function, you can use dynamic parameters within certain fields:

Custom functions (DB)

When defining what value to “set” for a particular attribute, you can use a dynamic parameter. 

You can also use a dynamic parameter as the comparison value for a filter.

Custom functions (HTTP)

For HTTP functions, parameters can be used within the following areas: path, URL parameters, headers. The body also creates parameters out of any Javascript expressions within it.


Special handling cases for template literal

There are certain exceptions to the way Internal handles converting to template literal. For the following cases, Internal does not auto-quote and will simply send the value through:

  • null
  • "quoted value in double quotes"
  • 'quoted value in single quotes'
  • `quoted value in backticks`

Examples

Entering null would be passed through as null .

Entering "sample value" would be passed through as "sample value", but entering "sample value would be passed through as `"sample value` . In this case the backticks are removed once Internal recognizes that the parameter is enclosed in double quotes.

Using dynamic parameters in components

After you’ve created a custom function with parameters, you can configure components to provide the values for each dynamic parameter. When creating a component (like a form or a button), select the data source and custom function you created. 


Then, in the Fields tab, you can set configuration options to determine where the values for each parameter will come from. 


Example:

  • You can set the value for the dynamic parameter priceValue to come from a filter component, so that any value the user enters in that component will be passed along as the parameter for the function
  • You can set the value for the dynamic parameter orderID to come from the “order ID” column in a user-selected row in your Orders table. This makes it so that a user just needs to select the right row in your Orders table and the corresponding “order ID” will be passed along as the parameter for the function.
  • You can set the value for dynamic parameter userID to be an automatically generated UUID.