Script Troubleshooting help

Script Troubleshooting help

I have form called “Add a Student” with a multiselect field called “Enrolled Classes”.

I have another form called “Classes” with a field called "Max number of students” and a field called "Number of Students Enrolled” which counts how many students are listed as enrolled in that class.

When I load my “Add a Student" form I only want to be able to select Classes that have spots available in them. Ie: "Max number of students” < "Number of Students Enrolled”. I have a workflow to do this:

classesAvailableList = Add_a_Class[Number_of_Students_Enrolled < Max_number_of_students].ID.getAll();
input.Enrolled_Classes:ui.add(classesAvailableList);

However the issue I am having is that if I select a student to edit, any classes that where previously selected are deselected. - https://www.loom.com/share/3db7108aefc4415980e0c9eb4ca705bb 

Any ideas how I could fix this?





                            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 WorkDrive Resources



                                                                    Zoho Campaigns Resources

                                                                      Zoho CRM Resources

                                                                      • CRM Community Learning Series

                                                                        CRM Community Learning Series


                                                                      • Tips

                                                                        Tips

                                                                      • 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