After every production refresh of Sandboxes I have to perform manual steps updating Custom Label, Remote Site Settings, Named Credential, Custom Settings and Custom Metadata. How can I automate the process using Apex code and the Metadata/Tooling API?

1 Answer 1


Custom Settings you can retrieve via SOQL (or use standard Custom Setting methods) and make any changes directly in Apex using DML.

You should consider using Metadata API for retrieving and updating the following: Custom Label, Remote Site Settings, Named Credential and Custom Metadata.

There is Apex Wrapper Salesforce Metadata API, which simplifies work with Metadata API.

In my opinion, using Metadata API approach will be advisable only if there are really a huge number of adjustments which you should perform after every Production refresh.

You must log in to answer this question.

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