Skip to main content
How to deploy EmailServicesFunctions
Matthew Guy avatar
Written by Matthew Guy
Updated over 2 months ago

The EmailServicesFunction metadata type is not included in the Gearset Default comparison metadata filter. You can create a custom metadata filter including this type - just add Email services function from the list in the Manage custom filters menu - or alternatively, use the Compare all metadata filter.

Behavior and dependencies

The EmailServicesFunction metadata type has a required string field that corresponds to the Apex class name that the email service uses to process inbound messages. Therefore, this metadata type cannot be deployed unless that specific Apex class exists in the target environment. 

You can find the name for that Apex class in the XML for the email services function that you want to deploy, shown in an example below.

If you do not have the Apex class in your target environment, your deployment to create the EmailServicesFunction will fail with the following message: An Apex Class must be specified when creating an Email Service.

Similarly, you cannot deploy a deletion with Gearset of an Apex class that is referenced by EmailServicesFunction without removing the EmailServicesFunction too. The deployment will fail, with the following message displayed in the deployment results: This InboundEmailHandler class is in use. : Apex Class.

Did this answer your question?