How to create a record calculated field based on values from associated detail records? Or something similar
Im trying to create a calculated field to show a total of all records from a detail on a record, ive looked into using sql views, however I'm not sure if that would work as you cant filter by the record I don't think, are there any code solutions or anything similar?
Like
Hello,
You can try creating an integer column in the page (and in the object that this page represents) and create a business process that will change the value in this column once the record is added to the detail (or decrement once the value is removed). This way you can create the logic without additional code that will save resut in the server.
If you still want using the code - something similar is the functionality of the order product detail summary (that displays the number of products in order, can be found on the order page in the "products" tab). This logic can be found in the updateSummary method from the OrderProductDetailV2 from the Order package.