You need to sign in to do that
Don't have an account?
XIO
Apex Test Class for FeedItem Issues
Hello Developers,
I'm having a lot of issues with creating an apex test class for the FeedItem apex trigger below. The trigger basically blocks all users from deleting attachments from Chatter Feed on the custom object (Documents Manager) expect the certain few users and profile. Any assistance creating the test class so we can deploy to production will be greatly appreciated!!
I'm having a lot of issues with creating an apex test class for the FeedItem apex trigger below. The trigger basically blocks all users from deleting attachments from Chatter Feed on the custom object (Documents Manager) expect the certain few users and profile. Any assistance creating the test class so we can deploy to production will be greatly appreciated!!
trigger ChatterDeleteBlocker on FeedItem (After Delete) { User u = [SELECT id, Name, ProfileId,Profile.Name FROM User WHERE id = :UserInfo.getUserId()]; for(FeedItem fi : trigger.old) { Document_Manager__c dm = new Document_Manager__c(); try { dm = [Select Id from Document_Manager__c where Id =:fi.ParentId]; } catch(Exception e) { dm = null; } if (dm != null) { if(fi.type == 'ContentPost' && (u.Profile.Name != 'System Administrator') && (u.Name != 'Bryan Girkins' && u.Name != 'Mary Loy' && u.Name != 'Judit Szilagyi' && u.Name != 'Sarah Swanson' && u.Name != 'Jeremy DalleTezze')) { fi.addError('You do not have the permissions to delete files from chatter feed'); } } } }
https://developer.salesforce.com/forums/?id=906F000000093BgIAI
All Answers
https://developer.salesforce.com/forums/?id=906F000000093BgIAI