7

I have created a new Named Credential with External Credential (named B2BL_Mulesoft_Integrations) and mapped it to the correct permission sets using the Identity Type as Named Principal.

Can you please help me with what I am missing?

Update 14-Dec-2022: I have opened case# 43776623.

When I attempt to use Apex Class in Digital Experience under a Checkout Flow, it throws the exception as seen below:

15:37:59.78 (78218899)|NAMED_CREDENTIAL_RESPONSE|NamedCallout[Named Credential Id=null, Named Credential Name=null, Status Code=0, Content-Type=null, Response Size bytes=0, Overall Callout Time ms=0, Connect Time ms=0
15:37:59.10 (78972740)|EXCEPTION_THROWN|[11]|System.CalloutException: We couldn't access the credential(s). You might not have the required permissions, or the external credential "B2BL_Mulesoft_Integrations" might not exist.

It works well with System Administrator but not with the Digital Experience user assigned the permission set. I have granted access to Read+Create+Edit+Delete to the permission set User External Credentials.

Note: I have also attemted to change the code from with sharing to without sharing with no success.

The code is the usual:

HttpRequest req = new HttpRequest();
req.setEndpoint('callout:B2BL_Stock_Check');
req.setMethod('POST');
req.setHeader('Content-Type', 'application/json');
req.setBody('...');
Http http = new Http();
HTTPResponse res = http.send(req);

External Authentication config: enter image description here

Named Credential config: enter image description here

2 Answers 2

7

As far as I can see, Named Credential mapping does not work with Permission Set Groups.

The workaround was the assign the permission set directly to the user.

I have found this Idea. I hope this was documented. It could have saved us one day. It would be even better if Permission Set Groups worked as designed.

TL;DR: as of 15-Dec-22, Named Credentials mapping works only with permission sets assigned directly to the user.

2
  • I have all in place but still seems like I am missing something, even if use my sys admin profile or I assign the perm set directly to my user, when I execute the apex callout I get the same exception "We couldn't access the credential(s). You might not have the required permissions, or the external credential "......." might not exist." any ideas?
    – Sam.A.
    Jan 25 at 19:27
  • 1
    This resolved it for me...and also agreed with you. We lost a whole day of testing on this lol.
    – GeorgeA
    Feb 28 at 18:03
3

This question gave me a hint, and my problem was solved by granting Read permission to the User External Credentials object via a permission set. Not sure why this isn't documented, but it solved my problem.

Note that I'm also using a flow to kick off the callout via Apex action.

2

You must log in to answer this question.

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