Using Variables in Motion 2 Notifications to Display the Latest Entry to a Repeatable CRM Entity
When creating a Motion 2 form that is designed to record multiple submissions by the same user, we recommend setting up a CRM Entity with the "multi" setting turned on. When this setting is enabled, each time the user inputs data designated to that CRM entity, a new entry will be added.

When this type of field is set up in a Motion 2 form, it is often helpful to notify the user or an admin of their latest entry. This use case can be accomplished by using entity variables in a Motion 2 notification.
Recommended: the engagement's own entry
To show what was submitted in this engagement, use the engagement_entities variables with merged, which combine the rows this engagement saved and show datagroup values as their labels:
Example: {$RoleName.0.engagement_entities.EntityGroupName.EntityName.merged.field_name}
Numbered rows such as .0 depend on the order of the rows, and a datagroup field read that way prints "Array", so prefer merged. In these variables the entity group name is written without spaces, each word capitalized (for example, a group named Volunteer Application becomes VolunteerApplication).
Alternative: the person's latest entry overall
To show the most recent row the person has across all engagements, count the rows and take the last one:
- Begin creating your notification trigger. Select your variable for the entity field from its repeatable entity:
Example:{$RoleName.0.entities.EntityGroupName.EntityName.0.field_name} - Replace
.0after the entity name with[$RoleName[0].entities.EntityGroupName.EntityName|@count - 1]
Example:{$RoleName[0].entities.EntityGroupName.EntityName[$RoleName[0].entities.EntityGroupName.EntityName|@count - 1].field_name}

After adding each variable, test the form to see if the latest submission to the field is displayed properly in the notification. If the variable is not working, open the HTML editor in the Motion 2 notification and double-check the code for errors. You can also re-paste the variable directly into the HTML editor, as this may correct any additional characters that were breaking the code.
.png)
.png)