+ Start a Discussion

Dashboard Posting

We have a requirment to allow Dashboard elements to posted into Chatter feeds but only into a user or group feed, not into the dashboard itself.

I have written the code

    for (FeedItem f : trigger.new){          
        fParent = f.ParentID;
        if (fParent != null && fParent.startsWith('01Z')){
            f.addError('You can only comment on existing posts in this group.') ; 

This prevents the post into the dashboard but instead of returning the friendly error message it shows a general error in a alert window:

"An error occurred while processing your request. The salesforce.com support team has been notified of the problem. If you have additional information that may helpful for reproducing or correcting the error, please contact Salesforce Support at support@salesforce.com. Please indicate the URL of the page you requested, any error ID shown below, and any related information. We apologize for the inconvenience. Thank you again for your patience and assistance. And thanks for using salesforce.com!"

Is there a way around this?

Jia HuJia Hu

Your code works for me perfectly.

Did you figure out what is the problem now?


Salesforce support acknoledge this as a bug and it has not been fixed.

I have tested and I am still getting the error.


Can you confirm that you can get it to return the error message when trying to post a dashboard component into the dashboard. It works just for posting a chatter message but errors on the dashboard component.


Jia HuJia Hu

Sorry for my miss. 


You are right, it is OK for message, but got the same error when post dashboard component.


However, if you donot allow the Chatter for dashboard, why not disable Chatter on the dashboard.


Problem is that we want users to be able to post dashboard components to groups and other users, but do not want to clutter the dashboard itself with posts.


Jia HuJia Hu
Dig into the doc and find:
Only FeedItems of Type TextPost, LinkPost, and ContentPost can be inserted, and therefore invoke the before or after insert trigger.

I guess DashboardComponentSnapshot type is not really supported in the trigger so far.