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
kzmpkzmp 

Allow users to decide whether they want to install particular items during installation

Hi,

We have a managed package in which we have packaged:

Apex classes, custom fields, triggers to standard objects etc.

We would like to allow the users to decide whether they would like us to install the triggers to the standard objects or the custom fields during installation.

 

The process should be like the following:

 1. User clicks install package

  2. User is provided with a set of options like: Install triggers in Accounts [checkbox], Install triggers in Leads [checkbox]

  3. The user checks the Accounts checkbox and unchecks the Leads checkboxs and clicks continue.

  4. Our package installas only the triggers for the Accounts checkbox and not the Leads trigger.

 

Is that possible?

 

Thanks,

Kos

Best Answer chosen by Admin (Salesforce Developers) 
aalbertaalbert

That flow is not possible. If the package includes triggers and custom fields, those will be automatically installed as the package is installed. But you could have an Administration-like page setup to allow to select what triggers they want on/off. Then store those selected options as Custom Settings. From there, when your triggers execute due to a data operation, your triggers could look to check the value of those Custom Settings and if turned off, just skip over the trigger logic.

All Answers

aalbertaalbert

That flow is not possible. If the package includes triggers and custom fields, those will be automatically installed as the package is installed. But you could have an Administration-like page setup to allow to select what triggers they want on/off. Then store those selected options as Custom Settings. From there, when your triggers execute due to a data operation, your triggers could look to check the value of those Custom Settings and if turned off, just skip over the trigger logic.

This was selected as the best answer
kzmpkzmp

Thanks a lot for the prompt answer.

What you explained about how to control the triggers is exactly what we do although not with "Custom Settings" but we rolled our own sObject with settings along with an interface.

What we really would like to achieve is to allow the user to choose whether he/she wants the triggers and custom fields installed or not. I would imagine that users will complain if they want to use our solution just for the Accounts object but we install our stuff (triggers, overrides, custom fields) on the other sObjects as well.

It is too much of a hassle for the users to do post installation configuratoin of all these.

 

I am turning towards extension packages to break down the application into separate components.

The problem with extension packages is that I will get different prefixes for each extension. For example to package Leads I have to create an extension with a prefix, to package Accounts I have to create another extension if yet another prefix.

 

If you can suggest anything better I will appreciate if you point me in the right direction.

 

Thanks,

Kos