UNNotification.SetBadge
-----------------------

Sets the badge number.

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

MBS( "UNNotification.SetBadge"; UNNotificationRef; Badge ) 

**MBS**( **"UNNotification.SetBadge";** /\* Sets the badge number. \*/  
**$UNNotificationRef**; /\* The reference number of the notification.e.g. $Notification \*/   
**$Badge**) /\* The new badge number.  
Can be empty to clear.  
Can be zero to remove badge.  
Or a number to set. \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| UNNotificationRef | The reference number of the notification. | $Notification |
| Badge | The new badge number.   Can be empty to clear.   Can be zero to remove badge.   Or a number to set. |  |

### Result

Returns OK or error.

### Description

Sets the badge number.  
### Examples

Test badge property:

 # Create a new notification   
Set Variable \[$notification ; Value:MBS ("[UNNotification.New](UNNotificationNew.md)")\]  
\# set a badge   
Set Variable \[$r ; Value:MBS ("UNNotification.SetBadge"; $notification ; 123)\]  
\# and query back   
Set Variable \[$value ; Value:MBS ("[UNNotification.Badge](UNNotificationBadge.md)"; $notification )\]  
\# free memory   
Set Variable \[$r ; Value:MBS ("[UNNotification.Release](UNNotificationRelease.md)"; $notification )\]  
### See also

- [UNNotification.AddImage](UNNotificationAddImage.md)
- [UNNotification.Badge](UNNotificationBadge.md)
- [UNNotification.New](UNNotificationNew.md)
- [UNNotification.Release](UNNotificationRelease.md)
- [UNNotification.Repeats](UNNotificationRepeats.md)
- [UNNotification.Schedule](UNNotificationSchedule.md)
- [UNNotification.SetBody](UNNotificationSetBody.md)
- [UNNotification.SetScript](UNNotificationSetScript.md)
- [UNNotification.SetSound](UNNotificationSetSound.md)
- [UNNotification.SubTitle](UNNotificationSubTitle.md)

This function is free to use.

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

  
[UNNotification.SetActionScript](UNNotificationSetActionScript.md) - [UNNotification.SetBody](UNNotificationSetBody.md)

[HTML Version](UNNotificationSetBadge.shtml)