You need to sign in to do that
Don't have an account?

Not able to convert a lead through apex when approval process is completed(Approve/Reject)
There is strange thing happening, I have a logic in a apex class to convert the lead(via visualforce page), When Lead is pending for approval process it gives me an error:

This is correct because if lead is pending from approval we can not convert it.
Now if I go to that lead and "Approve"(No other approval is pedning) that lead and test again through vf page still it shows the same error.
NOW if I go to that lead detail page and click on "Convert" button it shows me this page:

After this I don't click on convert, I just go to the vf page and try to convert through apex class, and it converted succefully. SO I am not sure what is happening ? Why my lead is not getting converted even I approve/reject , Is there any workaround of this? Please suggest.
This is correct because if lead is pending from approval we can not convert it.
Now if I go to that lead and "Approve"(No other approval is pedning) that lead and test again through vf page still it shows the same error.
NOW if I go to that lead detail page and click on "Convert" button it shows me this page:
After this I don't click on convert, I just go to the vf page and try to convert through apex class, and it converted succefully. SO I am not sure what is happening ? Why my lead is not getting converted even I approve/reject , Is there any workaround of this? Please suggest.
And also check the time-based workflow action pending that is related to the Lead. Or, there is a Process Builder with a time-based action pending that is related to the Lead.
1. A pending Workflow action can be tracked down by going to Setup | Monitoring | Time-Based Workflow. Then filter on criteria related to the Lead record that caused the error to see which workflow is implicated.
2. A pending Process Builder action can be tracked down by going to Setup I Process Automation I Flows.
Thanks,
Raj