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
Girish KSGirish KS 

How to query a Process Builder or Flow either using Soql or Apex.

Can anyone suggest how to get details/properties of a Process builder using soql or apex.
Best Answer chosen by Girish KS
Raj VakatiRaj Vakati
You can able to query  Flows and FlowDefinition SOQL using tooling API 

Or you can able get the details using workbench also 

info => Metadata Types & Components => Flow for Flows
iInfo => Metadata Types & Components => FlowDefinition for Processes

https://help.salesforce.com/articleView?id=000265246&language=en_US&type=1


https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/tooling_api_objects_flow.htm

All Answers

NagendraNagendra (Salesforce Developers) 
Hi Girish,

Unfortunately, this is not possible as of now.

As a workaround, You can find both flows and processes using Workbench:
  • Info => Metadata Types & Components => Flow for Flows
  • Info => Metadata Types & Components => FlowDefinition for Processes
There's an idea which is active on the success community with a similar discussion for which you can upvote so that it gets available in the mere future. Hope this helps.

Kindly mark this as solved if the reply was helpful so that it gets removed from the unanswered queue which results in helping others who are facing a similar issue.

Thanks,
Nagendra
 
Raj VakatiRaj Vakati
You can able to query  Flows and FlowDefinition SOQL using tooling API 

Or you can able get the details using workbench also 

info => Metadata Types & Components => Flow for Flows
iInfo => Metadata Types & Components => FlowDefinition for Processes

https://help.salesforce.com/articleView?id=000265246&language=en_US&type=1


https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/tooling_api_objects_flow.htm
This was selected as the best answer
Girish KSGirish KS
Thanks Raj, i was aware of accessing through Workbench and tooling api but your tooling metadata api helped me access some of the feilds easily.

Thank you.
Ravi RoyRavi Roy
Hey, you can easily query it through SOQL.
  1. Go to you developer console 
  2. Select 'Query Editor'
  3. In query editor check this option 'Use Tooling API'
  4. Run the following query
Select id,MasterLabel,lastmodifieddate,lastmodifiedby.name from flow where MasterLabel = 'Test Sample Process Builder - 2.0'


Hope this helps you.
Thank you!
Vladimir Romanov #1Vladimir Romanov #1
Here is the soql query that you can use to get all Active Record-Triggered flows:
SELECT ApiName, TriggerType, Label FROM FlowDefinitionView WHERE IsActive =true AND (TriggerType='RecordAfterSave' OR TriggerType='RecordBeforeSave')

See SOAP API reference for more details https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_flowdefinitionview.htm?search_text=flow