Function Code Not Working

Function Code Not Working

Can someone tell me what is wrong with this code? It says it executed successfully, but nothing happens.
I believe I have all the field and form links correct.



void undoButton()
{
for each a in Memory[Undo == "Undo"]
{
if(a.InOut == "In")
{
insert into Movement
[
Movement="Out"
Quantity=a.Amount
Material=a.Parent_Material
Sub_Material=a.Sub_Material
Added_User=zoho.loginuser
]
}
else if(a.InOut == "Out")
{
insert into Movement
[
Movement="In"
Quantity=a.Amount
Material=a.Parent_Material
Sub_Material=a.Sub_Material
Added_User=zoho.loginuser
]
}
}
}

    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