+ Start a Discussion

soql query on ProcessInstance not working

Dear Team,

I need help to buid a SOql query.
I would like to retrieve some fields of opportunity and Contract object related to TargetObjectId :

SELECT TargetObjectid,(select actor.name from Workitems),
(SELECT StepStatus, Actor.Name FROM Steps),
(Select RecordType.Name, Status from Opportunities where Id in ProcessInstance.TargetObjectId)
​(Select RecordType.Name, Status from Contracts where Id in ProcessInstance.TargetObjectId)
FROM ProcessInstance where Status = 'Pending'

Unfortunatly it gives me an error : Unknown error parsing query
Can you help me to build this query properly?
Himanshu Jasuja 9Himanshu Jasuja 9
Hi Ludivine,

I would suggest using Force.com IDE plugin for Eclipse, which gives you more detailed error message about syntax error. Also you can try use other third-party applications which allow you to perform SOQL like workbench or Schema Viewer.
I would agree that error from Developer Console is not the error which we would like to see, probably you can either log a case to Salesforce or suggest your idea to Idea Exchange about this.

Hope this helps you.