Here is one way. Create a new Table Occurrence of the Invoices table and create a relationship between your Customer Table with it based on CustomerID. In the Edit Relationship dialog window there is a sort records checkbox - use that and sort your records based on the invoice date descending. Then on your customer layout if you add the date field from the new Table Occurrence it will always show you the data from the first record it sees across that relationship, which will be the one with the latest date.
See attached sample file. HTH. Chris
Customers Latest Invoice.zip 66.5 K
if the relationship is sorted by date, this calculation (unstored) in the customer should work:
This handy function works on repeating fields, yes! But also on related fields.
If you don't like it unstored calc, the field can be a date and Set (via script trigger or when a new invoice is committed).
Thank you both. Sorting the relationship made it work like I've been trying to get it to work--but now it works so well it has suddenly uncovered the need for me to do some housecleaning.