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.

Screenshot CRM entity

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, with some specific modifications:

1. Begin creating your notification trigger. Select your variable for the entity field from its repeatable entity:

Example: {$RoleName.0.entities.Entity_Group_1.EntityName.0.field_name}

2. Replace .0 with [$RoleName[0].entities.Entity_Group_1.EntityName|@count - 1]
Example: {$RoleName.0.entities.Entity_Group_1.EntityName[$Role[0].entities.Entity_Group_1.EntityName|@count - 1].field_name}

Screenshot Notification

After each field and 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. 

Modified on Fri, 29 Sep 2023 at 11:09 AM

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article

Make sure these features are added to your Site Stacker installation by learning how to run updates here!