We are facing an issue related to Apex-Roll; when we unlink or remove the lookup field from a child record, the calculations on the parent record are not correct. #546
Unanswered
Tushar-013
asked this question in
Q&A
Replies: 1 comment 1 reply
-
I will take a look at this. Apologies for the delay in response! |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We are facing the issue related with Apex-Roll.
We are currently experiencing an issue with Apex Rollup: when we unlink or remove the lookup field from a child record, the calculations on the parent record are not correct.
Description of Implementation and Issue:
We have a requirement to perform a roll-up calculation to determine the sum of the ‘Amount’ field for records in the ‘Temp Transaction’ object. This roll-up should be applied to corresponding fields on the ‘Temp Disclosure’ object, with variations based on the record types (A, B, and C) in the ‘Temp Transaction’ object. Specifically, the sum of amounts should be populated in different fields on the 'Temp Disclosure' object, depending on the record type.
Eg:
Sum of All Temp Transactions record of Record Type A -> Sum of Record A Trnx field
Sum of All Temp Transactions record of Record Type B -> Sum of Record B Trnx field
Sum of All Temp Transactions record of Record Type C -> Sum of Record C Trnx field
Roll Up Setup in Custom MetaData:
We setup the Custom metadata for Rollup and create 3 manage records:
Rollup_Temp_Trnx_Amt_on_Sum_Record_A
Rollup_Temp_Trnx_Amt_on_Sum_Record_B
Rollup_Temp_Trnx_Amt_on_Sum_Record_C
Trigger setup as per documentation:
We create Temp Disclosure Record and attach it to the Temp transactions.
Temp Disclosure Record:
Temp Transaction Record:
After removing the lookup field from the Child Object record (Temp Transaction Record) for Record Type B, the calculation is not proper. It subtracts the amount of Record Type B from all fields: Sum of Record A TRNX, Sum of Record B TRNX, and Sum of Record C TRNX. However, ideally, it should only subtract the amount from the 'Sum of Record B TRNX' field in Temp Disclosure because we have already specified the conditions in the custom metadata.
Calculated Amount after the removing lookup field from Record Type B record of Temp Transaction.
The calculated sum is incorrect for the 'Sum of Record A TRNX' and 'Sum of Record C TRNX'.
Can you please provide guidance regarding the issue or help us by suggesting some solutions on how we can fix this?
Beta Was this translation helpful? Give feedback.
All reactions