You need to sign in to do that
Don't have an account?
Prasanth R
i created two objects such that patient(parent),caselist(child).caleslist is related to patient with lookup relationship.Moreover,i created the insurance field(checkbox) in patient and category field(picklist) in caselist.
scenario:If the category is covid,insurance should true,
i try the below code it running without error but the insurance field is not active..kindly someone help me.below i added the codes and screenshot.
kindly someone give the correct code.
i try the below code it running without error but the insurance field is not active..kindly someone help me.below i added the codes and screenshot.
kindly someone give the correct code.
Hi Prashant,
Can you please provide your code instead of screenshot of it.
Regards,
Priya Ranjan
{
List<Apex_Patient__c> ptlt = new List<Apex_Patient__c>();
Map<Id,Case_List__c> ctlt = new Map<Id,Case_List__c>();
for(Case_List__c objIns:Trigger.new){
ctlt.put(objIns.id,objIns);
}
Map<Id,Apex_Patient__c> newpt = new Map<Id,Apex_Patient__c>([Select Id,Name,Insurance__c from Apex_Patient__c WHERE
Id IN:ctlt.keySet()]);
for(Apex_Patient__c obj: newpt.values())
{
if(obj.id==ctlt.get(obj.id).Patient__c && ctlt.get(obj.id).Category__c=='Covid')
{
obj.Insurance__c =True;
ptlt.add(obj);
}
}
update ptlt;
}
Try Below Trigger Please Mark It as Best Answer If It Helps
Thank You!
Tyr Below Code Please Mark It as Best Answer If It Helps
Thank You!