1

I have a connected app, which authenticates with Salesforce using REST API via OAuth. How can I convert a Lead to an Account/Opportunity etc? There was some previous solution mentioning Apex, but this is a connected app, and I need a way I can perform this conversion for other organizations (our customers) without having to perform any custom action on their part (other than the OAuth step).

Thanks!

0

2 Answers 2

0

You have to create a custom solution at your end. Here you have some sample code on how to query the relevant data and then convert the lead.

You can also find documentation on how to connect using REST : REST API

1
  • 1
    Thanks, but the first link points to SOAP API, which I don't think I can use using OAuth, right? There are some constructs like convertLead() which seems to be something SFDC provides? I can already GET/POST/PATCH records using the REST API from my connected app. I'm trying to figure out how to invoke something like the connection.convertLead() function from REST. Any idea on how to do that? Thanks! Commented Jan 26, 2015 at 16:14
0

It is possible but you will need to write your own REST API to do this, as this functionality is not accessible on the standard REST API. The good news is that this isn't as hard as you might originally think. Some resources that you can use to get you 90% of the way there.

Creating a Sample Rest API: http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_rest_code_sample_basic.htm

Then utilize your LeadConvert once you have your lead. http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_dml_convertLead.htm

3
  • Thanks, but for the REST Apex API, the <instance> is my org's instance (the one creating the Connected App), right? While the data is in the customer instance, so I was wondering how I can convert a Lead on a customer (someone who has granted me OAuth permissions for my Connected App) org, and create a Contact and Account in their org. Thanks for the help! Commented Jan 27, 2015 at 9:07
  • Then you are left with using OAUTH and SOAP (it is possible). Here is a resources that should get you on the right path. developer.salesforce.com/blogs/developer-relations/2011/03/…
    – TC Sutton
    Commented Jan 27, 2015 at 16:42
  • Can I use the SOAP + OAUTH even in the Web server flow (developer.salesforce.com/page/…), or do I need the username/password flow? I ask because almost every example I see of SOAP API includes username+password, even in the OAuth situation, whereas I thought the whole point of OAuth is to not ask the user for their password? Commented Jan 28, 2015 at 6:54

Not the answer you're looking for? Browse other questions tagged .