You need to sign in to do that
Don't have an account?
![Jon Billings Jon Billings](https://dfc-org-production.my.site.com/img/userprofile/default_profile_45_v2.png)
Apex class test for chatter feed item trigger
I have a trigger running that updates all chatter feed items to all with access however I can not figure out how to write the test class so we can deploy it in production. Any one able to help me out? I am skilled with salesforce process builder and other things but am just starting to dig into the apex triggers etc.
Trigger;
trigger RCTRL_Feed_share01 on FeedItem (after insert) {
List<FeedItem> newFeeds= new List<FeedItem>();
List<FeedItem> feeds=new List<FeedItem>();
for(FeedItem fei: Trigger.new){
feeds=[Select id, ParentId, Visibility From FeedItem Where id = :fei.Id];
//System.debug('id is: ' + fei.Id);
}
for(FeedItem fee:feeds)
{
fee.Visibility='AllUsers';
newFeeds.add(fee);
}
Update newFeeds;
}
Trigger;
trigger RCTRL_Feed_share01 on FeedItem (after insert) {
List<FeedItem> newFeeds= new List<FeedItem>();
List<FeedItem> feeds=new List<FeedItem>();
for(FeedItem fei: Trigger.new){
feeds=[Select id, ParentId, Visibility From FeedItem Where id = :fei.Id];
//System.debug('id is: ' + fei.Id);
}
for(FeedItem fee:feeds)
{
fee.Visibility='AllUsers';
newFeeds.add(fee);
}
Update newFeeds;
}
Or Deploy your test class by running the specific test class and include your trigger and only test class for that trigger
Run Specified Tests
Only the tests that you specify are run. Provide the names of test classes in a comma-separated list.
https://releasenotes.docs.salesforce.com/en-us/winter16/release-notes/rn_deployment_change_sets_test_levels.htm
Please close this thread if it solved
All Answers
Or Deploy your test class by running the specific test class and include your trigger and only test class for that trigger
Run Specified Tests
Only the tests that you specify are run. Provide the names of test classes in a comma-separated list.
https://releasenotes.docs.salesforce.com/en-us/winter16/release-notes/rn_deployment_change_sets_test_levels.htm
Please close this thread if it solved