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||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);