title: Salesforce, accessing TargetObject fields from ProcessInstance object using SOQL
body: <p>I have the following in my controller for a visualforce page which is consumed by a PageBlockTable.</p>
  
  <p>I can access other standard fields of the p.ProcessInstance.TargetObject such as p.ProcessInstance.TargetObject.Name and .Id etc...</p>
  
  <p>But how can I access custom fields of TargetObject of where the record is related to? Or is this not possible? If its not possible then I assume I can do it in a seperate query, but I cannot figure out how.</p>
  
  <p>Thank you</p>
  
  <pre><code>List&lt;ProcessInstanceWorkitem&gt; results = [Select p.ProcessInstance.Status, p.ProcessInstance.TargetObject.Name, p.ProcessInstance.TargetObject.Id, p.Actor.Name, p.CreatedBy.Name, p.CreatedDate FROM ProcessInstanceWorkitem p];
  </code></pre>