Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.
45

The usual order of execution detailed at http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_triggers_order_of_execution.htm still applies with some special considerations The Before triggers and validation rules do not fire unless that checkbox is ticked under Customise > Lead > Settings. Note that for orgs created prior to '08 you'll need ...


16

understanding Lead Conversion: When you convert a lead, Salesforce creates a new account, contact, and, optionally, an opportunity using the information from the lead. Any campaign members are moved to the new contact and the lead becomes read only. If an existing account and contact have the same names as those specified on the lead, you can choose to ...


12

Yes, it's possible to mass convert leads in Apex Code. See the documentation on Database.convertLead here: Database.convertLead docs You can convert up to 100 leads at a time and you can use it in a scheduled class or as part of a batch apex operation (or both) if you want to convert much larger sets of leads. The documentation linked above contains good ...


11

Unfortunately the Lead Conversion field mappings aren't available in APEX or the Metadata API


10

When converting leads, you are prompted to add to an existing account or contact. After you convert the first one, you can attach to an existing Account. Note, that I like using leads for only un-qualified leads. Once I have qualified them, I convert them to an Account of type Prospect and then create an opportunity that I start tracking.


9

So, this is the Maximum number of unique namespaces referenced limit, which currently maxes out at 10. The explanation from the linked documentation: In a single transaction, you can only reference 10 unique namespaces. For example, suppose you have an object that executes a class in a managed package when the object is updated. Then that class updates a ...


8

This post provided the order of execution of triggers for Lead Conversion. A couple of ways : The Contact CreatedDate would be in the past, you could compare with a safety margin in mind, so you know that the Contact was created in advance of the Lead being converted. The Contact triggers fire before the Lead triggers, therefore in a ContactBefore trigger ...


8

This is done using the convertLead operation. It is documented at http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_dml_convertLead.htm If you want to do it using a trigger, refer this blog post.


8

The newest way to allow this was introduced in Spring '17. The original answer has been preserved for posterity below. You cannot modify a converted lead directly. Some global actions can invisibly modify those records, such as using the replace picklist value feature and merging record types, but no normal editing method (API, UI, etc) will be able to ...


7

As mentioned above, you cannot insert into the history tables of SF. You can create vf page that will show both history from the Lead History and the related Account. Create custom button in the account layout that will open this vf Page. Or even embed this vf page inside the account layout instead of the standard history related list


6

I don't think you can attached related items to a converted lead. When a lead gets converted all the Attachments and activities get transferred to the Account and/or contact. Since you are importing, do you have an equivalent Account or Contact for the converted lead? You import the activities and notes and attachments to those records instead. Or ...


5

To get started with Programming on the Salesforce platform, please refer to a different post - Learning development with Force platform. Any good books?: You are going to want to start with Force.com Fundamentals. This doesn't focus on Apex/Visualforce, but rather than base platform. Coding in Salesforce doesn't happen right away. You need to have a great ...


5

Thanks for both of your ideas. I realized before your answers that whenever we do a Lead conversion due to having a duplicate Contact for a Lead, we choose the Lead Status = "-Merge Contact". Like Mike suggested, I used that value to trap for those types. Here's the code if someone needs it in the future: if (lead.IsConverted && !trigger.oldmap....


5

If you can, you could add a new checkbox to the Lead, Was Converted, and mark it true. This could serve as a flag to check in your trigger.


5

Short answer, yes, if the object is in a time-based queue, and its criteria changes to no longer fire that rule, it will be removed. Longer answer, this article details the common approaches to the problem you're seeing and may give you some ideas for other solutions to the problem.


5

Possible reason can be is that, this feature was released in spring '08. If your production org is created before this release then this feature won't we available by default. You need to contact salesforce to enable this feature.


5

If you convert a Lead using the UI then any CampaignMember records that refer to that Lead refer to the Contact instead. Using Database.convertLead() results in exactly the same behavior. The only thing to keep in mind is that you cannot convert Lead records until after you have inserted them, so the call to Database.convertLead() will have to be in an ...


5

You can write a trigger to do this by deleting this post .Trigger will be on FeedItem object with ParentId as the AccountId and Body equal to one you recieved . The psuedo code for the same will be as below trigger FeedItemLeadConvDelete on FeedItem(after insert){ List<FeedItem> lstfeedItem=new List<FeedItem>(); String keyPrefix; ...


5

There is no way you can stop Account creation on Lead conversion. The whole point of lead conversion to create Account so as to ensure business is taking place with the customer. However, you can stop Opportunity creation. You can either create new Account on lead conversion or merge with an existing account. The steps to convert lead using apex is: 1. ...


5

Instead of this code: Account = New Account(Id = record.convertedAccountId), Use this code: AccountId = record.convertedAccountId,


5

When converting leads owned by a queue, the owner must be specified. This is because accounts and contacts cannot be owned by a queue. Even if you are specifying an existing account or contact, you must still specify an owner. Source: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_dml_examples_convertlead.htm So, the ...


5

There is no OOB way to solve this for a variety of reasons The Lead Conversion can execute triggers on the converted-to-objects. These triggers could create new objects or even do callouts to external systems The Lead Conversion can also fire workflows and process builder flows that in turn send emails, do outbound messaging, create related objects, use ...


5

To hide the button This can be done with record types and page layouts Create two record types - one for Leads with stages up to but not including the stage that allows conversion one for Leads in stages that allow conversion Create two page layouts (use page layout assignment) one for the first record type,. Remove the Convert button on the page ...


5

This is probably one of those situations where you have a tradeoff between cost and time. When I (well, me and my intern) needed to sort through roughly 30,000 Contact records to 'deduplicate' and 'merge' when my org implemented the feature to allow Contacts to be related to more than one Account, we used Microsoft Excel to handle the bulk of the work. The ...


5

I think, you are creating time based action based on created date and this time based action is getting queued. I would suggest you to create a separate datetime field, let's say Action DateTime which will initially be populated as created date + 7 days. If any action has taken on the lead then mark this Action DateTime as blank. Your time based action ...


4

Whenever you see the names of the seven dwarfs, 'DOPEY' in this case, then you know the problem us further down the stack, and is unlikely to be an issue with your code directly. It could be something you're doing that's causing it and it's not properly handled, or it could be something else entirely, but either way it'll be a case for the support team to ...


4

I can think of two ways of doing this: Have a checkbox field on the Lead, Was_Lead__c (default: checked) that maps to a field on the Account. This value can be carried over on Lead conversion. If you need to trace it back to the original Lead, you could probably use a formula that provides the Lead's ID field. To configure this, go to Setup | Customize | ...


4

I believe when Converting a Lead, it sets the Opportunity Stage to the first Stage listed in your Sales Process. Please check the first stage in the Sales Process that pertains to your Opportunity (depending on the Record Type)


4

Looks like you have a line commented out in your test class. //Ready_to_Convert__c = true Since you aren't inserting a lead with this field, it won't meet the criteria. Try uncommenting that line.


4

You can't convert a lead to an account/contact/opportunity using the data loader. The reason why is because the Data Loader only supports the following operations: query, queryAll, queryMore, insert, upsert, update, and delete (note: you can't even undelete records in the Data Loader). What you need is a tool capable of calling convertLead. There are ...


Only top voted, non community-wiki answers of a minimum length are eligible