Association Labels inside Hubl markup

Hi support, I’d like to know if I’m able to read association labels inside the hubl markup. I have the following scenario,
I’ve created a custom crm object named “Events” to which users in the CRM get associated. When creating the association I also add a label for example “Invited - accepted” or “Invited - declined”. I would like to use these labels to do some logical flow inside the hubl template…
Is this possible?

Hi @MartinN7 ,

You can use the crm_associations function to retrieve the associated ‘events’ of your contact. In this HubL function, you need to pass the association type ID and category, which means you can easily retrieve all events with a specific label. In this case, it’s probably the easiest to retrieve the associated records per label:

{% set accepted = crm_associations(<contactID>, 'USER_DEFINED', <assocationTypeID>, 'property1,property2', false) %}
{% set declined = crm_associations(<contactID>, 'USER_DEFINED', <assocationTypeID>, 'property1,property2', false) %}

The association type ID can be found in the CRM Objects Schema API.

Thank you Teun, I managed to get it working with your answer above. Much appreciated!