+ Start a Discussion
sam87sam87 

Community feature deployment

Hi, 
I have a question regarding community deployment. We are developing community related features in our product. So some of our code includes the use of 'Network' object. While installing package with this code, the destination org requires community should be enabled otherwise it gives installation error. 
Is there any way to make the deployment of community features dynamic? 
i.e: If the destination org doesn't have community enabled then it will install the package without giving any error but community-related features won't be enabled (or installed). OR if destination org has community enabled then it will install the app with community-related features. 

Thanks, 
Sandip
Sagar PareekSagar Pareek
Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe(); 
if(gd.containsKey('Network')){
   system.debug('Community enabled!');
   return true;
}
else{
   system.debug('Community disabled!');
   return false;
}
You can check for communities using above code.

You cannot enable/disable communities or any subset of features of communities using Apex.
nirpnirp
Hello Sandip,
Did you manage to resolve this problem? I have the same problem in my package. I want to install the package and disable community features or not install community related code.

Thanks,
​Nir
AladinCGAladinCG
Hi Nir
I have tried many things to enable/disable community, but I could not able to do that..
and hence I have comment out all the community code from the Apex Class
I know that this is not the solution.. but I didn't get any other info regarding how to do this

If you find anything regarding this, please inform replay here
Thanks
Nirav