Print this page

How do I report on the latest/most recent record child record for any master record?

Knowledge Article Number 000002384
Description How to get a report that only displays the latest or most recent child records to any master record.
Resolution

To get a report that only displays the latest or most recent child records to any master record, you must first be aware that this is not truly possible without custom code.

With this in mind, we can, however, obtain a list most recent records that were created on the most recent day for Master-Detail Relationship. This solution is not a recommended substitute for code, as code would be the only way to get the true results.

Instructions:

  1. Create a custom date field on the Master object. Name it "Last <Master Object Name> Date".
  2. Create a workflow rule that does a field update to "Last <Master Object Name> Date" when a <Detail Object Name> Record is created.
  3. Create a formula field on the <Detail Object Name>. The formula field will be a number field (Does not need to be on page layout). The name can be "Most Recent Record"
    • IF( DATEVALUE(<Detail Object Name>_Created_Date__c) = Last_<Master Object Name>_date__c,1,0)
  4. Create an <Master Object Name> with <Detail Object Name> report with a filter of "Most Recent Record" = "1"


NOTE - This report will only get you the most recent days results. So if there are 3 child records for the most recent day, then 3 child records will appear for the report. The only way around this is custom code.

If the above will not resolve your issue, then please vote on one of the following ideas exchange ideas.

https://success.salesforce.com/ideaView?id=08730000000Bp9x
https://success.salesforce.com/ideaView?id=08730000000Bp6fAAC
https://success.salesforce.com/ideaView?id=08730000000BoxtAAC


 





promote demote