• Pranavaditya Kannojoo
  • NEWBIE
  • 20 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 4
    Replies
I have code similar to below

if(Schema.getGlobalDescribe().get('ChatterMessage') == null){
          chatterMessageEnabled = false;
} else {
          chatterMessasgeEnabled = true;
}

In one of the environment we have disabled Private Messaging so that this standard object is not accessible. When I execute above code snippet in developer console, I notice that the chatterMessageEnabled is set to false which is expected. 

However if this similar code is installed as part of managed package in the same environment, notice that chatterMessageEnabled is set to true which is unexpected and causing issues. Can any one help in overcoming this issue? 

Searching on Schema.getGlobalDescribe results that its behavior in managed package is always trickier. 
I have a list of sObjects and also know its field names. We need to retrieve these field values and build a custom object out of it. sObject.getSobject() returns an object and which needs to stored in various fields of the Custom Objects. The data types of fields in custom objects are LongTextArea, ID, Datetime. 

Any idea how to do this. 
We have some apex classes which refer to ChatterConversationMessage (standard object) and use the data from the same. This object has details of private message and we could capture the same as expected. When we disable Private Messaging feature in salesforce, this object is non-existent and salesforce complains that our package has to be re-compiled. 

I would like to know if there is any mechanism to check if this such an sObject exist and based on that retrieve its fields dynamically. Essentially we would want the same package to work when the sObject ChatterConversationMessage is available or not.
I have code similar to below

if(Schema.getGlobalDescribe().get('ChatterMessage') == null){
          chatterMessageEnabled = false;
} else {
          chatterMessasgeEnabled = true;
}

In one of the environment we have disabled Private Messaging so that this standard object is not accessible. When I execute above code snippet in developer console, I notice that the chatterMessageEnabled is set to false which is expected. 

However if this similar code is installed as part of managed package in the same environment, notice that chatterMessageEnabled is set to true which is unexpected and causing issues. Can any one help in overcoming this issue? 

Searching on Schema.getGlobalDescribe results that its behavior in managed package is always trickier. 
I have a list of sObjects and also know its field names. We need to retrieve these field values and build a custom object out of it. sObject.getSobject() returns an object and which needs to stored in various fields of the Custom Objects. The data types of fields in custom objects are LongTextArea, ID, Datetime. 

Any idea how to do this. 
We have some apex classes which refer to ChatterConversationMessage (standard object) and use the data from the same. This object has details of private message and we could capture the same as expected. When we disable Private Messaging feature in salesforce, this object is non-existent and salesforce complains that our package has to be re-compiled. 

I would like to know if there is any mechanism to check if this such an sObject exist and based on that retrieve its fields dynamically. Essentially we would want the same package to work when the sObject ChatterConversationMessage is available or not.