Skip to main content

How to deploy Platform Events

This guide explains how to retrieve and deploy Platform Events in Gearset

Written by Vincent Maltby

Platform Events are a little confusing as the Custom Platform Events found in Salesforce under Platform Events ->Custom Events, are stored under the Custom object metadata type.
​

Your events will then show as separate Custom Objects in the comparison view.

Depending on how your event is setup you may also need to include a few other metadata types.

The full list of metadata types that relate to Platform Events is as follows.

  • Custom Object

  • Platform event subscriber config

  • Platform event channel member

  • Platform event channel

  • Event relay config

  • Flow

  • Apex Trigger

Once you have added the above metadata types you should be able to deploy all required changes.

Deploying a Platform event subscriber config across environments

Some values in your metadata are different in each org. A username in a Platform event subscriber config is one example: the same person has a different username in each environment, so one file does not suit every org.

Set the right value per org with environment variables. Gearset replaces the value in the file as it deploys, so the same package works through your pipeline:

  1. Go to My Account, then Environment variables.

  2. Select the target org connection, then click Add Target.

  3. Click Add environment variable, then select the Platform event subscriber config metadata type and the item you deploy.

  4. Type the username to find and the username for that org to replace it with, then click Save.

  5. Repeat for each org in your pipeline. To copy a whole set of variables to another org, use Clone from... or Import CSV.

Gearset applies environment variables to CI job deployments and to validations, so the replacement runs when your pipeline validates the change as well. The metadata item has to be in the deployment package for the replacement to take effect.

ℹ️ License requirements: You need a Deployment Teams or Deployment Enterprise license to use environment variables.

For the full detail, including regex matching and bulk setup, see Using environment variables in Gearset.

Did this answer your question?