Is there a better way to handle callouts in Salesforce?

Recently, I was doing an integration and was faced with a situation that lead me to think, is there a better way to do this, i.e. handle callouts in Salesforce?

Well. Yes. There is, was the answer I found.

You must be wondering what I am talking about. Well,

  • I didn’t want to hardcode my API Credentials in code which is not the CORRECT way to go about, and which would also cause issues when deploying to Production
  • Was looking at a better way to store credentials and make it more secure than using Custom Settings
  • etc.

So, this lead me in search of a BETTER WAY to achieve this within Salesforce, and well, I found my answer – Named Credentials.

 

Named Credentials allows to define the Callout URL endpoint and any required authentication parameters in one definition, and Salesforce handles the rest for us. This means,

  • I didn’t have to hardcode any credentials in code which is NOT the correct way to go
  • I didn’t have to use Custom Settings
  • etc.

This also saved me a lot of trouble of not needing to define a Remote Site Setting entry to white list my endpoint URL, which I would have to use if I had used the traditional way of using the endpoint URL in code, or handle authentication within code which would cause it to be less secure, etc.

Refer https://www.linkedin.com/pulse/better-way-handle-callouts-salesforce-dhanusha-mahatantila- for a high level summary between the OLD and the Named Credential Way.

Happy coding… Named Credentials #Simple #Easy #Secure #Better

 

0 Comments

Leave a Reply

CONTACT US

We're not around right now. But you can send us an email and we'll get back to you, asap.

Sending

About Us

Forcetalks is a Salesforce collaboration platform for coders & developers, geeks & nerds, consultants & business heads, admins & architects, managers & marketers and of course the business owners. A community where you can learn from, where you can contribute to. For you. For Salesforce. Read More...

Copyright 2020 Forcetalks. All Right Reserved.

Log in with your credentials

or    

Forgot your details?