0

This is a question I had for a long time.

I have an abundance of email templates and alerts in my org.

I need to go over the ways that these alerts are sent out. Looking at an email alert, you can only see which WFR rules are using it, but many times, these alerts are also used in Process Builders and/or Code.

Is there a way to get the list of USED email alerts from Process Builder? Flows? APEX code?

2
  • 1
    I am not sure and have not used this, but there is a MetadataComponentDependency in beta version. Just try that developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/… Commented Nov 29, 2020 at 7:16
  • 1
    There's no foolproof way to do so in Apex, as we always should be using a query to get the Id, thus ensuring no static link exists between the template and the code (but a quick Find in Files in an IDE should work). As for the rest, the MetadataComponentDependency should work fine. That said, developers/admins should get a documentation system and get in the habit of using it. Not only can you define the linkages, but you can relate it to user stories/tickets/business logic to define why it exists, which is arguably more important than just where.
    – sfdcfox
    Commented Nov 29, 2020 at 7:36

1 Answer 1

1

For some reason Developer Console only shows one row so for querying the MetadataComponentDependecy you can use jsforce.

Try logging in in with your org.

Then go here

Go to this section : Query Tooling Objects

Then copy paste this:

conn.tooling.query('SELECT ID, MetadataComponentName, MetadataComponentType, RefMetadataComponentName,RefMetadataComponentType From MetadataComponentDependency')
    .execute(function(err, records) {
        if (err) { return console.error(err); }
        debugger;
        console.log("fetched : " + records.records.length);
        for (var i=0; i < records.records.length; i++) {
            var record = records.records[i];
            console.log('Id: ' + record.Id);
            console.log('Name: ' + record.Name);
        }
    });

YOu may notice I have given a debugger, so just open your developer console and click run on the page, so that when it runs it stops at the breakpoint and you can just check if your metadata is there or not.

enter image description here

You must log in to answer this question.

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