Named Credential Formula Functions
Formula functions can be used in the value field of a custom header of a named credential or external credential.
A Binary Large OBject (BLOB) is a collection of binary data stored as a single entity. For named credentials, BLOBs can store binary executable code used in custom header formulas.
| Function | Description |
|---|---|
| BASE64DECODE(expr) |
|
| BASE64ENCODE(expr) |
|
| BLOB(expr) |
|
| HASH(algorithm, expr) |
|
| HEX(expr) |
|
| HMAC(algorithm, valueToSign, secretSigningKey) |
|
- This example shows encoding a username and password stored in an external credential. The
BLOBfunction first converts a string of form username:password into a binary.BASE64ENCODEthen converts the binary into an encoded string.myExternalCredentialis the name of an external credential.
- This example sets a header named
X-Usernamewith a base-16, SHA-256-hashed username as the value.reqis an HTTPRequest.Usernameis an authentication parameter attached to a permission set mapping.
- This example sets the X-Body header as the base-16, hashed evaluated body, meaning that all formulas within the request body are evaluated.
BLOBisn’t required here because$Credential.myExternalCredential.Bodyis returned as a BLOB type, rather than as a String.