I am trying to see the Record Type Name and Business Process Name using one single query as shown below:

SELECT DeveloperName, BusinessProcessId
FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Opportunity'

Is it even possible? The best that I could do was get the BusinessProcessId.


You could do it using a subquery as follows:

SELECT Id, BusinessProcessId, DeveloperName, Name, (SELECT Id, Name FROM BusinessProcesses) 
   FROM RecordType WHERE isActive = TRUE AND SobjectType = 'Opportunity' 
  • Sorry that didn't work. I think I might have already tried that before. Following is the error I received: Unknown error parsing query This is the query I used: SELECT Id, BusinessProcessId, DeveloperName, (SELECT Name FROM BusinessProcess) FROM RecordType WHERE isActive = TRUE AND SobjectType = 'Opportunity' – Mayank Srivastava Nov 10 '15 at 20:37
  • Actually, that should have been BusinessProcesses in the subquery, but I'm not getting it to work in my DE. Then again, there isn't appropriate data for it to work either. I also suggest you remove SobjectType from what's returned as that caused an error for me until I removed it. – crmprogdev Nov 10 '15 at 21:51
  • Unfortunately that didn't work either. I am assuming that this is one of those objects in Salesforce that doesn't allow using dot notation or doing a downward SOQL query. – Mayank Srivastava Nov 10 '15 at 22:39
  • Actually, the Tooling API lists BusinessProcesses as the "plural" to use for subqueries on BusinessProcess. In light of that fact, I don't know what to tell you. – crmprogdev Nov 10 '15 at 22:54

Unfortunately the reference between RecordType and BusinessProcess is not "real" so BusinessProcess.Name doesn't work in the SOQL query. The easiest way to do it here is to just have a second query to select BusinessProcess names and weave the two lists together.

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.