I would like to capture the most recent record of one object and capture on a different object. I am looking at Declarative Rollup Summary or Flow to do this. Use case is - we have clients with leases. I would like to capture on the client record, their current (most recent lease). I can use DLRS to get the max lease date, but want I really want is a link to the Lease Record. Not a Master-Detail relationship. I tried with DLRS using Name as the Field to Aggregate, Order By Date, Aggregate Operation as Last. The rollup summary log shows all failed with a Malformed_ID error. I am unsure if I got something wrong in the set up or if this is just not possible with DLRS. The other option is Flow, but I want DRLS to work.... Am I missing something? Does this have to be done in Flow? Thank you
@Tammy Verticchio DLRS can’t populate a lookup field with the records Name text — it requires the Id of the related record. If you want DLRS to set a Current Lease lookup on the Client, try these adjustments:
- Create a lookup field on Client - Lease i.e; Current_Lease__c
- In DLRS, aggregate the Id field, not Name.
- Use Aggregate Operation = Last and set your Order By to the date field that defines most recent
- Point the Aggregate Result Field to your new lookup Current_Lease__c - lookup field
That way, DLRS will capture the actual Lease Id and populate the link.
If you still have issues or prefer a native approach, a Record-Triggered Flow can do the same thing query most recent Lease, update client’s current lease lookup
https://www.salesforceben.com/guide-to-salesforce-dlrs-declarative-lookup-roll-up-summaries/