# Step 4: Add Triggering Logics

**URL:** <https://forum.avicennaresearch.com/t/step-4-add-triggering-logics/1215>\
**Category:** Getting Started\
**Created:** [June 11, 2025, 10:01am UTC](https://forum.avicennaresearch.com/t/step-4-add-triggering-logics/1215 "2025-06-11T10:01:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zahra](https://forum.avicennaresearch.com/letter_avatar_proxy/v4/letter/z/aeb1de/32.png) [@zahra](https://forum.avicennaresearch.com/u/zahra)\
**Post date:** [June 11, 2025, 10:01am UTC](https://forum.avicennaresearch.com/t/step-4-add-triggering-logics/1215/1 "2025-06-11T10:01:12Z")

</div>

In the previous section, we added an Activity to our study. Participants could respond to this Activity by tapping on its button on the home screen of their app. They could do it as many times as they wanted, and any time they wanted.

In some cases, this is ideal, for example, if we are asking participants to report anything that motivates them to exercise. But in many cases, we may have certain conditions on when the Activity should be presented to the participants, how often it should be presented, and how much time participants have to complete the Activity. The logic that defines these is called `Triggering Logics`.

Our previous Activity, `Exercise Motivations`, used a _User Triggering Logic_. It means participants decide when and how many times to trigger the Activity. That’s why the button for the Activity is always on the home screen of the app.

Avicenna supports other types of Triggering Logics as well. For example, a _Time Triggering Logic_ prompts the Activity based on a certain timetable. Another example is the _Proximity Triggering Logic_ which prompts the Survey based on Bluetooth-based sensor data. Or _Geo-fence Triggering Logic_ which uses GPS data for prompting a given Activity.

You can read more about this in the [Study Activity](https://forum.avicennaresearch.com/t/activities/1237/1) documentation. Here we continue our example study by adding a Survey Activity to it which is prompted _once a day_ at _7 pm_ and asks about their general health.

To do this, we again go to the Activities page on the Researcher Dashboard and click on `Create New Activity` to create a new Survey. We call the Survey _Quality of Life_. In the Activity Editor remove the content in the description and delete the default User Triggering Logic.

 ![getting-started-triggering-logics-activity-editor](https://forum.avicennaresearch.com/uploads/default/original/1X/04dbdf7c0f728695abe1783258653da264de5cfb.png)

Then, in the Triggering Logic section, click on `Time` to add a new Time Triggering Logic.

This dialog has many settings and we don’t plan to go through all of them here. But we encourage you to read the details in the [Triggering Logics](https://forum.avicennaresearch.com/t/triggering-logics/1238/1) section.

For our use case here, we set the `Time Format` to `Relative` and `Base Time` to `Study Registration Date`. This way, all the calculations will be based on the midnight before the participant joined the study. For example, whether the participant joins at 10 am or 5 pm on Nov. 11th, the calculations will be based on Nov. 11th at 00:00.

We also set the `First Trigger` to be on Day 1 at 19:00:00. We further set it to repeat once a day for 14 days. The image below shows the settings of our Triggering Logic.

 ![getting-started-triggering-logics-configuring-time-triggering-logic](https://forum.avicennaresearch.com/uploads/default/original/1X/9743eac40cabe1aa2f123b72c8f0768ac176ccf6.png)

Now if you click on the `Test The Schedule` button, you can try out how Avicenna will calculate the Activity prompt time based on this setting. You can choose a date and time to represent a participation start time of a hypothetical participant, and Avicenna shows what time our Survey will be presented.

For example below you can see that based on our settings, if a participant joins on Feb., 26th, at 9:15, they will receive Surveys on Feb., 27th at 19:00, Feb., 28th at 19:00, and so on.

 ![getting-started-triggering-logics-time-triggering-logics-schedule](https://forum.avicennaresearch.com/uploads/default/original/1X/9e46a3bddffc66137ea8ecca153255faa2a71e12.png)

Now if you click on the Save button in the Triggering Logic dialog, the new Triggering Logic is saved in our Survey.

## Notifications and Expiry

Avicenna by default does not prompt any notification when an Activity is prompted. You need to create your _Notification Template_ and link it to your Activity as well. This will be explained in the [Notifications](https://forum.avicennaresearch.com/t/step-5-create-notification-templates-to-keep-participants-and-researchers-informed/1216/1) section.

If you need to know more advanced details on this matter, please refer to the [Notification](https://forum.avicennaresearch.com/t/notifications/1277/1) article as it will teach you how to create a Notification Template and link it to your Activity.

After linking the Notification Template to your Activity, we also want to give 1 hour to participants to complete each session of the Survey. If they don’t complete a session within this 1 hour, we want it to be expired. To do so, go back to the `Contents` page and open the `Settings` tab on the lower right side of the screen. At the bottom of the Settings find the `Expiry Time` option, and set it to _After 60 minutes._

 ![getting-started-triggering-logics-expiry-time-for-survey](https://forum.avicennaresearch.com/uploads/default/original/1X/3b13a265d7ff8696c45760e93bfde19216142b95.png)

## Finishing the Survey

In the last step, we add questions to our Survey. As this is about the quality of health, we use a horizontal [Visual Analog Scale (VAS)](https://forum.avicennaresearch.com/t/questions/1291#p-2918-visual-analog-scale-vas-53) as shown below:

 ![getting-started-triggering-logics-adding-questions-activity-editor](https://forum.avicennaresearch.com/uploads/default/original/1X/d3055acf17e16129d6de4708dd73b8794270c158.png)

Then we finish by publishing the Survey. When the Survey is published, Avicenna reloads the device for our current participants and schedules the Survey sessions for them every day at 7 pm.

## Checking Scheduled Sessions

Unlike User Triggering Logic, if you check the app as a participant, you will not see any Survey waiting for your response. This is because the first Survey is supposed to be prompted at 7 pm, and be available for 1 hour. You will receive a notification at 7 pm when the Survey is available.

But you can check the schedule Avicenna has for this participant via the `Activity Sessions` page. So let’s go back to the Researcher Dashboard and click on `Activity Sessions`. Then choose our participant from the list, and from the list of Activities, choose the Survey we just created:

 ![getting-started-triggering-logics-scheduled-surveys](https://forum.avicennaresearch.com/uploads/default/original/1X/34f10c9a82d1b403b695cd7b2a8d0188adc2e606.png)

As you can see above, the participant starts receiving the Survey every day at 7 pm, starting from Day 1, and none of those Surveys are responded to yet. As the participant completes these Surveys, the status of these sessions is updated here.

> [!info]  
> Note that in some cases, the first prompt for the participants might start from day 2. This happens when participants join the study before a survey is added to the study, i.e. if by the time that you add a survey to your study, the participant is already on his or her second day of the study, Avicenna will prompt the survey from the second day.

[Previous Your First Survey](https://forum.avicennaresearch.com/t/step-3-create-your-first-survey/1214/1)[Next Notifications](https://forum.avicennaresearch.com/t/step-5-create-notification-templates-to-keep-participants-and-researchers-informed/1216/1)
