2

I created a custom convert button for leads like that : /lead/leadconvert.jsp?retURL=%2F{!Lead.Id}&id={!Lead.Id}&saveURL=/apex/MyPage?id={!Lead.Id}

The button is present on the standard Lead page layout as a detail page button, so no code.

Unfortunaly, the lead conversion doesn't work because in my Visualforce page, when I get the Lead.Id parameter, the ConvertedAccountId field is null.

I don't understand what fails during the conversion process.

Can you help me please?

Thank for your response.

10
  • For anyone who might be able to answer your question, I'm confident they'd want to be able to see the code for the page your button is linked to and very likely the code for the controller too. Please use the edit button to update your post.
    – crmprogdev
    Commented Feb 6, 2015 at 17:08
  • My button is present on the standard Lead page layout as a detail page button, so no code.
    – Oupat
    Commented Feb 6, 2015 at 17:14
  • Your visualforce query the ConvertedAccountId from the lead that's right ? Are you always creating a contact or an opportunity ? You can query the AccountId from these one Commented Feb 9, 2015 at 10:28
  • Yes, ConvertedAccountId field is null when I query it after the lead conversion.
    – Oupat
    Commented Feb 9, 2015 at 10:32
  • 1
    So I just threw together a test to try this out, and it should work. The question is why isn't the lead being converted? Have you looked into the debug logs to try to trace down the root cause? Is there any other code on Lead? Are there any triggers? Could there be an exception that is being swallowed by an empty catch block that then allows your page to render despite the failure of the lead to convert.
    – pchittum
    Commented Feb 9, 2015 at 10:52

1 Answer 1

0

If you're creating an Opportunity or a Contact on each convertion, you can use the ConvertedOpportunityId or the ConvertedContactId in order to query the AccountId when the ConvertedAccountId is null

1
  • The problem is the lead conversion fails entirely. There is always at the very least an account and a contact when lead conversion is complete...opportunity is optional. So being able to query ConvertedAccountId should be a given.
    – pchittum
    Commented Feb 9, 2015 at 10:53

You must log in to answer this question.

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