Image I create an app that contains a lookup field to Campaign. The field is not mandatory, and is only used when a user wants to use it.

Can a user install the app with a Group Edition license?

If not, how could I include an 'optional' lookup to Campaign without requiring a user to have a Professional Edition license?

1 Answer 1


You can create a base version (for GE accounts or those accounts that don't want/need to use campaigns), and an extension version (for all other accounts that do want/need to use campaigns). The base package can detect the presence of the extension package, and if present, call the additional code to leverage campaigns.

You could also dynamically check for the presence of campaigns, and the field they would optionally be using.

Map<String, SObjectType> g = Schema.getGlobalDescribe();
if(g.containsKey('Campaign') && g.get('MYNS__MyObj__c').getDescribe().fields.getMap().containsKey('Campaign__c')) {

Technically, using an extension package is cleaner, and less prone to problems, but requires more initial setup work. Also, using an extension package means you can guarantee the name of the field, because it can be included as part of the extension package, reducing the odds that you'll conflict with a custom field they may want to make for another purpose.

  • WIth regard to the dynamic checking: I see that that would work in Apex, but I can't do that with a field itself, right? I mean: the field is either ón the page (which would require Professional Edition) or it is not (making it possible to use the Group Edition). Adding the field dynamically is quite hacky, using callouts to the Metadata API or something like that? Commented Oct 16, 2014 at 14:12
  • You can detect fields both in Visualforce and Apex Code. I've used several packages that use dynamic checking/loading fields to allow their features to work with any standard or custom object. The FedEx shipping app is one such app that lets you map custom addresses, for example. The app requires the admin to create a custom field as part of the post-install instructions. There's nothing hacky about it at all. Just make it an extra step for those that want to use campaigns.
    – sfdcfox
    Commented Oct 16, 2014 at 15:06
  • Ah, making it an extra step for admins in the post-install instructions makes sense. Thanks! Commented Oct 16, 2014 at 15:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .