So I have created a secure endpoint named credential with an external credential. The external credential has 1 principal with two properties, client_id and client_secret. Now I can't find any way to actually access the values from APEX.

I have tried pretty much everything to reference them {!$Credential.client_id}, {!$Credential.external_credential.client_id} but nothing seems to be valid.

In other words how can I reference the custom attributes so that I can forge my http body? Or is there a general concept that I'm not getting, around these new types of named credentials?


1 Answer 1


Verify if you checked the Allow Formulas in HTTP Body

Allow Formulas in HTTP Body

Also, if you are mapping the External Credential to a Permission Set

enter image description here

Then, when you set the named credential as the endpoint and use the {!$Credential.external_credential.client_id}, this will be replaced at sending time

  • I had both allowed formulas and the permission set but it wasn't working. Until I've copy paste your formula reference, which I swear had tried before and didn't work. Seems like everything is fine now and I was able to construct the body properly Aug 17, 2023 at 7:20
  • Can this done in the the endpoint? for example abc={!$Credential.external_credential.customparameter} The end result would be callout:namedcredential?abc=xyz
    – d_k
    Sep 21, 2023 at 13:03

You must log in to answer this question.

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