---
schema_version: "1"
id: 0a960348502b6c21ee9069ad07481cf897d3b6fec8d3f4fd5553b20bb56b1e5b
title: ActionableNotification.Builder Class
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_class_Messaging_ActionableNotification_Builder.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Messaging_ActionableNotification_Builder.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: ecdb929348b185b0bf7befb36b9e75d781cc4caae4e41d9fc296f8c961e0b525
description: Contains methods to build an instance of the Messaging.ActionableNotification class, which is used to configure actionable notifications for mobile devices.Returns an instance of the Messaging.ActionableNotification class. Sets the unique action identifier (API name) for the custom notification action.Sets the ID of the custom notification type.Sets the user ID of the custom notification recipient.Sets the sender of the custom notification.Sets the record ID for the target record of the notification. The PageReference for the navigation target of the notification.
---
# ActionableNotification.Builder Class

Contains methods to build an instance of the Messaging.ActionableNotification class, which is used to configure actionable notifications for mobile devices.

## Namespace

[Messaging](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_namespace_Messaging.htm "The Messaging namespace provides classes and methods for Salesforce notifications and email functionality.")

## Example

See the example for the [Messaging.ActionableNotification class](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Messaging_ActionableNotification.htm#apex_class_Messaging_ActionableNotification "Contains information about an actionable custom notification.").

- **[ActionableNotification.Builder Methods](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Messaging_ActionableNotification_Builder.htm#apex_Messaging_ActionableNotification_Builder_methods)**

## ActionableNotification.Builder Methods

The following are methods for ActionableNotification.Builder.

- **[build()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Messaging_ActionableNotification_Builder.htm#apex_Messaging_ActionableNotification_Builder_build)**  
    Returns an instance of the Messaging.ActionableNotification class.
- **[withActionIdentifier(actionIdentifier)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Messaging_ActionableNotification_Builder.htm#apex_Messaging_ActionableNotification_Builder_withActionIdentifier)**  
    Sets the unique action identifier (API name) for the custom notification action.
- **[withNotificationTypeId(notificationTypeId)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Messaging_ActionableNotification_Builder.htm#apex_Messaging_ActionableNotification_Builder_withNotificationTypeId)**  
    Sets the ID of the custom notification type.
- **[withRecipientId(recipientId)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Messaging_ActionableNotification_Builder.htm#apex_Messaging_ActionableNotification_Builder_withRecipientId)**  
    Sets the user ID of the custom notification recipient.
- **[withSenderId(senderId)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Messaging_ActionableNotification_Builder.htm#apex_Messaging_ActionableNotification_Builder_withSenderId)**  
    Sets the sender of the custom notification.
- **[withTargetId(targetId)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Messaging_ActionableNotification_Builder.htm#apex_Messaging_ActionableNotification_Builder_withTargetId)**  
    Sets the record ID for the target record of the notification.
- **[withTargetPageRef(targetPageRef)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Messaging_ActionableNotification_Builder.htm#apex_Messaging_ActionableNotification_Builder_withTargetPageRef)**  
    The PageReference for the navigation target of the notification.

### build()

Returns an instance of the Messaging.ActionableNotification class.

#### Signature

public Messaging.ActionableNotification build()

#### Return Value

Type: [Messaging.ActionableNotification](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Messaging_ActionableNotification.htm#apex_class_Messaging_ActionableNotification "Contains information about an actionable custom notification.")

### withActionIdentifier(actionIdentifier)

Sets the unique action identifier (API name) for the custom notification action.

#### Signature

This actionIdentifier must belong to the action group associated with the custom notification.

public Messaging.ActionableNotification.Builder withActionIdentifier(String actionIdentifier)

#### Parameters

- **actionIdentifier**:
    
    Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")
    
    The API name of the action.

#### Return Value

Type: [Messaging.ActionableNotification.Builder](#apex_class_Messaging_ActionableNotification_Builder "Contains methods to build an instance of the Messaging.ActionableNotification class, which is used to configure actionable notifications for mobile devices.")

### withNotificationTypeId(notificationTypeId)

Sets the ID of the custom notification type.

#### Signature

public Messaging.ActionableNotification.Builder withNotificationTypeId(String notificationTypeId)

#### Parameters

- **notificationTypeId**:
    
    Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")
    
    The ID of the custom notification type being used for the notification. A notification type is required to send a custom notification.

#### Return Value

Type: [Messaging.ActionableNotification.Builder](#apex_class_Messaging_ActionableNotification_Builder "Contains methods to build an instance of the Messaging.ActionableNotification class, which is used to configure actionable notifications for mobile devices.")

### withRecipientId(recipientId)

Sets the user ID of the custom notification recipient.

#### Signature

public Messaging.ActionableNotification.Builder withRecipientId(String recipientId)

#### Parameters

- **recipientId**:
    
    Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")
    
    The user ID of the notification recipient.

#### Return Value

Type: [Messaging.ActionableNotification.Builder](#apex_class_Messaging_ActionableNotification_Builder "Contains methods to build an instance of the Messaging.ActionableNotification class, which is used to configure actionable notifications for mobile devices.")

### withSenderId(senderId)

Sets the sender of the custom notification.

#### Signature

public Messaging.ActionableNotification.Builder withSenderId(String senderId)

#### Parameters

- **senderId**:
    
    Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")
    
    The user ID of the sender of the notification. Setting a sender is optional.

#### Return Value

Type: [Messaging.ActionableNotification.Builder](#apex_class_Messaging_ActionableNotification_Builder "Contains methods to build an instance of the Messaging.ActionableNotification class, which is used to configure actionable notifications for mobile devices.")

### withTargetId(targetId)

Sets the record ID for the target record of the notification.

#### Signature

You must specify either a targetID or a targetPageRef.

public Messaging.ActionableNotification.Builder withTargetId(String targetId)

#### Parameters

- **targetId**:
    
    Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")
    
    The ID of the target record.

#### Return Value

Type: [Messaging.ActionableNotification.Builder](#apex_class_Messaging_ActionableNotification_Builder "Contains methods to build an instance of the Messaging.ActionableNotification class, which is used to configure actionable notifications for mobile devices.")

### withTargetPageRef(targetPageRef)

The PageReference for the navigation target of the notification.

#### Signature

You must specify either a targetID or a targetPageRef.

public Messaging.ActionableNotification.Builder withTargetPageRef(String targetPageRef)

#### Parameters

- **targetPageRef**:
    
    Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")
    
    The target page reference as a URL string, for example '/lightning/r/Case/500XXXXXXXXXXXXYAI/view'. For more examples, see pageReference Types.

#### Return Value

Type: [Messaging.ActionableNotification.Builder](#apex_class_Messaging_ActionableNotification_Builder "Contains methods to build an instance of the Messaging.ActionableNotification class, which is used to configure actionable notifications for mobile devices.")