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

Modifying Opportunity Field on lead Conversion
Hello everyone,
I'm currently trying to get a field to change on the opportunity when it's converted from a lead, using a custom field from the lead itself. However, I can't seem to get it change properly. My code is below. Any advice would be appreciated
trigger Configero_Lead_OpportunityConversion on Lead (before update) { List<Opportunity> o = new List<Opportunity>(); List<ID> oids=new List<id>(); for(Lead convertedLead: Trigger.new){ if(convertedLead.IsConverted == TRUE && convertedLead.ConvertedOpportunityId != NULL){ oids.add(convertedLead.ConvertedOpportunityId); } o=[select id from opportunity where id IN: oids]; for(Lead convertedLead: Trigger.new){ for(opportunity op:o) { if(op.id==convertedlead.ConvertedOpportunityId) op.name+=convertedLead.Proposed_Opportunity_Name__c; } } upsert o; }
I think convertedLead.ConvertedOpportunityId will be Null in a before update trigger while converting.