0

Is it possible to restrict certain users from deleting note entries in the Feed section? Need to restrict some users because we are having problems all the time with this.enter image description here

1
  • Can you pls post a picture about which entries you dont want to delete? Commented Jan 26, 2017 at 20:08

1 Answer 1

2

There may be a simpler method, but this is what I have for now.

Write a trigger on FeedItem on before delete and stop selected users from deleting a note:

trigger feedtrigger on FeedItem (before delete) {
    for(FeedItem  fed: Trigger.Old){
        if(fed.type == 'Contentpost'){
            //Do further checks based on profile/role/Id etc and restrict the user from deleting the note.
            fed.adderror('You cannot delete the note');
        }
    }
}

Note: You can add/ adjust type and prevent users from deleting Links, poll etc..

Refer this doc for different types of feeditem:

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_feeditem.htm

You can throw a validation at the top of the page

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .