2

My managed package Apex code is making callouts but I can't use a packaged Named Credential as the user also needs to be able to adjust the endpoint URL not only the username and password.

I planned on using per-user named-credentials (with a predefined name or label) for that but now I am unable to query / find out. There is no User field on Named Credential that I can SOQL.

Who am I supposed to access it then?

2

I know it doesn't directly address how to do this with Named Credentials, but I've historically used protected hierarchy custom settings for this in a managed package.

Being a hierarchy allowed for both default org level values and then user specific values if required.

It does require more work as the Named Credential won't do it for you. However, it gives you full control of the endpoint URL and the credentials that are passed to it.

  • 2
    Yup, NamedCredential isn't a good fit for this half-way use case. – identigral Apr 4 at 19:09
  • @Daniel Ballinger -- I agree with you on this. Named Credentials just don't work with managed packages very nicely. One question though--without a named credential, where do you get your Consumer Secret/Key? – DaveS May 9 at 21:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.