+ Start a Discussion
Ron WildRon Wild 

Chatter not accessible by Customer Portal Users?

I've set up a simple trigger to insert a FeedPost when one of my Customer Portal Users creates an entry through Sites and found that the trigger only works when I create an entry from inside Salesforce (as a regular SF user).

 

When a Customer Portal User creates an entry, the trigger fails with the error: "Invalid type: FeedPost"  

 

The API version on all the code is 18.0.

 

I've also tried putting the "insert FeedPost" call in a class without sharing, but it still fails in the Customer Portal context.

 

What are the limitations on integration Chatter with Sites and Customer Portal Users?   Can we even trigger chatter activity from portal user actions?

 

- R

 

 

(This is just a test case ... I know the trigger isn't set up to handle bulk inserts)

 

 

trigger ItemReview on Item_Review__c (after insert) {

	
	for (Item_Review__c review :trigger.new) {
		Chatter.feedPost(review.Item__c,  'A review has been posted for this item.'
				,null);
		
	}

}

 

 

 

 

 

public without sharing class Chatter {

	public static void feedPost(String parentId, String body, String link) {
		try {
		   FeedPost fpost = new FeedPost();
		   fpost.ParentId = parentId; //eg. Opportunity id, custom object id..
    		    fpost.Body = body;
    		    insert fpost;	
            	 
        } Catch (Exception ex) {
            	
        }
		
	}
}

 

 

Ron WildRon Wild

I just saw cloudcoder's post on Sites vs. portal access to chatter objects which helps partially:

 

http://community.salesforce.com/t5/Chatter-Development/Chatter-and-Site-Chatter-and-Customer-Portal/m-p/176782#M87

 

But I'm still concerned about the trigger failing when an object is inserted by the authenticated Sites user and not a standard user ... running with sys admin priviledges, shouldn't the trigger work?

 

- R

Ron WildRon Wild

It would be nice to get confirmation from someone at Salesforce on this ... but it appears that you can't build Chatter triggers on events that might be caused by Customer Portal Users or the triggers will cause the action to fail.

 

Even if the Chatter code is wrapped in a try/catch.

 

Anyone have thoughts on this?

 

- RW

Always ThinkinAlways Thinkin

I just encountered this condition too. A new <List>FeedPost(); on Account throws the error below when an Apex trigger is executed by a Customer Portal user. 

Apex script unhandled trigger exception by user/organization:
Source organization: 
Account: compiling trigger body

caused by: line 68, column 34: Invalid type: FeedPost

 I thought it might be some related trigger or class firing so I increased all the versions to 19.0 but I guess it's actually the Customer Portal User's inability to access the object.

 

Hope we hear from SFDC soon that they're fixing this!

 

PerGeertPerGeert

Got the same error today but wasn't able to reproduce it in our Sandbox running Spring '11. As an intermediate solution I am trying to put a try-catch block around all the code.