I have this scenario: we have a firebase database with some data ( let's say some articles ). We'd like to use a "choice" tag or field ( although with field I believe is not possible ) for allowing an editor to select which set of data ( article ) to be used in a template for creating a webpage. For example: we would have a dropdown selector ( generated by a choice tag ) with article titles as options. When the editor selects one of those, the template would use selected set of data.
Is this possible? I tried this code in <head> of the template:
{% require_js %}
<script>
window.choices = ... // async request using fetch to grab and properly format for "choices" the article titles from firebase. An example of the variable content would be: "First article title, Second article title"
</script>
{% end_require_js %}
{% choice "select_article" label="Select Article", choices="{{window.choices}}" export_to_template_context=true %}
but since choice tag is rendered by hubspot systems server side ( and so before the page reaches the browser ), obviously window.choices = null.
Would this be a use case for a serverless function? Not sure if that can be executed server side before page being sent to the client.
@Jaycee_Lewis@xyboox have you considered migrating that content to HubSpot's HubDB? You could also leave the data there but use a serverless function to sync that data to HubDB.