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
chrispedchrisped 

Using Bulk API to update Leads and Accounts from a single data set

My organization currently tracks all customers as Accounts in Salesforce.  We are planning on migrating our trial accounts to Leads and use Accounts to track paying customers as well as trials with which our sales team has engaged (Account + Opportunity).

 

Today, we use the bulk API to, on a daily basis, refresh information about each customer on their Account record from another database.  We use each Account's unique ID as a key to update the Account record.

 

With the new plan, we're faced with the problem of updating each record, not knowing if it is a Lead or an Account as Leads may have been converted throughout the day.  Are there any good suggestions for how to handle this?

 

A couple of ideas:

1.  Use the bulk API to upload the data to Leads, parse all failures, and repeat with the set of failed records on Accounts.  This is not ideal because it's relying on an error from Salesforce for correctness.

 

2.  Use the upcoming Bulk query API (currently in preview mode) to query all Leads and Accounts, and split the upload into two according to IDs and record type returned in the query.  

 

3.  Create a custom object which is associated with each Salesforce Account or Lead,  update this record via bulk API with new data, and build a workflow around these objects to update their associated Lead or Account.

 

I'm at a loss for how to proceed here and would love some advice from more seasoned developers.

 

Thanks in advance,

Steve