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
sapsap 

How to implement Accept Button functionality using an S-control

Hi,
 
I want to override Accept Button in leads with an  S-control.This S-control should perform the Accept Functionality and also automatically Convert the lead which is accepted.
 
I can write a Apex Class (if im correct) which performs the Convert functionality using Database leadconvert methods which is called from an s-control after performing the Accept functionality.
 
But i'm not sure how to implement the "Accept" functionality using an S-control.
 
If any one who has worked on this type of issue, can you please share the script.
 
Is there any way to perform the same functionality.
 
Any pointers will be of great help.
 
Thanks in Advance
 
 
 
sfdcfoxsfdcfox
The basic code goes as follows:

Code:
{!RequireScript("/soap/ajax/12.0/connection.js")}
{!RequireScript("/soap/ajax/12.0/apex.js")}

var leadRecordIds = {!GetRecordIds($ObjectType.Lead)}
if(leadRecordIds.length!=0)
{ var results = sforce.apex.execute('myLeadConvert','convertLead', leadRecordIds);
  // Do something with results
  alert(results)
window.top.location.href = window.top.location.href
} else { alert('Please select at least one row to accept!') }

 I hope this gets you started on your path to Apex Code!

Other than that, you can use the same basic method to use sforce.connection.convertLead to convert them on the browser end.