I am facing the below scenario. I have 2 entities related to each other by 1 - M Relation:-
* Months Medicines, Fields: Total per month
* Days Medicines, Fields: Total per day
- 'Months Medicines' contains a grid of type 'Days Medicines'; user may attach multiple 'Days Medicines' records to it.
- Whenever any record from 'Days Medicines' is attached to 'Months Medicines', I want to add the 'total per day' from 'Days Medicines' onto 'Total per month' field in 'Months Medicines'.
- I've implemented that using a custom WF at which i send the 'Total per month' as a parameter to add on it the 'Total per day' and save the new value.
My problem is that if i attached 4 records, the WF will run 4 times at the same time with the same input value. Hence, the final value will be wrongly calculated (it will always add one record only on the value sent). I tried retrieving the value inside the code but have the same result. Is there any way to make these WFs run sequential??