My trigger is giving me an "Illegal assignment from Id to SOBJECT:User' error.
The trigger is supposed to create a new opportunity when the field in the custom object is a certain value. I want to input some fields from the object into the opportunity.
trigger MDwinning2 on MD_Meeting__c (after update) {
List <Opportunity> oppToInsert = new List <Opportunity> ();
for (MD_Meeting__c m : Trigger.new) {
if (m.SAL__c==True) {
Opportunity o = new Opportunity ();
o.OwnerId = m.Sales_Director__c;
o.Name = m.Name;
o.StageName = 'Generate Opportunity';
o.Market_Developer__c = m.Market_Developer__c;
o.AccountId = m.Account__c;
o.Type = 'Sales - New Business';
o.CloseDate = System.Today()+150;
o.MeetingLookup__c = m.Id;
oppToInsert.add(o);
}//end if
}//end for o
//try {
// insert oppToInsert;
// } catch (system.Dmlexception e) {
// system.debug (e);
// }
}
Change
o.Owner = m.Sales_Director__c;
o.Account = m.Account__c;
To
o.OwnerId = m.Sales_Director__c;
o.AccountId = m.Account__c;