Newer Version Available

This content describes an older version of this product. View Latest

PlatformEventSubscriberConfig

Represents configuration settings for a platform event Apex trigger, including the batch size and the trigger’s running user. This object is available in API version 51.0 and later.

Supported SOAP API Calls

create(), delete(), describeSObjects(), query(), retrieve(), update(), upsert()

Supported REST API Methods

DELETE, GET, HEAD, PATCH, POST, Query

Fields

Field Details
BatchSize
Type
int
Properties
Create, Filter, Group, Nillable, Sort, Update
Description
A custom batch size, from 1 through 2,000, for the platform event Apex trigger. The batch size corresponds to the maximum number of event messages that can be sent to a trigger in one execution. The default batch size is 2,000 for platform event triggers.
We don't recommend setting the batch size to 1 to process one event at a time. Small batch sizes can slow down the processing of event messages.
DeveloperName
Type
string
Properties
Create, Filter, Group, Sort, Update
Description
The unique name for the PlatformEventSubscriberConfig object.
This name can contain only underscores and alphanumeric characters, and must be unique in your org. It must begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores. This field is automatically generated, but you can supply your own value if you create the record using the API.

When creating large sets of data, always specify a unique DeveloperName for each record. If no DeveloperName is specified, performance can slow down while Salesforce generates one for each record.

Note

Only users with View DeveloperName OR View Setup and Configuration permission can view, group, sort, and filter this field.

Note

Language
Type
picklist
Properties
Create, Defaulted on create, Filter, Group, Nillable, Restricted picklist, Sort, Update
Description
The language of PlatformEventSubscriberConfig.
Possible values are:
  • da—Danish
  • de—German
  • en_US—English
  • es—Spanish
  • es_MX—Spanish (Mexico)
  • fi—Finnish
  • fr—French
  • it—Italian
  • ja—Japanese
  • ko—Korean
  • nl_NL—Dutch
  • no—Norwegian
  • pt_BR—Portuguese (Brazil)
  • ru—Russian
  • sv—Swedish
  • th—Thai
  • zh_CN—Chinese (Simplified)
  • zh_TW—Chinese (Traditional)
ManageableState
Type
ManageableState enumerated list
Properties
Filter, Group, Nillable, Restricted picklist, Sort
Description
Indicates the manageable state of the specified component that is contained in a package:
  • beta
  • deleted
  • deprecated
  • deprecatedEditable
  • installed
  • installedEditable
  • released
  • unmanaged
MasterLabel
Type
string
Properties
Create, Filter, Group, Sort, Update
Description
Label for PlatformEventSubscriberConfig. In the UI, this field is Platform Event Subscriber Configuration.
NamespacePrefix
Type
string
Properties
Filter, Group, Nillable, Sort
Description
The namespace prefix that is associated with this object. Each Developer Edition org that creates a managed package has a unique namespace prefix. Limit: 15 characters. You can refer to a component in a managed package by using the namespacePrefix__componentName notation.

The namespace prefix can have one of the following values.

  • In Developer Edition orgs, NamespacePrefix is set to the namespace prefix of the org for all objects that support it, unless an object is in an installed managed package. In that case, the object has the namespace prefix of the installed managed package. This field’s value is the namespace prefix of the Developer Edition org of the package developer.
  • In orgs that are not Developer Edition orgs, NamespacePrefix is set only for objects that are part of an installed managed package. All other objects have no namespace prefix.
PlatformEventConsumerId
Type
reference
Properties
Create, Filter, Group, Sort, Update
Description
The ID of the platform event Apex trigger to configure. This field is unique within your Salesforce org.
UserId
Type
reference
Properties
Create, Filter, Group, Nillable, Sort, Update
Description
The ID of the user that the platform event Apex trigger runs as. By default, the platform event trigger runs as the Automated Process entity. Setting the running user to a specific user has these benefits:
  • Records are created or modified as this user.
  • Records with OwnerId fields have their OwnerId fields populated to this user when created or modified.
  • Debug logs for the trigger execution are created by this user.
  • You can send email from the trigger, which isn’t supported with the default Automated Process user.

Usage

To add a configuration, perform a POST request to this endpoint.

1/services/data/v57.0/tooling/sobjects/PlatformEventSubscriberConfig

Provide the values in the request body. This example request configures an existing trigger with the batch size of 200 and specifies the ID of a running user.

1{
2    "BatchSize": "200",
3    "DeveloperName":"OrderEventTriggerConfig",
4    "MasterLabel":"OrderEventTriggerConfig",
5    "PlatformEventConsumerId": "01qRM0000004PEhYAM",
6    "UserId": "005RM00000231cZYAQ"
7}

To get a specific configuration by ID, perform a GET request to this endpoint with the ID of your PlatformEventSubscriberConfig record appended.

1/services/data/v57.0/tooling/sobjects/PlatformEventSubscriberConfig/<ID>

Also, you can query retrieve the configurations in your org with SOQL. If querying from the Developer Console Query Editor, ensure you select Use Tooling API. This example query retrieves all configurations set up in your Salesforce org.

1SELECT Id,DeveloperName,BatchSize,PlatformEventConsumerId,UserId FROM PlatformEventSubscriberConfig