1

I'm trying to figure out what benefits managed packages offer. One of the things I'd like to be able to do is migrate Custom Objects and Custom Fields. For example, in one package release we have a field that is a text area. In the next release we decide that this should be a date field. We want to issue an upgrade that converts the text field to a date.

A more complex migration might be that we decide that certain fields need to be pulled out into a related object of their own.

Documentation on managed packages talks about components (classes, objects etc) being upgradable, but it doesn't describe what happens when Custom Fields are upgraded. Is the data lost? Or does Salesforce do its best to convert between types.

3

Fields can't be destructively changed. For example, you can't make a checkbox into a text field, or a long text area into a decimal value. You can only make limited changes to fields. This limitation is enforced by the fact that you can't change the data type of a field referenced by code. In this case, you can only delete the fields (mark them as deprecated), which doesn't delete the fields until the organization that upgrades consents to the deletion. Instead, you have to create new fields in their place, with a new name, etc. You can make an InstallHandler script that can transform data post-install. You should avoid doing this as much as practical, since some components, like page layouts, are not upgradable, and will cause additional post-install work for administrators.

| improve this answer | |

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.