Updating Feild by itself and code not working on new line on subform

Updating Feild by itself and code not working on new line on subform

Hello,

I created a subform for recording time then I wrote a code like below but this code is working only for 1. row.

When I tried to add new record the code doesn't work.

Also the field isn't updating by itself. I have to insert random time first the it updates itself.

If you help me, I will be grateful.

Thanks




input.TIME_RECORD.Time = 00;
HourStartTime = input.TIME_RECORD.START.getHour();
HourEndTime = input.TIME_RECORD.FINISH.getHour();
MinuteStartTime = input.TIME_RECORD.START.getMinutes();
MinuteEndTime = input.TIME_RECORD.FINISH.getMinutes();
for each  add_new in TIME_RECORD
{
Hour = HourEndTime.tolong() - HourStartTime.tolong();
Min = MinuteEndTime.tolong() - MinuteStartTime.tolong();
if(Min <= -1)
{
Hour = Hour - 1;
Min = MinuteEndTime.tolong() + 60 - MinuteStartTime.tolong();
}
}
input.TIME_RECORD.Time = input.TIME_RECORD.Time.addHour(Hour);
input.TIME_RECORD.Time = input.TIME_RECORD.Time.addMinutes(Min);

    Access your files securely from anywhere

        Zoho Developer Community




                                  Zoho Desk Resources

                                  • Desk Community Learning Series


                                  • Digest


                                  • Functions


                                  • Meetups


                                  • Kbase


                                  • Resources


                                  • Glossary


                                  • Desk Marketplace


                                  • MVP Corner


                                  • Word of the Day



                                      Zoho Marketing Automation


                                              Manage your brands on social media



                                                    Zoho TeamInbox Resources

                                                      Zoho DataPrep Resources



                                                        Zoho CRM Plus Resources

                                                          Zoho Books Resources


                                                            Zoho Subscriptions Resources

                                                              Zoho Projects Resources


                                                                Zoho Sprints Resources


                                                                  Qntrl Resources


                                                                    Zoho Creator Resources



                                                                        Zoho Campaigns Resources


                                                                          Zoho CRM Resources

                                                                          • CRM Community Learning Series

                                                                            CRM Community Learning Series


                                                                          • Kaizen

                                                                            Kaizen

                                                                          • Functions

                                                                            Functions

                                                                          • Meetups

                                                                            Meetups

                                                                          • Kbase

                                                                            Kbase

                                                                          • Resources

                                                                            Resources

                                                                          • Digest

                                                                            Digest

                                                                          • CRM Marketplace

                                                                            CRM Marketplace

                                                                          • MVP Corner

                                                                            MVP Corner





                                                                              Design. Discuss. Deliver.

                                                                              Create visually engaging stories with Zoho Show.

                                                                              Get Started Now