Extend Your Custom Apps with the Ability to Update and Delete Named Credentials from Apex

Extend Your Custom Apps with the Ability to Update and Delete Named Credentials from Apex

You can now update or delete a named credential, an external credential, or an external auth identity provider from Apex. ISVs and partners that build managed package apps can use these new Apex methods for automated setup and more flexible management of external system integrations. If a customer uses a managed package that programmatically updates the endpoint URL for a named credential or any URL fields on its related external credential or auth identity provider, the Enabled for Callouts field on the named credential is turned off until an admin manually reviews and enables it.

Where: This change applies to Lightning Experience in Enterprise, Performance, Unlimited, and Developer editions in API version 66.0 and later.

Why: ISVs and partners often need to manage multiple target endpoints for different customers, making packaged credentials difficult to manage. Previously, developers could only programmatically create named credentials, which required manual intervention for any subsequent updates or removals.

How: Developers use these new Apex methods to update and delete credentials via a UI in their managed packages: deleteExternalAuthIdentityProvider, updateExternalAuthIdentityProvider, deleteExternalCredential, updateExternalCredential, deleteNamedCredential, and updateNamedCredential. If the named credential Enabled for Callouts field is turned off, the customer admin must review any endpoint changes to the named credential or its related external credential or external auth identity provider and manually enable the field.