7

We have a JS button in Classic which perform some checks and open the /lead/leadconvert.jsp? page with some fields prepopulated. Now we are migrating to Lightning, so for replacing the button we created quick action and redirecting the user to /lead/leadconvert.jsp?. But it is navigating to the classic page . Are there any events like force;createRecord which we can use for opening the Lead convert standard modal window.

4
  • Why not use standard lead convert button for the lead in lightning? May 8, 2018 at 14:20
  • We are checking for certain conditions. For example if field A is null, then we are throwing error message and not opening lead convert page . So we need quick actions or js buttons May 8, 2018 at 14:22
  • You have to create a custom quickaction and embeded a lightning compoment in it. that lightning component will do all validations and then prepopulate itself. You have to write lead convert logic in Apex as far my knowledge is concerned. May 8, 2018 at 14:27
  • @Ravi, did you ever find a solution for this?
    – Dedo
    Aug 13, 2019 at 4:45

2 Answers 2

1

Instead of going at it the way you've done, consider blocking it with a trigger:

trigger CheckValidLeadConvert on Lead (after update) {
  for(Integer index = 0, size = Trigger.new.size(); index < size; index++) {
    if(!Trigger.old[index].IsConverted && Trigger.new[index].IsConverted) {
      // Check for whatever conditions you like
      Trigger.new[index].addError('You cannot convert this lead because blah blah blah...');
    }
  }
}

You may also be able to use validation rules as well, since they now also run on lead conversion. I realize that this is slightly less ideal than aborting early, but using a trigger will prevent a lead from being converted incorrectly in any means, including Apex Code, Visualforce, Lightning, API, and Classic.

0

I believe you can use this url -

https://YOUR_SF_DOMAIN.com/lightning/cmp/runtime_sales_lead__convertDesktopConsole?leadConvert__leadId={LEAD ID}

Credit - How to redirect to standard lead convert page in lightning

You must log in to answer this question.

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