Reputation: 23
I have a custom setting called TestCustomSetting__c with a checkbox field named TestCheckbox__c, which is initially set to unchecked by default. After installation, if a user checks this checkbox (i.e., sets its value to true), I want to ensure that this changed value is retained even after an upgrade. Currently, during upgrades, the checkbox value is reset to its default value, which is false.
I reviewed the example provided in https://developer.salesforce.com/docs/atlas.en-us.pkg1_dev.meta/pkg1_dev/apex_post_install_script_create.htm but I'm unsure how to preserve the checkbox value during an upgrade.
Upvotes: -1
Views: 96
Reputation: 23
I reviewed my code again and noticed that every time the package is installed, it resets the value of the checkbox to false. After commenting out those lines, I confirmed that the custom setting field values are already retained even after a package upgrade.
Upvotes: 0