---
schema_version: "1"
id: f5f973c4d666c472141ca453449396f41c63a860e80b4e8d0d7b04ccdce6e9d3
title: QueueableDuplicateSignature.Builder Class
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_class_System_QueueableDuplicateSignature_Builder.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_System_QueueableDuplicateSignature_Builder.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 312ddcabbcef4e0deeb34b2e85778e4e14461dddaa4ecc4988b18fa0e053e9c9
description: Build a unique signature for your queueable job using this inner builder class. The build() class method builds a QueueableDuplicateSignature object, with input from the addId(), addInteger(), and addString() methods. Use the DuplicateSignature property in the AsyncOptions class to store the queueable job signature. Enqueue your job by using the System.enqueueJob() with the AsyncOptions parameter. Adds an ID to build a unique signature for a queueable job. You can then enqueue the job by using the signature as the AsyncOptions parameter to System.enqueueJob(). Adds an integer to build a unique signature for a queueable job. You can then enqueue the job by using the signature as the AsyncOptions parameter to System.enqueueJob().Adds a string to build a unique signature for a queueable job. You can then enqueue the job by using the signature as the AsyncOptions parameter to System.enqueueJob(). Builds a unique signature for a queueable job. You can then enqueue the job by using the signature as the AsyncOptions parameter to System.enqueueJob().Gets the maximum size of the queueable job signature in bytes.Gets the remaining size of the queueable job signature in bytes, after subtracting what is already used by the signature from the maximum allowed number.Gets the size of the queueable job signature in bytes.
---
# QueueableDuplicateSignature.Builder Class

Build a unique signature for your queueable job using this inner builder class. The build() class method builds a QueueableDuplicateSignature object, with input from the addId(), addInteger(), and addString() methods. Use the DuplicateSignature property in the AsyncOptions class to store the queueable job signature. Enqueue your job by using the System.enqueueJob() with the AsyncOptions parameter.

## Namespace

[System](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_namespace_System.htm "The System namespace provides classes and methods for core Apex functionality.")

## Examples

This example builds the async job signature with UserId and the string MyQueueable.

AsyncOptions options = new AsyncOptions();
options.DuplicateSignature = new System.QueueableDuplicateSignature.Builder()
                                .addId(UserInfo.getUserId())
                                .addString('MyQueueable')
                                .build();
try {
    System.enqueueJob(new MyQueueable(), options);
} catch (DuplicateMessageException ex) {
    //Exception is thrown if there is already an enqueued job with the same signature
    Assert.areEqual('Attempt to enqueue job with duplicate queueable signature',
        ex.getMessage());
}

This example builds the async job signature using ApexClass Id and the hash value of an sObject.

AsyncOptions options = new AsyncOptions();
options.DuplicateSignature = new QueueableDuplicateSignature.Builder()
                                .addInteger(System.hashCode(someAccount))
                                .addId(\[SELECT Id FROM ApexClass 
                                     WHERE Name='MyQueueable' WITH USER\_MODE\].Id)
                                .build();
System.enqueueJob(new MyQueueable(), options);

- **[QueueableDuplicateSignature.Builder Methods](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_System_QueueableDuplicateSignature_Builder.htm#apex_System_QueueableDuplicateSignature_Builder_methods)**

#### See Also

- [_Apex Developer Guide_: Detecting Duplicate Queueable Jobs](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexcode.meta/apexcode/apex_dedupe_queueable.htm "Apex Developer Guide: Detecting Duplicate Queueable Jobs - HTML (New Window)")

## QueueableDuplicateSignature.Builder Methods

The following are methods for QueueableDuplicateSignature.Builder.

- **[addId(inputId)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_System_QueueableDuplicateSignature_Builder.htm#apex_System_QueueableDuplicateSignature_Builder_addId)**  
    Adds an ID to build a unique signature for a queueable job. You can then enqueue the job by using the signature as the AsyncOptions parameter to System.enqueueJob().
- **[addInteger(inputInteger)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_System_QueueableDuplicateSignature_Builder.htm#apex_System_QueueableDuplicateSignature_Builder_addInteger)**  
    Adds an integer to build a unique signature for a queueable job. You can then enqueue the job by using the signature as the AsyncOptions parameter to System.enqueueJob().
- **[addString(inputString)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_System_QueueableDuplicateSignature_Builder.htm#apex_System_QueueableDuplicateSignature_Builder_addString)**  
    Adds a string to build a unique signature for a queueable job. You can then enqueue the job by using the signature as the AsyncOptions parameter to System.enqueueJob().
- **[build()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_System_QueueableDuplicateSignature_Builder.htm#apex_System_QueueableDuplicateSignature_Builder_build)**  
    Builds a unique signature for a queueable job. You can then enqueue the job by using the signature as the AsyncOptions parameter to System.enqueueJob().
- **[getMaxSize()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_System_QueueableDuplicateSignature_Builder.htm#apex_System_QueueableDuplicateSignature_Builder_getMaxSize)**  
    Gets the maximum size of the queueable job signature in bytes.
- **[getRemainingSize()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_System_QueueableDuplicateSignature_Builder.htm#apex_System_QueueableDuplicateSignature_Builder_getRemainingSize)**  
    Gets the remaining size of the queueable job signature in bytes, after subtracting what is already used by the signature from the maximum allowed number.
- **[getSize()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_System_QueueableDuplicateSignature_Builder.htm#apex_System_QueueableDuplicateSignature_Builder_getSize)**  
    Gets the size of the queueable job signature in bytes.

### addId(inputId)

Adds an ID to build a unique signature for a queueable job. You can then enqueue the job by using the signature as the AsyncOptions parameter to System.enqueueJob().

#### Signature

public System.QueueableDuplicateSignature.Builder addId(Id id)

#### Parameters

- **inputId**: Type: [Id](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_id.htm#apex_methods_system_id "Contains methods for the ID primitive data type.")

#### Return Value

Type: [QueueableDuplicateSignature.Builder](#apex_class_System_QueueableDuplicateSignature_Builder "Build a unique signature for your queueable job using this inner builder class. The build() class method builds a QueueableDuplicateSignature object, with input from the addId(), addInteger(), and addString() methods. Use the DuplicateSignature property in the AsyncOptions class to store the queueable job signature. Enqueue your job by using the System.enqueueJob() with the AsyncOptions parameter.")

### addInteger(inputInteger)

Adds an integer to build a unique signature for a queueable job. You can then enqueue the job by using the signature as the AsyncOptions parameter to System.enqueueJob().

#### Signature

public System.QueueableDuplicateSignature.Builder addInteger(Integer i)

#### Parameters

- **inputInteger**: Type: [Integer](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_integer.htm#apex_methods_system_integer "Contains methods for the Integer primitive data type.")

#### Return Value

Type: [QueueableDuplicateSignature.Builder](#apex_class_System_QueueableDuplicateSignature_Builder "Build a unique signature for your queueable job using this inner builder class. The build() class method builds a QueueableDuplicateSignature object, with input from the addId(), addInteger(), and addString() methods. Use the DuplicateSignature property in the AsyncOptions class to store the queueable job signature. Enqueue your job by using the System.enqueueJob() with the AsyncOptions parameter.")

### addString(inputString)

Adds a string to build a unique signature for a queueable job. You can then enqueue the job by using the signature as the AsyncOptions parameter to System.enqueueJob().

#### Signature

public System.QueueableDuplicateSignature.Builder addString(String s)

#### Parameters

- **inputString**: 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.")

#### Return Value

Type: [QueueableDuplicateSignature.Builder](#apex_class_System_QueueableDuplicateSignature_Builder "Build a unique signature for your queueable job using this inner builder class. The build() class method builds a QueueableDuplicateSignature object, with input from the addId(), addInteger(), and addString() methods. Use the DuplicateSignature property in the AsyncOptions class to store the queueable job signature. Enqueue your job by using the System.enqueueJob() with the AsyncOptions parameter.")

### build()

Builds a unique signature for a queueable job. You can then enqueue the job by using the signature as the AsyncOptions parameter to System.enqueueJob().

#### Signature

public System.QueueableDuplicateSignature build()

#### Return Value

Type: [QueueableDuplicateSignature Class](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_System_QueueableDuplicateSignature.htm#apex_class_System_QueueableDuplicateSignature "Used in the AsyncOptions class to store the queueable job signature in the DuplicateSignature property.")

### getMaxSize()

Gets the maximum size of the queueable job signature in bytes.

#### Signature

public Integer getMaxSize()

#### Return Value

Type: [Integer](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_integer.htm#apex_methods_system_integer "Contains methods for the Integer primitive data type.")

### getRemainingSize()

Gets the remaining size of the queueable job signature in bytes, after subtracting what is already used by the signature from the maximum allowed number.

#### Signature

public Integer getRemainingSize()

#### Return Value

Type: [Integer](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_integer.htm#apex_methods_system_integer "Contains methods for the Integer primitive data type.")

### getSize()

Gets the size of the queueable job signature in bytes.

#### Signature

public Integer getSize()

#### Return Value

Type: [Integer](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_integer.htm#apex_methods_system_integer "Contains methods for the Integer primitive data type.")