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
Sourav ChandraSourav Chandra 

Using Bulk API to import leads

Hi,
We are thinking to integrate salesforce with out existing website. On our website, users have already existing leads created using our lead capture form. We want to import these existing leads to users connected salesforce account. 

To do so, I am using user's access token and instance url as received from /token call. Instead of doing soap login, I am passing X-SFDC-Session header set to access token value and it works fine. I did not find any supporting document for this and sceptical whether its fine to go ahead with this approach. Please let me know if its ok.

Sample request:
curl -i -X POST -H 'X-SFDC-Session: <access_token>'  -H 'Content-Type: application/json' -d '{"operation" : "upsert", "object" : "Lead", "contentType" : "CSV", "externalIdFieldName" : "Email"}' https://ap5.salesforce.com/services/async/39.0/job

Thanks,
Sourav
NagendraNagendra (Salesforce Developers) 
Hi Sourav,

You can use tools like the apex data loader to create the leads with an admin/integration user that has "Set Audit Fields upon Record Creation" if you want to keep the original created date and created by user.

When you are defining the mapping and you notice that you have fields in the source that don't have corresponding fields in salesforce that you want to see in salesforce then you need to add these fields to the lead object in salesforce.

An example mapping could look like this when created in the UI: 

User-added image
or when shown you look at the .sdl file:
#Mapping values
#Thu Apr 06 13:31:43 CEST 2017
owner=OwnerId
createdById=CreatedById
name=FirstName
The result will be that record will look like it was created by the user corresponding to CreatedById and the record owner will be the user whose user id matches to the OwnerId.

Regards,
Nagendra.
Sourav ChandraSourav Chandra

Hi Nagendra,

As mentioned in my ticket, we will do this export programmatically not using any ui tool.

Thanks,
Sourav

Sourav ChandraSourav Chandra
bumping up the question, can anyone confirm whether this is fine