7

I am trying to import some data on a particular object, hence is there a way to check which of our objects are tied to triggers, flows, etc.

4

You can review the existing triggers from Setup | Develop | Apex Triggers, and review the Sobject types to determine the base object.

You can review all existing Workflow Rules from Setup | Create | Workflow & Approvals | Workflow Rules, and review the Object list to determine the base object.

You can review all existing Processes from Setup | Create | Workflow & Approvals | Process Builder, and review the Object list to determine the base object.

Unfortunately, Flows will likely have to be opened individually to determine their base object.

3

One option not mentioned is to use the tooling API to query the ApexTrigger metadata object. You could do this directly, or by using the Salesforce CLI's force:data:soql:query command.

To query the tooling API using the Salesforce CLI the command would be as follows:

sfdx force:data:soql:query -u MyOrgAlias -t -q "[my query here]"

The direct REST endpoint is found at /services/data/v44.0/tooling/query

I could issue the following query, for instance:

SELECT Name, TableEnumOrId, NamespacePrefix, ApiVersion, Status, IsValid
FROM ApexTrigger
WHERE TableEnumOrId = 'Account'

This would return to me all account triggers and the information about them.

If I just wanted a list of all sObjects that have triggers and a count of their triggers, I could do this:

SELECT TableEnumOrId, Count(Id)
FROM ApexTrigger
GROUP BY TableEnumOrId

Unfortunately, not all of the other business process tools are as easy to inspect.

There is a config object for flows and process builder called FlowDefinition but I think you'd have to inspect the metadata field and parse the XML to see that.

There may be an object for workflows and approval processes (BusinessProcess maybe), but again not obvious.

Finally, the SetupAuditTrail is now API enabled and queryable. I've played around with creating different views of this. But this will only help you if:

  • The creation of the metadata item took place in the last 6 months
  • Or you've been backing up your Setup Audit Trail on a regular basis
0

Viewing the setup items for that object is certainly one way.

But you can also try to do this a in a refreshed Sandbox environment, and check the debug logs for the triggers, workflows, validation rules and flows invoked. Keep the developer console open, and do the data import. Check the logs for all the items invoked. You can also add Debug Logs under Setup->Monitor->Logs->Debug logs. Do the data import in the sandbox and come and check the logs created here.

The reason to do in Sandbox is that in case you are afraid to mess up some data in Production.

Sample log enter image description here

  • The debug log will be the way to see everything in detail, I just want to know if I am importing anything in a particular object then what all triggers, flow, process builders gets triggered for that object. – sfdc rowdy Jan 14 '16 at 11:06
  • You can try exploring the debug log to see the elements that are invoked. I have attached a screenshot of a very simple log though. You can try doing the similar action in your sandbox and see what it captures. – AslamK Jan 14 '16 at 11:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.