1

I was trying to query Custom_Object__Share SELECT Id, ParentId,UserOrGroupId, AccessLevel, RowCause from Custom_Object__Share where CreatedDate > 2016-08-25T00:25:43Z

I am getting an error no such column CreatedDate not sure why, any inputs/help will be greatly appreciated.

1

Share Records do not have the createdDate field .

You can filter all the records using createdDate and then filter with ParentId .

map<Id,Credit_Applicant__c> maprecords = new map<Id,Credit_Applicant__c>([Select Id from Credit_Applicant__c where CreatedDate > 2016-08-25T00:25:43Z];

then run a query on share table

SELECT Id, ParentId,UserOrGroupId, AccessLevel, RowCause from Credit_Applicant__Share where  ParentId IN : maprecords.keyset();
3
  • Mohit, can I not just use lastModifiedDate? Just asking! Will there be any issues doing so? Instead of making things complicated as you suggested?
    – DJD
    Aug 25 '16 at 4:26
  • Sure you can use lastModifiedDate but its not true createdDate .It might resemble createdDate if share records are not modified Aug 25 '16 at 4:37
  • 2
    LOL! Thanks! I was more interested in why CreatedDate is not available on Share object and not on how to get around of the error I got! Cause learning that can reveal some important salesforce implementations.
    – DJD
    Aug 25 '16 at 4:42
0

I'm assuming you want to filter on the Credit Applicant record's created date (and not the share record's created date)...

Add 'Parent.' to the criteria

SELECT Id, ParentId,UserOrGroupId, AccessLevel, RowCause FROM Credit_Applicant__Share WHERE Parent.CreatedDate > 2016-08-25T00:25:43Z
3
  • Not sure what are you referring too vorno, but I want Share record's createddate.
    – DJD
    Aug 25 '16 at 4:21
  • Share records do not record the Created Date, only the parent (data) record has Created Date. There is a Last Modified Date field on the share object, but that's about it.
    – vorno
    Aug 25 '16 at 4:23
  • That is what I commented on Mohits answer as well. But I am more interested in learning why salesforce wouldn't give createddate on share record ?
    – DJD
    Aug 25 '16 at 5:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.