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
Pranav S SarkarPranav S Sarkar 

How to make Salesforce features optional / mandatory in Managed Package

Hello there,

I have a managed packag where I have enabled SCPL (State and Country Picklist) and I have used field State Code and Coutry Code in my apex classes for populating picklist values.

After creating package when I am trying to upload it in other instance, it is asking to enable SCPL in the destination org. Now, I want to make this thing optional during installation. Is there any way to achieve this?

Thanks in advance.
N.M. SharmaN.M. Sharma
Hi Pranav,

If you want to do this field Optional so first update your code and make it dynamic.
First check this Country Code and State Code is available for this object or not.

If it is available after that perform any operation on it.
make sure you can use this field with get() and put method.

After making this update you have no need to take care this State and Country Picklist is enable or not. 

Pranav S SarkarPranav S Sarkar
Thanks N. M. Sharma!! It worked.
N.M. SharmaN.M. Sharma
If my Answer helped to solve you problem please make a like on it
I Really appriciate for it.