We have developed the managed app and we are ready to move to any other org. Since we are using some custom objects and we have loaded some pre-defined data into one object and we want that data should also deployed to another org when app is installing. How can we achieve this?
1 Answer
This is a very common question for all developers working on Managed Packages. There are multiple approaches to do this.
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
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.
Custom Metadata : Salesforce has introduced this latest feature for migrating data along with the package. The sole purpose of custom metadata is to use of configurations, but you can use it for data migration as well.
Ref : https://developer.salesforce.com/blogs/engineering/2015/04/custom-metadata-types-ga.html