You need to sign in to do that
Don't have an account?
How to write relation ship query between custom object and Process Instances ?
Hi To All,
I am trying to write parent to child relation ship qery between custom object and ProcessInstances and ProcessInstancesworkitems, then i need to display this all in pageblock table.
I am able to write query between custom object and ProcessInstances.it's fetching records fine.here i am unable show ProcessInstances details in page block table
<apex:page controller="approvallistclass" >
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable value="{!apprlst.}" var="v">
<apex:column value="{!v.TargetObjectId }" /> I am unable to show this two fields in VF Page
<apex:column value="{!v.Status}"/>
<apex:column value="{!v.IsDeleted}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
public with sharing class approvallistclass {
public list<position__C> apprlst {get;set;}
public approvallistclass() {
apprlst = new list<Position__C>();
This is working fine
apprlst = [select id,name,(SELECT Id,IsDeleted,Status,TargetObjectId FROM ProcessInstances) from position__C where id='a0A9000000Cbu2p']; } }
This is not working
apprlst = [select id,name,(SELECT Id,IsDeleted,Status,TargetObjectId FROM ProcessInstances),(SELECT ActorId,d,IsDeleted, FROM ProcessInstanceWorkitem) from position__C where id='a0A9000000Cbu2p']
i am getting following error.
Didn't understand relationship 'ProcessInstanceWorkitem' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names. at line 9 column 13
I think it may be because there is no relation ship between Position__C and procesinstanceworkitem ,but id need procesinstanceworkitem ID
Can Any give me any idea on this query then how to dispaly that all in VF Page.
vrpnaidu,
ProcessInstanceWorkItem is child to ProcessInstance not to the custom object(Position__c). Only ProcessInstance is child to Position__c object.
try the below query..
apprlst = [select id,name,(SELECT Id,IsDeleted,Status,TargetObjectId,(SELECT ActorId,d,IsDeleted, FROM ProcessInstanceWorkitem) FROM ProcessInstances) from position__C where id='a0A9000000Cbu2p'];
please mark it as solved if it resolves ur issue..
Thank's For you'r respose Alagar ,
It's shows the following error.
Error: approvallistclass Compile Error: Didn't understand relationship 'ProcessInstanceWorkitem' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names. at line 7 column 14
while using sub query in soql u cannot go beyond level one..try this code this will work for sure...
List<position__C>apprlst = [select id,name from position__C where id='a0A9000000Cbu2p'];
List<ProcessInstance> =[select SELECT IsDeleted, Status, TargetObjectId, (SELECT ActorId,Id,IsDeleted FROM Workitems) FROM ProcessInstance where TargetObjectId IN:apprlst ];
Mark it as solution if it resolves ur issue..
Hi Alagar ,
it's working good now to display subquery records in pageblock table.