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
- :
- How to get the Parent Name
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
How to get the Parent Name
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
10-17-2012 10:33 PM
Hi,
SELECT Body, CommentCount, Id, InsertedById, IsDeleted, LikeCount, LinkUrl, ParentId, RelatedRecordId, Title, Type, CreatedDate, ContentData, ContentDescription, ContentFileName, ContentSize, ContentType, Parent.Name, CreatedBy.FirstName FROM FeedItem WHERE Type != 'ContentPost' ORDER BY CreatedDate DESC
My aim is to get the Parent name and the feed created person name with the feedItem using above query.
The Parent name and created by fields are allways returing null. Kindly advice am I doing any mistake or what is the right way to get the parent name from the FeedItem.ParetnId.
Thanks,
Solved! Go to Solution.
Re: How to get the Parent Name
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
10-19-2012 08:22 AM
Hi Prem,
All all the Custom Objects will have a Feed Object if chatter Feed Tracking is enabled for that object.
For example if the custom object is Deal__c and if Chatter Feed Tracking is enabled, then Deal__Feed is the object to be queried.
For Standard Objects, you need to use FeedItem and the way of querying Parent.Name and CreatedBy.Name is correct.
Let me know if it works for you.
Thanks,
Bharathi
Re: How to get the Parent Name
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
10-21-2012 12:15 PM
do you have view all access? does this query return any results? if the parentId null as well?
Re: How to get the Parent Name
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
10-21-2012 09:09 PM - edited 10-21-2012 10:52 PM
I am getting the ParentId but the Parent.name and CreatedBy are coming as null."view All Data" Access is enabled for my account.
Re: How to get the Parent Name
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
10-24-2012 02:15 AM - edited 10-24-2012 02:15 AM
Since FirstName field on the User object is not an necessary filed, it can be null.
Basically, Parent.name should not be null.
Which object did you post on?
You can use following query to check the feed type and parent type,
FeedItem fi = [SELECT Type, ParentId, Parent.Type, Parent.Name, CreatedBy.FirstName FROM FeedItem WHERE Type != 'ContentPost' ORDER BY CreatedDate DESC limit 1];
System.debug( ' Type: ' + fi.Type + ' Name: ' + fi.Parent.Name + ' FirstName: ' + fi.CreatedBy.FirstName + ' Parent.Type: ' + fi.Parent.Type );
Re: How to get the Parent Name
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
10-31-2012 08:19 PM
I am able to get the parent name.
Solution: Parent.name is a realted object to FeedComment. If we try to get the value of it directly it returns null. Instead we need to get the children of Parent.name.
[code]
String req = "SELECT Body, ParentId, Parent.Name FROM FeedItem ORDER BY CreatedDate DESC";
QueryResult res = connection.query(req);
for(SObject s:res.getRecords()){
Iterator<XmlObject> iterator = s.getChildren();
while(iterator.hasNext()){
XmlObject xmlObject = iterator.next();
if(xmlObject.getName().toString().substring(37).eq
Iterator<XmlObject> childs = xmlObject.getChildren();
while(childs.hasNext()){
XmlObject childNode = childs.next();
System.out.println(childNode.getName()+":"+childNo
}
}else{
System.out.println(xmlObject.getName().toString()+
}
}
System.out.print("\r\n==========================\r
}
[/cpde]

