How to Create Named Credential in Salesforce

In this Salesforce tutorial, we will learn how to create a named credential in Salesforce.

While working with an organization that uses Salesforce, I got a task where I needed to create the named credential in Salesforce. To fulfill this requirement I use the name credential object that is present under security.

So after looking at the multiple solutions, I found a solution that helped me to create the named credential in Salesforce. If you want to learn how to create the named credential in Salesforce Lightning as well as Salesforce Classic, you have come to the right place.

Named credential in Salesforce

In Salesforce the named credential is defined as a logical entity that can be in between a named connection to an external system. With the named credential there is no need to place the URL and it also controls the authentication token in inscribed data stores.

It is a method that permits us to store and control the authentication information for the external system. The external web service is given by the named credential without revealing sensitive information such as passwords, usernames, etc.

The name credential holds the important authentication details like password, username, and security token and also acts as a cover for the external endpoints. We can easily create outbound calls for external services by simply using named credentials without identifying the authentication details.

I hope you got an idea about, what is named credential in Salesforce. Now, let’s move further and see how to create a named credential in Salesforce. We will explore both the salesforce experiences: Salesforce Lightning and Salesforce Classic.

How to create a named credential in Salesforce Lightning

Here we are creating the named credential in Salesforce Lightning. If you want to learn how to create the named credential in salesforce lightning follow these steps:

Step-1: Login into your Salesforce lightning account, Go to the gear icon. Under the gear icon, there are two options present first one is Setup and another one is Service Setup. Here we are clicking on the Setup option.

How to create the named credential in Salesforce
How to create the named credential in Salesforce

Step-2: After clicking on the setup option, the setup page is open. Enter the named credential in the Quick Find Box and the named credential come at the top. Click on the named credential. And these named credentials are present under the security in the left sidebar.

How to create the named credential in Salesforce lightning
How to create the named credential in Salesforce lightning

Step-3: After clicking on the named credentials, the named credentials page is open. Here you can see that previously there is no name credential is created. For creating the new name credential the new button is present at the right side. Click on the new button

Create the named credential in Salesforce
Click on the new button

Step-4: After clicking on the new button, the newly named credential page is open. Here fill in the complete information related to the named credential. First, fill in the label here we fill the label as USANamedCred, and after that fill in the name.

After that fill the URL in the URL field and here we are filling the https://salesforcefaqs.com/ URL then fill the external credential and here we are selecting the USAExternalCred.

Create the named credential in Salesforce lightning
Fill in the complete information related to the named credential

Step-5: After filling in the authentication, now fill in the callout options. Here click on the checkbox of generate authorization header that generates an authorization header and applies it to each callout that references the named credential.

After that click on the save button that is present at the bottom of the newly named credential page.

Salesforce create the named credential
Salesforce Create the named credential

Step-6: After clicking on the save button, the USANamedCred is created successfully and the message is pop-up on the screen that is USANamedCred was saved. We can also edit and delete the Name Credential by simply clicking on the edit and delete button.

Salesforce lightning create the named credential
The named credentials are created successfully

In this way, we understand how to create named credentials in Salesforce Lightning. Let’s Proceed further and learn how to create the named credentials in Salesforce Classic.

How to create the named credential in Salesforce Classic

Here we are creating the named credentials in Salesforce Classic. If you want to learn how to create the named credentials in Salesforce Classic follow these steps:

1: First log in to the Salesforce account, when we log in to the account the Salesforce lightning edition is open. Moving to Salesforce Classic, click on the Profile picture. The Profile picture drop-down list is open. Under this profile picture list, there is an option to switch to Salesforce Classic. Click on it.

After clicking on the switch to Salesforce Classic option, click on the drop-down arrow of the username. The drop-down list is open, under this list Setup option is present below the My Profile option. Click on the Setup.

How to create the named credential in Salesforce Classic
How to create the named credential in Salesforce Classic

2: After clicking on the setup option, the setup page is open. Enter the named credential in the Quick Find Box and the named credential come at the top. Click on the named credential. And these named credentials are present under the security control in the left sidebar.

Create the named credential in Salesforce Classic
Click on the named credentials

3: After clicking on the named credentials, the named credentials page is open. Here you can see that previously there is no name credential is created. For creating the new name credential the new named credential button is present on the right side. Click on the new named credential button.

Salesforce classic create the named credential
Click on the newly named credential button

4: After clicking on the new button, the newly named credential page is open. Here fill in the complete information related to the named credential. First, fill in the label here we fill the label as TestNamedCred, and after that fill in the name.

After that fill the URL in the URL field and here we are filling the https://pythonguides.com/python-and-machine-learning-training-course/ URL.

How to create named credential in Salesforce Classic
How to create named credential in Salesforce Classic

5: After filling in the authentication, now fill in the callout options. Here click on the checkbox of generate authorization header that generates an authorization header and applies it to each callout that references the named credential.

After that click on the save button that is present at the bottom of the newly named credential page.

Create named credential in Salesforce Classic
Click on the save button

6: After clicking on the save button, the TestNamedCred is created successfully and the message is pop-up on the screen that is TestNamedCred was saved. We can also edit and delete the Name Credential by simply clicking on the edit and delete button.

Salesforce classic create named credential
Salesforce Classic creates named credential

In this way, we understand how to create the named credential in Salesforce Classic.

Conclusion

Here we have learned about the named credential in Salesforce. The named credential is a method that permits us to store and control the authentication information for the external system in Salesforce. The external web service is given by the named credential without revealing sensitive information such as passwords, usernames, etc.

I hope you got to know:

  • Named credential in Salesforce
  • How to create the named credential in Salesforce Lightning
  • How to create the named credential in Salesforce Classic

You may also like: