Is it possible to roll-up a child record Id into a parent look-up field? #457
-
I have a parent 'asset' object, and I have a child 'valuation' object with potentially many valuation records per asset. I have a look-up field on the parent where I put the most recent valuation child record Id (called 'valuation_link__c') to enable a user to easily jump from the parent record to the most recent, relevant valuation child record, and to enable formula fields on the parent to show values from the relevant child. I was wondering whether Apex roll-up can do this for me? i.e. when I am loading thousands of new valuation records into the child object, and each one is related to its parent, rather than running a flow on each child record to update the parent link field if it is newer than the current occupant, can Apex roll-up evaluate the most recent valuation child record per parent, and update the top valuation record id into the lookup field on the parent object? I tried setting it up, but the full recalculation fails, and the log files shows an error 'list index out of bounds: 4' |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
Yes, you should be able to do this and while there are a couple of different ways, the easiest might be:
That ought to handle things nicely! |
Beta Was this translation helpful? Give feedback.
-
Let's take these one at a time:
|
Beta Was this translation helpful? Give feedback.
@cdevelin this is a bug that I can fix with an updated version, but I think you'll be able to get it working on your end if you remove the Limit Amount argument on your rollup custom metadata record. Let me know if that works!