我想在更新后为销售人员创建 APEX,当联系人上的字段被选中时,它可以获取联系人并将其重新创建为潜在客户。任何帮助,将不胜感激。
是的,所以我认为我需要列出需要移动到领导中的联系人列表。我忘记了从联系人中获取字段的格式,因此我可以将它们映射到潜在客户中。
public void createLead_Update(List<Contact> oldContacts, List<Contact> newContacts) {
System.debug('createLead_Update: entering trigger');
List<ID> createNewLead = new List<ID>();
Lead lead = new Lead();
Contact aContact = newContacts[i];
for (integer i=0; i<newContacts.size(); i++) {
// find contacts where the create lead checkbox is checked.
// on update, we care if the value is changed
Contact newValues = newContacts[i];
Contact oldValues = oldContacts[i];
if (newValues.createlead__c != oldValues.createlead__c) {
createNewLead.add(new Lead(
lead.firstName = aContact.firstName));
}
insert new lead
}
System.debug('createLead_Update: exiting trigger');
}