Formulas allow you to achieve more advanced configurations in Email Composer Helper.
When using Email Composer Helper, you can utilize relations. However, if you need to retrieve a value from a nested relation property (a relation property within another relation property), it is not possible directly. For instance:
Suppose you have the following databases:
You want to insert a customer's shipping address by clicking the "send email" button from a page in the Orders Database. This is not possible with a direct relation setting in Email Composer Helper. However, you can achieve this using a formula.
Click on the newly added formula property to edit it.
Insert the following formula:
prop("Customer").first()
.prop("Shipping Address").filter(current.prop("default")==true)
.first().prop("Address")
Explanation of the Formula:
prop("Customer").first()
: Retrieves the customer related to the order..prop("Shipping Address").filter(current.prop("default")==true)
: Filters the shipping addresses of the customer to find where the default property is true..first().prop("Address")
: Gets the address of the filtered shipping address..first()
is needed to get the first object even if there is only one object.This configuration allows you to insert customer shipping addresses dynamically from nested relations using formulas in Email Composer Helper.
You can see below for working example.
You can learn more about formula in notion official doc.