0

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. I have below questions:

  1. How can we use bulk api to import these as our website will not know the password of the user and as per bulk api documentation before starting any job, user has to be logged in?

  2. How can we provide a mapping functionality to map any unmapped fields of the generated leads with salesforce lead field? Is there any API for that?

0

You can use tools like the apex dataloader 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 createdby 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: enter image description here

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

  • 1. I want to do the importing using api, how can I do this without requiring user password? 2. I did not get this. Can you point me to any api documentation/example where I can do the mapping while importing lead into salesforce using bulk api. – Sourav Chandra Apr 5 '17 at 16:08
  • @sourav you can find the documentation for data loader here: resources.docs.salesforce.com/204/latest/en-us/sfdc/pdf/…. For logging in you can create a technical user and have his username and password(encrypted) stored on the server that runs the integration. When you install dataloader you will also find a folder with samples that show examples of how a process looks like with mapping – Gilhil Apr 6 '17 at 7:29
  • As per dataloader ui, it says "Log in to the Salesforce org that you’re importing to or exporting from." If we use our integration user it will import data to our acount instead of users acount, no? – Sourav Chandra Apr 6 '17 at 8:51
  • If you don't specify the record owner then that integration user will own the record but if you map another user to the owner field then that user will be the record owner. If you also want to be able to see which user created the record in the source(your website) then you can also fill in the createdById during create calls together with the createdByDate on condition that these users also exist as users in salesforce. – Gilhil Apr 6 '17 at 9:18
  • If I map actual user to record owner field instead of integration user, will the leads be created at record owners salesforce account? – Sourav Chandra Apr 6 '17 at 10:04
0

We had a similar scenario, you have to be authenticated yo use the API of salesforce, but it doesn't have to be a login and password it could be a token with auto refresh obtained with oath from salesforce, the API support this kind of integration, I recommend to use a component to communicate with the API, it is posible to implement all the functions directly but with all the methods it have is difficult to do so, we use jsforce to integrate with our salesforce from our existing project, you have to search for other component more suitable if you are not comfortable with the one I suggest.

And if you want, you can check the documentation for all the apis in salesforce.

In that documentation you have an article that explain the oauth2 authentication technique and the refresh token method.

We use the jsforce component, so I'm not sure how to accomplish this in a vanilla way, I think REST API documentation could be a good start to understand the way of authentication and the different flows, it could be different for SOAP but is not going to be entirely different. In that documentation the section Understanding Authentication explain the way the different types of authentications works, I know is going to be a extensive read, I'm not entirely confortable in the Java world, but I think this repository implements a lot of the things you have to implement, could be a good start point or even use the repository as a library, I also find this other repository. Additionally there is this specific course in pluralsight that you should check out.

I hope this could help.

  • This does not feel like an answer to me. More of a comment? Maybe add some examples specifically around authentication – Eric Apr 6 '17 at 5:11
  • Thanks @Eric I could not comment in the question, I'm not sure why, I'll edit the answer tomorrow to complement what I'm saying, is late here now to made a good answer. – sebmaldo Apr 6 '17 at 5:38
  • As per developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/… and java examples, we need to do login/create connection by passing user name and password, isn't it? – Sourav Chandra Apr 6 '17 at 5:56
  • @SouravChandra yes, depending of the authentication method, in the response of the authentication you receive a token, you have to made the subsequent request with that token (that calls to the bulk API), and this token can be refreshed in subsequent calls if it expired, so you can made the request with the token and not with the login and password explicitly. – sebmaldo Apr 6 '17 at 6:05
  • I am bit confused here as they mention in the docs for making request there should be valid session id which is returned after logging in. developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/… Can you let me know how we can do this? – Sourav Chandra Apr 6 '17 at 7:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.