7

Trusty old ChildRelationship to the rescue: for (ChildRelationship relation : SObjectType.Topic.getChildRelationships()) system.debug(relation); Relevant relationships and properties: [getChildSObject=FeedComment;getField=ParentId;getRelationshipName=null;] [getChildSObject=FeedItem;getField=ParentId;getRelationshipName=null;] You should just be ...


5

Sometimes fields declared as Reference do not really work as references. In such cases you need to use some ugly workarounds like this one: SELECT Id, FeedItemId, ParentId, RelatedRecordId FROM FeedComment WHERE FeedItemId IN ( Select id from FeedItem WHERE Parent.Type = :mySObjectType )


4

The answer is pretty unbelievable, and almost certainly a Salesforce bug. This fails when run as a Standard Platform User: Id ii = UserInfo.getUserId(); List<FeedItem> fis = [Select Id from FeedItem i where i.Id = :ii]; But this works: Id ii = UserInfo.getUserId(); List<FeedItem> fis = [Select Id from FeedItem where Id = :ii]; A regular ...


3

You need to use ConnectApi.QuestionAndAnswers.updateQuestionAndAnswers after this. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_ConnectAPI_QuestionAndAnswers_static_methods.htm?search_text=bookmark#apex_ConnectAPI_QuestionAndAnswers_updateQuestionAndAnswers_1 ConnectApi.QuestionAndAnswersCapability result = ConnectApi....


3

CaseComment is the classic "Case Comment" object, not related to feed items at all. You're looking for FeedComment, which contains comments on feed items.


3

Some of the System fields are not editable. So in other words you can not modify createddate of record. This done by design and there are few exceptions for while performing data migration Salesforce support can allow you to update created date or last modified date for few days but in general its not not mean to be edited by user. If its Critical business ...


2

I don't know if understand your question, but if you want to post a comment, you can use: Chatter Rest API: http://www.salesforce.com/us/developer/docs/chatterapi/ Apex Controller: http://www.salesforce.com/developer/docs/api/Content/sforce_api_objects_feedcomment.htm#topic-title


2

trigger FeedCommentUpdate_Account on FeedComment(after Insert, after Update) { String accKeyPrefix = Account.sObjectType.getDescribe().getKeyPrefix(); Map<Id, feedComment> mapIdByFeedComment = new Map<Id, FeedComment>(); for(FeedComment fc : trigger.new){ if (parentId.startsWith(accKeyPrefix)){ mapIdByFeedComment....


1

In addition to the answer already presented, you can't use LIKE operator on an id field, as mentioned in the docs The LIKE operator is supported for string fields only. Id is not a string field, hence you can't use LIKE with Id fields. As for the FeedComment object, I think the referential ids not being accessible via SOQL, is because this object ...


1

Today I have received a feedback that they have opened a Known Issue https://trailblazer.salesforce.com/issues_view?id=a1p4V000002Zl10QAC The workaround is the erase the unpackaged custom settings Settings__c


1

I have created two triggers on one ContentVersion and other on ContentDocumentLink and tried to upload the files using chatter comment. i found both the trigger is firing if you are uploading a new file. If you are adding a file directly from salesforce, The trigger will not fire for contentVersion, but will fire for ContentDocumentLink. If you are in ...


1

A_Elric, From a design standpoint, I would probably add a checkbox custom field to the User object, which is used to indicate whether that user's feed comments should automatically update the Cases' Last_Chatter_Feed_Timestamp__c. I also would like to point out that FeedComment objects are the reply comments added to existing FeedItem objects. So if a user ...


1

Files are uploaded before being attached to the Comment. You would have to prevent all file uploads. Otherwise a user could upload a file, then copy a link and insert it into the comment body. Why do you want to prevent file uploads in comments?


1

CreatedDate being a System Audit field, we cannot edit this field. You can set this field while performing Data Import. Enable Create Audit Fields


1

Trigger is looking good, but I'd still like to offer my $0.02 and summarize the discussion thus far. A couple points: Bulkify the Trigger. Your Update CaseToUpdate could potentially cause an issue. The only scenario that will cause a problem is if you need to load FeedComments via DataLoader. You're only allowed 150 DML statements, so if 200 FeedComments ...


1

The answer is all in the documentation: Supported Calls delete(), describeLayout()describeSObjects(), query(), retrieve(), search(), undelete(), update() https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_contentdocument.htm As you can see, no create(), so you cannot insert a new one with data loader


1

Currently, your trigger is only being fired upon the insertion of a FeedItem. You need to write a similar trigger for FeedComment insertion.


1

This is not possible.Here is the idea link. https://success.salesforce.com/ideaview?id=08730000000GwN7AAK Workaround is to use @Mention user if you want to send notification to user on the record.


1

You can use the PostComment Method on the ConnectAPI (which is effectively an Apex enabled version of the Chatter REST API) if you know the FeedItem/Feed Element you are trying to post to: From docs: ConnectApi.Comment comment = ConnectApi.ChatterFeeds.postCommentToFeedElement(null, '0D5D0000000KuGh', 'I agree with the proposal.' ); Where first param ...


1

Any SObject ID can return the type of the SObject it references via the getSObjectType() method. So this approach (I haven't tried it) should achieve your first filter of limiting the trigger to only act on Case feed comments: for (FeedComment cd : Trigger.new) { if (cd.FeedItemId.getSObjectType() == CaseFeedItem.SObjectType) { // Do work } }...


1

There's a different method that you can use to control the number of comments that get returned. The parameter is called recentCommentCount. Instead of using this method: ConnectApi.ChatterFeeds.getFeedItemsFromFeed(String communityId, ConnectApi.FeedType feedType, String subjectId) Use this one: ConnectApi.ChatterFeeds.getFeedItemsFromFeed(String ...


Only top voted, non community-wiki answers of a minimum length are eligible