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
Nikhil Garg 17Nikhil Garg 17 

integration using Named and External Credentials

Hi Community,

 I have created one External credential and one named credential.
When I'm trying to access the named credential in my apex code to callout it shows me "Either you don't have permission or External credential doesn't exist.
Now when I'm trying to access named and external credentials at profiles and Permission set it shows,  there are no Available Named Credentials to add.

Please provide me solution for the same, so that I can able to solve this timely.

User-added image

Thanks & Regards
Nikhil Garg
SF Developer
Arun Kumar 1141Arun Kumar 1141
Hi Nikhil ,

Here are some troubleshooting actions you may take if you're having difficulties accessing named credentials and external credentials in your Apex code, profiles, or permission sets:

1.Check the Named Credential's Existence: Make sure the named credential you are attempting to access does, in fact, exist. To accomplish this, go to Setup -> Named Credentials and make sure the named credential is listed there.

2.Make that the external credential linked to the named credential likewise exists by checking its existence. This can be found by heading to Setup -> External Credentials and making sure it is there.

3.Make sure you have the right access permissions before using named credentials by checking your permissions. Make sure the "Use Named Credentials" permission is turned on in your user profile or permission set. Review the available permissions in the user profile or permission set settings to confirm this.

4.Verify your login credentials to make sure you have access to named credentials and external credentials. Validate your user context. Verify your user profile has the required rights if you are testing in a sandbox or scratch org.

5.Check for Namespace Conflicts: whether you're using a managed package or have a namespace, see whether your named credential or external credential have any naming conflicts. Namespace conflicts can occasionally make it impossible to use named credentials correctly.

6.Check Apex Code: Verify that you are referencing the right identified credential in your Apex code by going over it. Verify the grammar, capitalization, and any possible typos one more time.

7.Clear Cached Metadata: To make sure you are using the most recent configurations, try deleting the metadata cache if you have recently changed your named credential, external credential, profiles, or permission sets. You can accomplish this by manually refreshing the metadata cache in your development environment or by using the "sfdx force:source:pull" command.

If the problem still exists after completing these steps, consulting Salesforce documentation or contacting Salesforce support may be beneficial.

Thanks
SwethaSwetha (Salesforce Developers) 
HI Nikhil,
Are having the system administrator profile?

See related: https://salesforce.stackexchange.com/questions/398401/named-credential-not-accessible-by-non-system-admin-profiles

Thanks
Nikhil Garg 17Nikhil Garg 17
Hi Swetha,
Yes I'm using System Admin Profile to callout .But the problem still exist.
Thanks
Nikhil Garg 17Nikhil Garg 17
Hi arun,

Thansk to reply , But I have checked all your poniters but not able to resolve the issue.

Thanks
GopiChandra_90GopiChandra_90

Hi Nikhil

What is the Identity Type for the created NamedCredential - Is it Per User or Named Principal or Anonymous? You should be able to add see it for adding on a Profile/PermissionSet if the Identity Type is Per User.

When using Named Principal this would be used across all users, not a Per User credential. That explains why you can’t assign this named credential to specific profile or permission set.

Thanks!

Marcos LasoMarcos Laso
Hi,

For the new Named Credintials, those what use External Credential records, the permission shoudl be give for its principals.

Go to the Permission set > External Credential Principal Access, and provide acces to you credential principals.

For each External Credential, you should first configure those "Principal" record/settings. Is in those records where you configure if the credentials are  per user basis or named principals (aka shared)