I need to update endpoint for 50 records on NamedCredential object. I tried different scenarios but nothing seems to be working..

1 - Endpoint is not allowed to filter in SOQL and NamedCredential is not allowed in SOSL.

2 - I get Update is not allowed on NamedCredential when i tried to update through anonymous window with all the record Ids i captured.

3 - NamedCredential object is not available in workbench to update manually

Can anyone suggest any other option other than using the MetdataService class?

Thank you


Ideally, you'd be able to modify your package.xml, get the NamedCredentials metadata into your IDE to update, and push the changes. However, Saleforce won't let you push the changes from your IDE for NamedCredentials up to the platform.

The only way I know how to do it to use the Financial Force's Metadata API wrapper to mass update the named creds. The class you want is MetadataService.NamedCredential and update the attributes you need.

Here is the install link: https://github.com/financialforcedev/apex-mdapi

  • Would Salesforce CLI work to deploy the changes after updating it through "ant update" command? I just retrieved all the NamedCredential records to my manifest folder and I do have a xml file to replace the text inside the endpoint which will execute on "ant update" – SunnyG Jun 6 '19 at 17:00

While you can use a metadata deployment tool (e.g. Gearset, ANT, ...) to move Named Credentials from, say, source control to an org and this would allow (mass) update of an endpoint, you can't deploy from source to target a Named Credential's password.

So , the update of endpoint depends on whether the Named Credential includes Password as a Authentication Protocol

  • At a high level, how would you do it via ANT? – PartOfTheOhana Jun 6 '19 at 15:49

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.