function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
StenEStenE 

Include data in salesforce app packages

Hi,

 

I'm developing a custom app for salesforce. I'm using custom settings to store my default settings. But how can i include these default settings in mijn managed package?

 

Thanks,
Sten

Best Answer chosen by Admin (Salesforce Developers) 
sfdcfoxsfdcfox

This isn't currently supported. You can not include records in a package. The standard workaround is to include a class that populates the data in the absence of any other settings, and then have this class called if no settings are found. I would recommend that this ancillary class be designed to be called once, populating org-default values if any values are found missing. This should have the "long first run" effect (like those seen on servers with ASP, where the page is compiled the first time the server runs the page), with minimal impact on subsequent requests.

All Answers

sfdcfoxsfdcfox

This isn't currently supported. You can not include records in a package. The standard workaround is to include a class that populates the data in the absence of any other settings, and then have this class called if no settings are found. I would recommend that this ancillary class be designed to be called once, populating org-default values if any values are found missing. This should have the "long first run" effect (like those seen on servers with ASP, where the page is compiled the first time the server runs the page), with minimal impact on subsequent requests.

This was selected as the best answer
StenEStenE

Hmm. Already did this in an other app. Hoped there would be a better solution...

 

Thanks.