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
pluviosillapluviosilla 

How to add fields to a standard object during package installation?

I'm new to packages. I want to deploy a package in multiple orgs and 

(1) automatically add new custom fields to the Opportunities and Contacts standard objects during the installation of the package, while *taking* *extreme* care*

(2) **not** to remove any custom fields that the person installing my package may have already added to those objects. Also, it would be nice if I could ensure that

(3) if someone decides to *uninstall* my package, it will delete those fields (and *only* those fields) which my package added during installation.

 

How do I achieve (1) and (2)?

 

Best Answer chosen by Admin (Salesforce Developers) 
DarrellDDarrellD

This is part of the packaging process and why it will add a namespace to your fields (and objects if you create them). You do not have to do anything special. When you package your app it will add any custom fields needed (1) and it doesn't remove anything when customer installs app.

 

If your field is called Time__c, then the system will make it AppName__Time__c so as not to conflict with anything the subscriber may already have in their org. Same with uninstall, it will just uninstall fields associated with the namespace.

 

If you haven't read the ISV guide yet, it goes over the above in explaining install and uninstall.

 

Darrell

All Answers

DarrellDDarrellD

This is part of the packaging process and why it will add a namespace to your fields (and objects if you create them). You do not have to do anything special. When you package your app it will add any custom fields needed (1) and it doesn't remove anything when customer installs app.

 

If your field is called Time__c, then the system will make it AppName__Time__c so as not to conflict with anything the subscriber may already have in their org. Same with uninstall, it will just uninstall fields associated with the namespace.

 

If you haven't read the ISV guide yet, it goes over the above in explaining install and uninstall.

 

Darrell

This was selected as the best answer
pluviosillapluviosilla

Darrell, thanks *very* much for taking time to answer my question. I have discovered the ISVforce.pdf document, as well as the ISVforceWorkbook.pdf and I'm reading both. 

 

But your answer is still appreciated because it helped me push past a concerning that was inhibiting my experimentation. Much appreciated.

 

John