set_api_attribute_value

The set_api_attribute_value function is used only when setting values for an API attribute such as

  • Multi-Select Box using data from an App API call
  • Multiple Checkboxes using data from an App API call
  • Select Menu using data from an App API call

An API attribute gets it's data from an app API and a content template is used to format the data. The content template needs a way to set a value for the field and the set_api_attribute_value function does that.

The content template will get it's data like any other API call. You would loop through the data and format the text value that will show in the field. 

For example, if you have a Multi-Select Box using data from an App API call and the data comes from the Directory app using the profileFilter API. Below is an example set of code for the content template that sets the profile name as the value.

{% for profile in profiles %}
    {% do set_api_attribute_value(profile.id, profile.profileName)
{% endfor %}

Arguments

The set_api_attribute_value function has the following signature. Both attributes are required.

set_api_attribute_value(id, value)

Argument Description
id

The numeric id of the app item. It is the value that is saved when an app item that uses an API attribute field is saved.

value

The text value that will show in the API field to select. It's the text that shows in the select menu or checkbox field.

< Back to the list of functions