+ Start a Discussion

Access custom fields of TargetObject for ProcessInstanceWorkitem


I have the following in my controller for a visualforce page which is consumed by a PageBlockDataTable.

I can access other standard fields of the p.ProcessInstance.TargetObject such as p.ProcessInstance.TargetObject.Name and .Id etc...

But how can I access custom fields of TargetObject? 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.

Thank you
List<ProcessInstanceWorkitem> results = [Select p.ProcessInstance.Status, p.ProcessInstance.TargetObject.Name, p.ProcessInstance.TargetObject.Id, p.Actor.Name, p.CreatedBy.Name, p.CreatedDate FROM ProcessInstanceWorkitem p];

Does anyone have any idea's? Thanks