My requirement is to find un-Used workflow email alerts which are not tied to any Workflow Rules

I am checking Tooling API option WorkflowAlert

Where I am thinking of doing SOQL on Workflow EMail Alert like

select id,DeveloperName,SenderType,templateId,EntityDefinitionId from WorkflowAlert

I thought of something like WOrkflow will be parent and in SOQL I will put something like WorkflowId = null which will tell me no workflow rule is associated with this Email Alert but I don't think thats an option available looking at the object definition.

Please advise if there is any way to find out Workflow Email Alert not assigned to any Workflow Rule.

3 Answers 3


The details you seek are in the ToolingAPI, but are a little difficult to access.

What you want is the WorkflowRule.Metadata. This contains the actions, which is a WorkflowActionReference collection. Essentially, these relate the WorkflowRule to the WorkflowAlert.

Of course, the problem with doing this via the Tooling API is that you can only query the Metadata field for a single record at a time. So you would need to get each WorkflowRule and slowly build up a complete collection of all the referenced workflow alerts. And then you can compare that to the actual list to find which ones aren't used.

Here is a view of that data from a debugging session against a WorkflowRule.Metadata.

enter image description here.

DFB__Notify_Customer corresponds to the WorkflowAlert NamespacePrefix and DeveloperName fields in my dev org.

  • Thank you so much @Daniel Ballinger Commented Mar 3, 2020 at 13:27

If you are looking for a single email alert, You can do that by going to email alert detail in setup.

enter image description here

It has a related list to show to the workflow rules using this alert.if there is no workflow using this, it says This alert is currently not used by any rules.

  • No, of course I am not looking for single email alert. Commented Feb 25, 2020 at 12:21

Email alerts can be queried from the developer console by checking Use Tooling API. But I am afraid you can not find Unused workflow email alerts with SOQL.

Email Alerts are configuration, not data. SOQL won't be able to help you. I don't know of a shortcut other than looking through all the Alerts one by one.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .