We have developed the managed app and we are ready to move to any other org. Since we are using some custom settings and it has some pre-defined data. So how can we deploy the data into installed org?


You can use following two approaches to populate data in your custom settings

  1. Post Install Script : You can create a post install script to populate data once your package is installed. You can create a utility class which will populate all data for you and execute this class from Post Install Script

Ref : https://help.salesforce.com/apex/HTViewHelpDoc?id=apex_post_install_script_intro.htm&language=en

  1. Configure Page : You can display a configure page as your default Home after installation. User can simply click a button and it will either execute a class or fetch a static resource which has data in XML/JSON format and creates it for you.

Update - Code for Static resource approach

    public String textToParse;
    PageReference pr = new PageReference('/resource/Records_Values'); // This is a static resource name
    Blob content;

    Public ResourceParse(){
         content = pr.getContent();


    // The main method to parse the XML file and insert valid mappings.
    public PageReference parseXML() {
            textToParse = content.toString();

        if (textToParse == null) {
            return null;
        } else {
        return null;

    Public Void insertRecords(){

        //Insert your records here

Execute above class either from Post Install Script or a button on a config page. It will get the data from Static Resource and will create records as per your logic.

| improve this answer | |
  • A while ago a colleague combined 1 with the static resource part of 2 and had the problem that it seemed like the new version of the static resource was not available in the post install handler. Do you have any experience of that? – Keith C Dec 9 '15 at 9:00
  • I have implemented the approach 2 with static resource and approach 1 with utility class. However I will try to implement this if I get some time. – Salesforcesmarty Dec 9 '15 at 9:07
  • @Salesforcesmarty Can you please provide me some more information on this? – Iqbal Dec 9 '15 at 12:16

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.