You need to sign in to do that
Don't have an account?
Alex Leem-Bruggen
How to create a Custom Button to Convert 'Prospects' to Leads?
Hi Everyone!
I have recently made a custom object called 'Prospects'. In my company prospects are seen as unqualified leads. Would anyone be able to help me create a convert button on my Prospect custom object which would convert the prospect into a Lead. The 'Lead' object I am referring to is the standard Salesforce Lead object. I have very little knowledge of Apex and Visual Force so any pointers would be much appreciated.
Thanks
I have recently made a custom object called 'Prospects'. In my company prospects are seen as unqualified leads. Would anyone be able to help me create a convert button on my Prospect custom object which would convert the prospect into a Lead. The 'Lead' object I am referring to is the standard Salesforce Lead object. I have very little knowledge of Apex and Visual Force so any pointers would be much appreciated.
Thanks
global class CallWebService {
webservice static string ConvertProspects(string Id)
{
Prospects p =[Select Id,Field1,.... from Prospects Where Id=:Id];
Lead l=new Lead();
l.FirstName=p.FirstName__c;
.....
insert l;
delete p;
return 'Prospects convert seccessfully';
}
}
Button Code:
{!REQUIRESCRIPT("/soap/ajax/22.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/16.0/apex.js")}
msg= sforce.apex.execute("CallWebService ","ConvertProspects", {Id: {Prospect__c.Id});
Then write the Apex class:
You can refer my blog which discusses about it : http://www.saaspie.com/2014/11/03/copying-data-from-one-object-with-a-button-click-in-salesforce/ (http://www.saaspie.com/2014/11/03/copying-data-from-one-object-with-a-button-click-in-salesforce/)