You need to sign in to do that
Don't have an account?

apex trigger unit test
Hi
Could someone help me write a apex unit test for the following trigger. I am new to apex.
Could someone help me write a apex unit test for the following trigger. I am new to apex.
trigger acceptedspeakerroles on CampaignMember (after insert, after update, after delete, after undelete) { Map<Id,Contact> contacts = new Map<Id,Contact>(); if(Trigger.new<>null) for(CampaignMember c:Trigger.new) if(c.ContactId<>null) contacts.put(c.ContactId,new Contact(id=c.ContactId)); if(Trigger.old<>null) for(CampaignMember c:Trigger.old) if(c.ContactId<>null) contacts.put(c.ContactId,new Contact(id=c.ContactId)); update contacts.values(); }
Many Thanks
Conor
Try the following code, it may be helpful for you:
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks,
Ajay Dubedi
All Answers
Try the following code, it may be helpful for you:
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks,
Ajay Dubedi
Very Helpful!! :)
Conor