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
Jina ChetiaJina Chetia 

Infinite loop while overriding Convert Lead button

Hi,

 

I want to override the Convert Lead Button inorder to do a Javascript validation. I want the user to go ahead with Convert only if the Status is 'Closed -Converted'.

 

I have written an S-Control to do so, the check works fine but when the page is redirected to the leadConvert.jsp it goes into infinite loop.

 

Here is the code -

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <script type="text/javascript" src="/js/functions.js"></script> <script src="/soap/ajax/11.1/connection.js"></script> <script> function pageInit() { var leadStatus= "{!Lead.Status}"; if(leadStatus== 'Closed - Converted') { this.parent.frames.location.replace("/lead/leadconvert.jsp?retURL={!Lead.Id}&id={!Lead.Id}"); } else { alert('Error Message'); this.parent.frames.location.replace("/{!Lead.Id}"); } } pageInit(); </script> </html>

 

Can someone please help me in solving this?

 

Thanks,

Jina

CloudMikeCloudMike

I ran into the same problem a few weeks ago.  You're better off using the URLFOR method in and be sure to include the [no override] argument.

 

So in your case it would be something like:

 

 

String newURL = {!URLFOR({$Action.Lead.Convert}, !Lead.Id, null, true)}; window.parent.location.href = newURL;

 

Hope this helps