Executing scripts in a subform that update fields in ANOTHER form
Hi All,
I'm working on an app I created a while back that tracked orders for multiple clients, and updated client budgets each time an order was placed. The way I had orders set up was two forms- Orders, which contained an order as a whole, and Order_Lines, which then broke an order into lines for each client and charged the client accordingly.
This was a little convoluted, so I started trying to use the subforms feature today but find I need to make several modifications to my script in order to make this happen.
In the Order_Lines On Success area, I had the script:
- for each z in Clients
- {
- z.Monthly_Spend = Order_Lines[((Client_ID == z.Client_ID && Month == zoho.currentdate.getMonth()) && Year == zoho.currentdate.getYear())].sum(Line_Cost);
- z.Year_to_Date_Spend = Order_Lines[(Client_ID == z.Client_ID && Year == zoho.currentdate.getYear())].sum(Line_Cost);
- }
This updated a field in my Clients form. I now want to use Order_Lines as a subform to orders- where do I place this script, and what modifications do I need to make it work?
Thanks very much for your help!
Navid