+ Start a Discussion
Trupti BaroleTrupti Barole 

Do i need to create a REST API to convert a Lead?

Hi experts,
I'm stuck in developing a hybrid salesforce mobile application.
The scenario is i'm using forcetk.mobilesdk.js for accessing LEAD object in salesforce and i want to display a button CONVERT on clicking which a convert query should get fired and that particular Lead should be converted into Opportunity. There are various APIs in forcetk.mobilesdk.js file to create, delete, retrieve and so on. But i did not find any to convert a Lead to opportunity/account/contact.

Do i need to create a new API so that i can convert LEAD? or there is any alternate way to achieve the same?? 
If i must create a API, how can i create??

For reference, https://github.com/forcedotcom/SalesforceMobileSDK-Android  run an AccountEditor app and understand functionality and please help ASAP.

code sample for creating a record is in code sample.
     * Creates a new record of the given type.
     * @param objtype object type; e.g. "Account"
     * @param fields an object containing initial field names and values for
     *               the record, e.g. {:Name "salesforce.com", :TickerSymbol
     *               "CRM"}
     * @param callback function to which response will be passed
     * @param [error=null] function to which jqXHR will be passed in case of error
    forcetk.Client.prototype.create = function(objtype, fields, callback, error) {
        return this.ajax('/' + this.apiVersion + '/sobjects/' + objtype + '/'
        , callback, error, "POST", JSON.stringify(fields));

I want to write a code for Convert Lead.
Nishant SharmaNishant Sharma

If no method is defined in above sdk, you have to go for rest service. Anyway, you can find it here (http://salesforce.stackexchange.com/questions/50045/how-do-you-convert-a-lead-via-the-rest-api).
Trupti BaroleTrupti Barole
@ nishant, The answer you provided contains APEX class code, but im developing a LOCAL HYBRID APP using HTML5, JQuery and javascript, No APEX or VFP pages are used. Please revert back if you have any relevent information regarding local hybrid application using HTML5. and how to create a REST API using  jquery, javascript OR AngularJS?