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
APEX_DEVELOPERAPEX_DEVELOPER 

Bypass creation of Custom Fileds in triggers while installing a package

Hi,

I wrote an Apex triggers which update some custom field of Contacts. When I am trying to install the trigger in my sf account, it tries to create the Cutom fields on contact and if these fields are already present an error message pop-ups and installtion fails.

 

Could someone please suggest how I can by pass the creation of the custom fields on contact i.e. if fields are already present then do not create the same fields again during installation of package and also do not delete the fields during uninstallation of the package.

 

Please help me out. Thanks in advance for your reply.

ahab1372ahab1372

how do you deploy the trigger, using the IDE or through the UI?

If you use the IDE, just make sure you deploy the trigger only, not the contact object

APEX_DEVELOPERAPEX_DEVELOPER

Thanks for the reply.

I was trying to deploy using the UI.

I will now try using the IDE and will update you.

ahab1372ahab1372

I suppose that the UI bundled dependend Object s or object fields (the contact object in this case) and tried to apply the modifed contact metadata to the production org. That failed because the fields were already there.

 

A nice feature though if you haven't  made the required changes to the destination org