If the managed package has functionality based on FeedItem and Chatter=enabled. What will happens if target env doesn't have Chatter enabled? what are the practices to handle the code in this way.


You will not be able to install the managed package until you switch on Chatter in the target org, unfortunately you will receive this error why you try to install:

enter image description here

You could make it a configuration/custom setting and not create the dependency on Chatter in your DE org, i.e. refer to FeedItem dynamically in your code thus not creating a dependency on having Chatter installed in the target. Using dynamic code would also allow you to handle the failure gracefully at run-time.

    Schema.SObjectType targetType = Schema.getGlobalDescribe().get('FeedItem'); 
    if(targetType == null)
        System.debug('Chatter not enabled'); 
        SObject feedItem = targetType.newSObject(); 
        // do stuff with FeedItem
| improve this answer | |
  • 1
    Quick guy! Totally agree with Phil :) Vote up! – Carolina May 3 '14 at 15:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.