Salesforce API Integration

Hello, I though I would pass along this information to any who wants to directly be able to connect Salesforce to Backendless on how to open up the Salesforce API for a connected app. This would allow you to bypass having to use a third party connector like Zapier or Make. I found those solutions to be a bit lacking when dealing with the amount of objects and data elements Salesforce has in its standard objects and keeping things straight as they move into Backendless. I have much more flexibility with Codeless or flows/procedures/etc. on the Salesforce side.

Here is the article I followed:

You basically have to pull down the authorization code to get a token in your browser and then send it back again to salesforce to get your permanent access token that is basically like the “password” for your API requests into Salesforce. This process is a bit of a pain and I am hoping some day it will be more streamlined or someone has a better idea instead of manually getting this token. I guess, I will manually obtain the token and use it as a variable in Appdata or something that I can always call later as it theoretically has a very long life and I want to work on other development right now.

Next, I created some general “On Page Enter” codeless logic just to request the data from Salesforce and print it to the console.

Finally, I had to go into the Salesforce again and white list my Backendless URL because I was getting an error saying something about CORS policy. If you just go into salesforce setup, type CORS in the search, then you can add your URL there. Voila…you are getting secure data from Salesforce into Backendless.

I think my next thing I am thinking about is making a table for each of the SF objects that I plan to use in Backendless and make a table in Backendless that shows the 1 to 1 table mapping between the two systems. I just want to have a better solution to keep those mappings set so I don’t have to map them all the time as I build out the system, add more objects, etc. If anyone has any good ideas on next steps I am all ears!

I hope this helps someone and I can refer to it later when I forget how to get the token!

2 Likes

Note…my Salesforce access token for the Backendless app expired and I had to request a new one. So I changed the timeout policy on the connected app to 24 hours. I will probably need to make sure an API call is done automatically by Backendless a couple of times a day on a timer to make sure it doesn’t expire if I can’t find a better solution for access tokens.

Hi @Ryan_Belisle, thanks for sharing it with our community!

1 Like

Here is the codeless I used to have Salesforce issue new access tokens. I should just need to set this up on a timer and periodically retrieve a new one. This is just the ACCESS token you get whenever your session expires. The refresh token is a separate process that I am also working on that was described above.

It is discussed in SF docs here:

No Message

Here is a function to get/query a row of an object in Salesforce:

I had to use the URL Builder on this one and the colon ‘:’ to make the parameters for the query drop properly into the template. Here is the template I used:

https://YOURSFDOMAIN.my.salesforce.com/services/data/v:version/sobjects/:sObject/:Id

No message

Hello @Ryan_Belisle

Could you please clarify your question? What do you want to achieve and where are you stuck?

Regards, Dima.

Hi Dima, right I am mostly just documenting for myself and others for later who may want to integrate with salesforce because there wasn’t much content out there. One thing I am struggling with now is that Salesforce is not one of the Login providers you have set up so I am trying to figure out how to set them up as a custom provider. It would be nice to have the same login and security for this Backendless app that I already have in Salesforce. I am also not sure how the process actually works with the actual login screens, etc. so I am researching now. If you have any tips, that would certainly be appreciated.

hello @Ryan_Belisle

you can try to add your own login provider: