I need to change the named credential url in the managed package. But it is not possible when we install the package in another org. Is there any possibility to do that? Thanks
1 Answer
Unfortunately, you can't. Editing Components and Attributes After Installation has this to say about Named Credentials:
Developer Editable
- Endpoint
- Label
Subscriber and Developer Editable
- Allow Merge Fields in HTTP Body
- Allow Merge Fields in HTTP Header
- Auth Provider
- Certificate
- Generate Authorization Header
- Identity Type
- OAuth Scope
- Password
- Protocol
- Username
Locked
- Name
As you can see, only the Developer is allowed to edit the endpoint/URL.
-
Thanks @sfdxfox. So I think I need to use remote site setting instead of Named Credentials. Jan 30, 2018 at 3:50
-
2@Prasad They have different purposes. Maybe you could have the subscriber define it as an unmanaged element, which your code should (theoretically) be able to access?– sfdcfoxJan 30, 2018 at 3:51
-
1Oof glad I saw this. I'm working on a managed package project where definitely it was intended that the subscriber be able to edit a Named Credential endpoint. I guess we'll have to try another strategy. Jan 30, 2018 at 12:46
-
1@VarunC The reason why it can't be changed is because you may have a private API; if a subscriber can control the endpoint, they could reverse engineer your API by pointing to a server they control. If you need a Named Credential for what appears to be your use case, you could probably have the subscriber set one up after installation and then set a custom setting to use that Named Credential. As far as I'm aware, a managed package can call a Named Credential if it has the name.– sfdcfoxApr 26, 2021 at 11:44
-
1@VarunC Right. You need to have your subscribers set up a Named Credential.– sfdcfoxApr 27, 2021 at 19:06