On a lead conversion, I would like to convert the information on the lead to an additional object. This object will be associated with both the account, as well as the opportunity.
trigger createApp on Opportunity (after insert) {
List<ID> opportunityIds = new List<ID>();
for (Opportunity opps : Trigger.new) {
opportunityIds.add(opps.Id);
}
Lead lead = [SELECT ID, Custom__c FROM Lead where ConvertedOpportunityID = :opportunityIds[0]];
is the current top part of my code.
It throws the error that lead is not being assigned to any value, meaning that ConvertedOpportunityID is not equal to the opportunity ID that is being stored from Trigger.new
Any thoughts would be appreciated.