+ Start a Discussion
tanmayeetanmayee 

how to get the count of workflow rules in an organization

does anyone know how to get the count of workflow rules in an organization.

 

thanks in advance.

sfdcfoxsfdcfox
There is no easy way to get a total count of workflow rules in the organization. You can create a list view for all workflow rules, then page through the list until you reach the end. The total count would then be # of pages * page size + final page size.
Vinay K 39Vinay K 39
There is no way that you get the org directly, but you can pull the count using workbench.
 using REST explorer with Get(),
 /services/data/v45.0/tooling/query/?q=Select+Id+From+WorkflowRule
Kirill_YunussovKirill_Yunussov
You can also query for it via the Developer Console in SF.   Make sure to check the "Use Tooling API" checkbox.

Here is a query of all fields for this object:
Select Id, Name, ManageableState, NamespacePrefix, TableEnumOrId, FullName, Metadata From WorkflowRule limit 1
When quering FullName or Metadata, can only pull 1 record at a time.
Without those two fields, can get all WF rules like so:
Select Id, Name, ManageableState, NamespacePrefix, TableEnumOrId From WorkflowRule
Or just get the total count:
Select count() From WorkflowRule
Kirill_YunussovKirill_Yunussov
Also, grouped by Object:
Select count(id), TableEnumOrId From WorkflowRule group by TableEnumOrId order by count(id) desc