1
  1. Created the External Named credential with name Samsung Test enter image description here

  2. Added the Principal enter image description here

  3. Added the permission set enter image description here

However I am not able to fetch this named credential in Apex code.

HttpRequest req = new HttpRequest();
req.setEndpoint('callout:samsungtest');
req.setMethod('POST');
Http http = new Http();
HTTPResponse res = http.send(req);
System.debug(res.getBody());

System.CalloutException: The callout couldn't access the endpoint. You might not have the required permissions, or the named credential "samsungtest" might not exist.

3

1 Answer 1

1

You have named your Named Credential "samsungtest" but in the Apex you are calling out to samsungtest2.

3
  • 1
    My bad. I edited it. It was my mistake. The problem is the same.
    – neha rai
    Aug 25, 2023 at 17:53
  • Do you have that permission set?
    – fred
    Aug 25, 2023 at 18:19
  • Yes. i have assigned to me - System admin user
    – neha rai
    Aug 25, 2023 at 18:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .