I am trying to run the following query in my developer console (using tooling api): SELECT Id,Name,NamespacePrefix,Metadata FROM WorkflowRule but get an error saying 'An unexpected error occurred.'

It works fine if I remove the metadata field and run the following query: SELECT Id,Name,NamespacePrefix FROM WorkflowRule

Am I missing anything? Please help.


  • When I run the second query from the developer console "query editor" I get "sObject type 'WorkflowRule' is not supported.". (Perhaps I am missing a step in this to use the "tooling api"; please add that step to the question if I am.)
    – Keith C
    Commented Oct 13, 2014 at 7:59
  • There will be a checkbox 'use tooling api' towards the bottom of the screen that needs to be checked. Commented Oct 14, 2014 at 11:33
  • @PriyanshiAgrawal Where you able to get through metadata information too using tooling api query ? Commented Dec 26, 2014 at 15:11
  • @ChiragMehta Yes, I was able to get the metadata information after the last Salesforce release. Commented Dec 27, 2014 at 18:22

1 Answer 1


I know this is quite old now, but I'll post this here for those who still come across this question:

You can only retrieve the metadata from one workflow rule at a time. If you look at the Salesforce "Workflowrule" documentation under the tooling API at https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/tooling_api_objects_workflowrule.htm#!, you will notice that under Metadata it says

Query this field only if the query result contains no more than one record. Otherwise, an error is returned. If more than one record exists, use multiple queries to retrieve the records. This limit protects performance.

As such, in order to return that Metadata, your query should contain a where clause so that it only returns ONE and ONLY ONE workflow.

You must log in to answer this question.

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