I'm looking at these three pieces of documentation:

and do not see in any of them the ability to set a Label or Name (that can be set through the Setup UI).

What am I missing here?


Trying an instanceof reports:

Operation instanceof is always false since an instance of ConnectApi.CredentialInput is never an instance of ConnectApi.NamedCredential

and calling createCredentials with a valid externalCredential resulted in this message saying a UserExternalCredential is being created which is not what I'm looking for (well I guess the method name and documentation are vague here):

ConnectApi.ConnectApiException: The UserExternalCredential object couldn't be saved because it's associated with an external credential with the following authentication protocol: Oauth

1 Answer 1


My conclusion here is that the ConnectApi.NamedCredentials class is not designed to create NamedCredential or ExternalCredential records but is designed to allow ExternalCredential records to be read and probably UserExternalCredential records to be created.

You must log in to answer this question.

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