function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ankit Maini.Ankit Maini. 

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:
User-added image

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:
User-added image

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.
 
Maharajan CMaharajan C
Hi,

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