• chrisct1
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 4
    Replies
I've inherited a working managed application in the AppExchange store. I have access to the Salesforce account that owns the package, but I wouldn't like to make changes directly on that account. I have a git repo with all of the source code, but I am unable to make a scratch org to do development due to metadata. 

I've successfully created a scratch org, but when I attempt to push my source to the scratch org, I get 1k+ errors due to unknown references to custom objects that aren't in my scratch org.

Is there a way for me to get the metadata from my main org and push it to the scratch org? I've been struggling with this for quite a while and haven't seen a solution that works.
Hi there.
I have APEX code that is querying FeedComments. In my client's logs they are recieving the following error: 

System.QueryException: Implementation restriction: directly querying FeedComment is only supported for admin users in version 23.0 and higher.

I checked the API version for the client, it is 43. Also the client enabled "View all Data" for the System Admin group. (Which was used to install the App). 

I am wondering if there is any other cause for this error.
May be a dumb question, but... If there is new functionality, say, new object fields that I would like to code against in Spring '12...how do I do this in eclipse and save the code to my Winter '12 dev environment (save to server)? Eclipse barks back saying invalid field. I would like to update my code for Spring '12 and push my managed package to a Spring '12 pre-release sandbox for testing. Is this possible? Thanks.

Hello All,

 

I'm having an issue dynamically setting an sobject variable type. What I'm trying to do with this snippet is dynamically determine the object feed that this chatter feed item is posted to and then query that object feed via dynamic soql so that I can later reference the query results. This works fine up until the point of storing / referencing the query results.

 

See my last line of code. Instead of 'sobject', I need this to be AccountFeed or ContactFeed or LeadFeed (the point is this part must be dynamic). I already have the dynamic sobject type in the variable objectType, but apparently cannot use a variable to set the type of another variable.

 

So how can I dynamically define this resultObject variable? Or is there another way to do this, as with the generic sobject? Problem is, I need to reference the ContentData field with: resultObject.ContentData and cannot do this with sobject (unless I'm referecing sobject incorrectly).

 

Thanks,

 

Chris

 

 

 

Map<String,Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();   
               	List<Schema.SObjectType> sobjects = schemaMap.values();
        		List<Sobject> theObjectResults;
        		Schema.DescribeSObjectResult objDescribe;
       			List<Schema.SObjectField> tempFields;
        		for(Schema.SObjectType objType : sobjects)
        		{
            		objDescribe = objType.getDescribe(); 
            		String sobjectPrefix = objDescribe.getKeyPrefix();
            		if(parentid != null && sobjectPrefix != null && parentid.startsWith(sobjectPrefix))
            		{
                		string objectType = objDescribe.getLocalName();
                		System.debug('********************ELSE***********'+objectType);
                		objectType = objectType + 'Feed';
                		
                		String qryString = 'SELECT Id, contentData FROM ' + objectType + ' WHERE id' + '=' + '\'' + f.id + '\'';  
                		system.debug('***********************Build Query == ' + qryString);
                		
                		SObject resultObject = Database.query(qryString);
                		 
                		

 

 

May be a dumb question, but... If there is new functionality, say, new object fields that I would like to code against in Spring '12...how do I do this in eclipse and save the code to my Winter '12 dev environment (save to server)? Eclipse barks back saying invalid field. I would like to update my code for Spring '12 and push my managed package to a Spring '12 pre-release sandbox for testing. Is this possible? Thanks.

Hello,

 

I know there are pre-built solutions out there for archiving chatter posts and comments for compliance reasons, but for cost reasons, my team needs to create our own.

 

I am thinking we could just write some triggers to email every post/comment to an internal email address, and use our existing email archiving/compliance solution (Smarsh, etc.) to track the content.

 

Any issues with that? Any better suggestions?

 

Thanks!

Erik

Hi,

 

Pls give your thoughts/suggestions to backup chatter data. Following is my current strategy.

 

Of the various aggregate feed objects like NewsFeed, UserFeed etc UserProfileFeed is the one most useful for Chatter backup. UserProfileFeed gives us the entire information about a users activity related to chatter. This is given by NewsFeed too but NewsFeed additionally gives us information about the users/objects followed by a particular user. If we use NewsFeed for Chatter backup then we will have lots of duplication.

The following query gives us the entire chatter data for a particular user.

Select Id, ParentId, FeedPostId, Type, CreatedById, CreatedDate, IsDeleted,
LastModifiedDate, SystemModstamp, CommentCount, LikeCount, Title, Body,
LinkUrl, ContentData, ContentFileName,ContentDescription, ContentType,
ContentSize, InsertedById , (SELECT Id, FieldName, OldValue, NewValue
 FROM FeedTrackedChanges ORDER BY Id DESC), (SELECT Id, CommentBody,

CreatedDate, CreatedBy.FirstName, CreatedBy.LastName  FROM FeedComments

ORDER BY CreatedDate),  (SELECT CreatedBy.FirstName, CreatedBy.LastName 

FROM FeedLikes) FROM UserProfileFeed with userId='<user-id>'

The above query can be optimized by observing that the records for which feedItem.Type='TrackedChange' can be removed if they have no comments made on them i.e FeedItem.commentCount > 0 then and only then include them for backup.

 

Additionally  we will need to back up the EntitySubscription object so as to capture
all the follower-followee combinations.

And finally these collab objects need to be backed up too. CollaborationGroup and CollaborationGroupMember.

 

However one   question I am struggling with is this.
What if the parentId points to an object instead of a user?

Then should the Chatter backup also backup the entire object too.

Hello All,

 

I'm having an issue dynamically setting an sobject variable type. What I'm trying to do with this snippet is dynamically determine the object feed that this chatter feed item is posted to and then query that object feed via dynamic soql so that I can later reference the query results. This works fine up until the point of storing / referencing the query results.

 

See my last line of code. Instead of 'sobject', I need this to be AccountFeed or ContactFeed or LeadFeed (the point is this part must be dynamic). I already have the dynamic sobject type in the variable objectType, but apparently cannot use a variable to set the type of another variable.

 

So how can I dynamically define this resultObject variable? Or is there another way to do this, as with the generic sobject? Problem is, I need to reference the ContentData field with: resultObject.ContentData and cannot do this with sobject (unless I'm referecing sobject incorrectly).

 

Thanks,

 

Chris

 

 

 

Map<String,Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();   
               	List<Schema.SObjectType> sobjects = schemaMap.values();
        		List<Sobject> theObjectResults;
        		Schema.DescribeSObjectResult objDescribe;
       			List<Schema.SObjectField> tempFields;
        		for(Schema.SObjectType objType : sobjects)
        		{
            		objDescribe = objType.getDescribe(); 
            		String sobjectPrefix = objDescribe.getKeyPrefix();
            		if(parentid != null && sobjectPrefix != null && parentid.startsWith(sobjectPrefix))
            		{
                		string objectType = objDescribe.getLocalName();
                		System.debug('********************ELSE***********'+objectType);
                		objectType = objectType + 'Feed';
                		
                		String qryString = 'SELECT Id, contentData FROM ' + objectType + ' WHERE id' + '=' + '\'' + f.id + '\'';  
                		system.debug('***********************Build Query == ' + qryString);
                		
                		SObject resultObject = Database.query(qryString);