function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jessica FeautoJessica Feauto 

Query to connect Workflow Rules and Email Alerts

I need to be able to connect each Email Alert with any associated Workflow Rules.  I've been able to pull all the data using the Tooling API and querying the WorkflowRule and WorkflowAlert objects.  The Email Alert is associated to the Email Template in these exports,however, that does not export a field that connects Workflow Rules and Email Alerts? Is there a way to do this? I have 200+ I am looking at and really don't want to do it by hand.

I've also looked at Workbench, but it does not have a connecting field either.
Alain CabonAlain Cabon
For the manipulation of the metadata with the tooling api, it is not easy because the main data are into the generic field "metadata" (not easy to read and change its content).

The detailed content of this field metadata that you get with the tooling api is here:
https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_workflow.htm

So for a big change of many workflows, that could be "easier" to download the metadata for all the targeted worlflows and manipulate them as text files before deploying them with the workbench.

package.xml: workbench > retrieve
<?xml version="1.0" encoding="UTF-8"?> 
<Package xmlns="http://soap.sforce.com/2006/04/metadata"> 
<types>
    <members>*</members>
    <name>Workflow</name>
</types>
<version>47.0</version>
</Package>