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

Named Credentials Error (Couldn't Access Credentials)

Hello -  I am receiving this error when trying to connect to a second Salesforce org. 
System.CalloutException: We couldn't access the credential(s). You might not have the required permissions, or the external credential "SitCopyExternal" might not exist.

I have full CRUD on external credentials. Below is the named credential,  external credentials, and authentication provider. Any idea what's configured incorrectly? 
named credential
External credentials
auth provider
Sai PraveenSai Praveen (Salesforce Developers) 

The error may be because if any of the below reasons.

1) Make sure that the URL for the named credential is correct and that it matches the endpoint URL for the salesforce second  system you're trying to access.

2) Check that the username and password are correct and that they match the credentials you use to access the salesforce second  system

Let me know if you face any issues.

If this solution helps, Please mark it as best answer.

Hi Sai - Thanks for the response. Regarding #2, where do I enter username and password? 
Quick update here. The reason for the error is I didn't create a permission set. Once created, I was able to authenticate. Thanks again for the help.
User-added image 

You need to perform below steps-

1. Create a Principle in your named credential also add Authentication Parameters with some dummy data.
2. Open the permission set which is assigned to you and then add this Principle by clicking External Credential Principal Access.

after that try to perform callout

George abi 5George abi 5
In "Named Credentials" and "External Credentials" I can't fined any permission set settings. can you please advise wher I can set these permission maping sets between "Named Credentials" and "External Credentials".
shweta sharma 131shweta sharma 131
Hi George abi 5, 
  • Please look for "Principals" in External credential, create a new one if there is not any.
  • Then either add this Principal to your profile in "Enabled External Credential Principal Access" or add it to "External Credential Principal Access" in a permission set and assign that permission set to your user.