UNNotification.SetCalendarTrigger
---------------------------------

Sets a calendar based trigger.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [UNNotification](component_UNNotification.md) | [7.2](newinversion72.md) | ✅ Yes | ❌ No | ❌ No | ❌ No | ✅ Yes |

MBS( "UNNotification.SetCalendarTrigger"; UNNotificationRef { ; Year; Month; Day; Hour; Minute; Second; Repeat } ) 

**MBS**( **"UNNotification.SetCalendarTrigger";** /\* Sets a calendar based trigger. \*/  
**$UNNotificationRef**; /\* The reference number of the notification.e.g. $Notification \*/   
**$Year**; /\* Optional; The year to use.  
Can be empty. \*/   
**$Month**; /\* Optional; The month to use.  
Can be empty. \*/   
**$Day**; /\* Optional; The day to use.  
Can be empty. \*/   
**$Hour**; /\* Optional; The hour to use.  
Can be empty. \*/   
**$Minute**; /\* Optional; The minute to use.  
Can be empty. \*/   
**$Second**; /\* Optional; The second to use.  
Can be empty. \*/   
**$Repeat**) /\* Optional; Whether to repeat.  
Can be 1 to enable or 0 to disable. Default is 0.e.g. 0 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| UNNotificationRef | The reference number of the notification. | $Notification |  |
| Year | The year to use.   Can be empty. |  | Optional |
| Month | The month to use.   Can be empty. |  | Optional |
| Day | The day to use.   Can be empty. |  | Optional |
| Hour | The hour to use.   Can be empty. |  | Optional |
| Minute | The minute to use.   Can be empty. |  | Optional |
| Second | The second to use.   Can be empty. |  | Optional |
| Repeat | Whether to repeat.   Can be 1 to enable or 0 to disable. Default is 0. | 0 | Optional |

### Result

Returns OK or error.

### Description

Sets a calendar based trigger.  
Can be scheduled on the device to notify based on date and time values, and optionally repeat. For example, if a notification should be delivered at the next 8:00 AM then set the 'hour' parameter to 8. If the notification should be delivered every day at 8:00 AM then set repeats to 1.  
  
### Examples

Repeat daily 8am:

 MBS ( "UNNotification.SetCalendarTrigger"; $NotificationRef ; ""; ""; ""; 8; ""; ""; 1 )  
Schedule to show up 10:30 am every day:

 # Create a new notification   
Set Variable \[$notification ; Value:MBS ("[UNNotification.New](UNNotificationNew.md)")\]  
Set Variable \[$r ; Value:MBS ( "[UNNotification.SetTitle](UNNotificationSetTitle.md)"; $Notification ; "Hello World")\]  
\# Set calendar trigger:   
Set Variable \[$r ; Value:MBS ( "UNNotification.SetCalendarTrigger"; $Notification ; ""; ""; ""; 10; 30; ""; 1 )\]  
\# and schedule   
Set Variable \[$r ; Value:MBS ("[UNNotification.Schedule](UNNotificationSchedule.md)"; $notification ; "test")\]  
### See also

- [UNNotification.New](UNNotificationNew.md)
- [UNNotification.Schedule](UNNotificationSchedule.md)
- [UNNotification.SetCalendarDateTrigger](UNNotificationSetCalendarDateTrigger.md)
- [UNNotification.SetLocationTrigger](UNNotificationSetLocationTrigger.md)
- [UNNotification.SetTimeIntervalTrigger](UNNotificationSetTimeIntervalTrigger.md)
- [UNNotification.SetTitle](UNNotificationSetTitle.md)

This function is free to use.

Created 15th April 2017 , last changed 17th April 2017

  
[UNNotification.SetCalendarDateTrigger](UNNotificationSetCalendarDateTrigger.md) - [UNNotification.SetCategoryIdentifier](UNNotificationSetCategoryIdentifier.md)

[HTML Version](UNNotificationSetCalendarTrigger.shtml)