You need to sign in to do that
Don't have an account?
SFDC User2382943
Create Opportunity from Custom Object
I have a custom object that I would like to create and save an opportunity from with a few of the fields. I think my problem is that I'm including contact lookup fields? I'm getting a save error that says "Illegal assignment from Id to SOBJECT:User"
How can I make this trigger work?
trigger meeting on MD_Meeting__c (after update) {
List <Opportunity> oppToInsert = new List <Opportunity> ();
for (MD_Meeting__c m : Trigger.new) {
if (m.SD_Action__c=='Generate Opportunity') {
Opportunity o = new Opportunity ();
o.Owner = m.Sales_Director__c;
o.Market_Developer__c = m.Market_Developer__c;
o.Account = m.Account__c;
o.Type = 'Sales - New Business';
o.CloseDate = System.Today()+150;
o.MeetingLookup__c = m.Name;
o.add(o);
}//end if
}//end for o
try {
insert oppToInsert;
} catch (system.Dmlexception e) {
system.debug (e);
}
}
How can I make this trigger work?
trigger meeting on MD_Meeting__c (after update) {
List <Opportunity> oppToInsert = new List <Opportunity> ();
for (MD_Meeting__c m : Trigger.new) {
if (m.SD_Action__c=='Generate Opportunity') {
Opportunity o = new Opportunity ();
o.Owner = m.Sales_Director__c;
o.Market_Developer__c = m.Market_Developer__c;
o.Account = m.Account__c;
o.Type = 'Sales - New Business';
o.CloseDate = System.Today()+150;
o.MeetingLookup__c = m.Name;
o.add(o);
}//end if
}//end for o
try {
insert oppToInsert;
} catch (system.Dmlexception e) {
system.debug (e);
}
}
If this solves your problem, kindly mark it as the best answer.
Regards,
Magulan
http://www.infallibletechie.com
Now, there is no error message, but not opportunity is inserted when the object is updated. Nothing happens and I can't tell why?