답변 10개
Hi Sasham,Try this,
Thanks,If it helps you, please mark is as best answer, so it will be helpful for other developers.//Storing all the State with Assessd picklist value in Set type
Set<id> PartSet = new Set<id>();
For(State__c st : [Select id,states,Participantt_c from State__c where Participantt_c != null]){
if(st.states == 'assesesd')
PartSet.add(st.Participantt_c);
}
//Checking participant have State as Assessed picklist value or not
List<State__c> insertList = new List<State__c>();
For(Participantt_c pt : [Select id from Participantt_c]){
if(!PartSet.contains(pt.id))
State__c stObj = new State__c();
stObj.Participantt_c = pt.id;
stObj.states = 'assesesd';
insertList.add(stObj);
}
//Insert state records
if(insertList.size() > 0)
insert insertList;