Is there anyway to pause the Lead conversion process until some generated Account fields being validated?
This is my road block

  • When a user creates an account from standard layout we are generating a code based on the account name.
  • If the generated code equals with an existing one let user to edit it;after saving record this code is non-editable.
  • In Lead conversion process it's ok to generate the code in a before insert trigger.
  • But no way to let user edit it when duplicates match.

I'm thinking of going with a custom Lead Convert button and let user land into a custom page where the user can view a summary of the new account, but before the account record get inserted. Is there anyway to handle this? I'm using Database.LeadConvert and Database.LeadConvertResult in my custom VF page controller extension.


2 Answers 2


Where are you checking for the duplicate code?. Im guessing if you have the validation apex in a "Account Before Insert" trigger, think that this trigger will run when you press the "Convert Lead" button.

The logic is this:

  • Lead Convert will create a set of objects, configure them, and run a insert.
  • When the Account insert is running, if you have a validation apex on "Account Before Insert" that throws an error (if the duplicated code you are checking happens), it should Stop the convertion and throw the proper error on the Lead page.

My guess is that you should end up on the Lead page with an error telling you to type another code, and I think that's what you want.



Resolved with the below approach.

  1. Created a VF page with Lead standard controller;in the page action checked for duplicates; redirect to a middle stage page to summarize data.
  2. Created a custom button for Lead object and set it's action to calling above page.
  3. In the middle stage page let the user to review data and validate the auto generated code (here user can edit it as it wanted)
  4. Do the conversion upon user press the Convert button in the middle stage page.
  5. Set the generated (or user edited) code to an static variable and set it in a before insert Account trigger.

Hope this helps someone.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .