You need to sign in to do that
Don't have an account?
MikeCloud
Apex trigger for populating Account lookup field
I have a custom object - Case Management, when the Contact lookup field is entered I want the Account lookup field associated with that Contact to be automatically entered. I am new at this so here's what I have,
Case_Management__c (before insert, before update) { for(Case_Management__c co: Trigger.new){ if (co.Contact__c != null){ co.Account__c = 'Yes'; } } }
This needs to be edited, but I am lost.
Use this code
All Answers
Hi,
Try This Code
Use this code
Just some typos then worked perfectly thanks you guys this was for a non-profit
Hey Mike,
Could you share the test classes you wrote for this trigger, im just getting into this whole Apex malarkey and I have altered the triggers to work in my sandbox with some different custom objects but not managed to get the test methods down just yet - its also for a non-profit so good causes all round!
Danny