named credential problem

Is this part of a managed package.

If so you will need to prefix the named credential with __ (two underscores) to indicate that you are using a named credential from the local namespace. Source. You will need to skip this prefix in the packaging Dev org.


Another source suggests that you need to include the package namespace after Winter '16.

Before winter '16 you can use the Named Credential without the package name. From winter '16 you need to include the package name in the named credential.

BEFORE Winter '16 : 'callout:namedCredential'
AFTER Winter '16 : 'callout:packageName__namedCredential'


It is also worth checking that the Remote Site Settings will allow access to the URL from the named credential.