Discussions
- General Development
- Schema Development
- Apex Code Development
- Visualforce Development
- Formulas & Validation Rules
- Security
- Mobile
- Force.com Sites & Site.com
- Chatter Development
- Java Development
- .NET Development
- Perl, PHP, Python & Ruby
- Desktop Integration
- APIs and Integrations
- Visual Workflow
- Apple, Mac and OS X
- VB and Office Development
- AppExchange Directory & Packaging
- Salesforce Labs & Open Source Projects
- Other Salesforce Applications
- Jobs Board
- Force.com Discussion Boards
- :
- Developer Boards for Force.com and Database.com
- :
- Chatter Development
- :
- Re: Am trying to deleting feeds from the chatter t...
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Am trying to deleting feeds from the chatter the correpondi ng records are also deleting.. .....
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-02-2012 08:33 AM
When ever am inserting record into "Emp_7_10__c" this custom object am inserting follow on the chatter. But i want to delete those follow from the chatter. But when am deleting follow from the chatter the corresponding records also deleting.
Any one give idea how to delete only follows on the chatter.
the following code am using to insert follow on the chatter:
--------------------------------------------------
trigger SendNotification on Emp_7_10__c (after insert)
{
if( Trigger.isInsert)
{
for (Emp_7_10__c e : Trigger.new)
{
if ( e.Id != null)
{
FeedItem post = new FeedItem();
post.ParentId = e.Id;
post.Title = e.Name;
post.Body = 'My custom Chatter Notification';
post.LinkUrl = 'google.com';
insert post;
}
}
}
}
==================================================
The following code am trying to delete follow from the chatter. But records also deleting from the object.
Emp_7_10__c[] emp = [select Id from Emp_7_10__c];
delete emp;
Re: Am trying to deleting feeds from the chatter the correpondi ng records are also deleting.. .....
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-02-2012 11:22 PM
Hello Krish,
If you are trying to delete the Following subscription, you need to delete the Ids of the EntitySubscription Object.
--------------------------------------------------
List<EntitySubscription> es = [Select Id, ParentId, SubscriberId, CreatedById, CreatedDate FROM EntitySubscription WHERE ParentId=recordId and SubscriberId=userId];
delete(es);
--------------------------------------------------
recordId - SFDC recordId which User is Following (can be any object like Account,Contact,Emp_7_10__c etc.,)
userId - is the SFDC User Id of the User who is following the record
Refer to this LINK for more details.
Regards,
Bharathi
Salesforce For All
Mrk this post as solved, if it helps you

