Deluge Workflow: Cannot insert and retrieve a new record

Deluge Workflow: Cannot insert and retrieve a new record

I've got a calendar app that lists events for different high school sports. It needs to import non-standardized excel spreadsheets - the school does not force standardized sheet layout from each coach - and create events for the season. I do some manual data cleaning before importing but for obvious reasons I don't want to manually do every event.

Adding an event requires the user to enter a date time, an opponent, and a location school name (not address), but many coaches just write "here" or "there" for location instead of the actual location...

The code below attempts the following - if "here", then replace location field with the school name. If "there", 1) check to see if location exists 2) if yes, change field value, 3) if no, Add the record to the Location form and then change the field value to the newly added location.  Parts 1 and 2 work just fine, but I cannot get Zoho to insert the new record and retrieve it... any thoughts?

Problem is lines 20-30. This code is in the Events form, triggered "on Success".
  1. LocHome = "HERE";
  2. LocAway = "THERE";
  3. Opp = input.Opponent.Opponent_Name;
  4. LocVal = Location[Location_Name.equalsIgnoreCase(Opp)];

  5. if(Location.Location_Name.equalsIgnoreCase(LocHome))
  6. {
  7. //If Location is "here", make location field equal to School name. 
  8. LocVal = Location[Location_Name.equalsIgnoreCase(input.School.School_Name)];
  9. input.Location = LocVal.ID;
  10. }
  11. else if(Location.Location_Name.equalsIgnoreCase(LocAway))
  12. {
  13. //See if Opponent exists in Location list. If yes, change value of Location field to Opponent name
  14. if(LocVal != null)
  15. {
  16. input.Location = LocVal.ID;
  17. }
  18. //if it does not exist, create the location and change value of Location field to Opponent name
  19. else if(LocVal = null)
  20. {
  21. insert into Location
  22. [
  23. Added_User=zoho.loginuser
  24. Location_Name=input.Opponent.Opponent_Name
  25. ];
  26. NewLocRecord = Location [ Location_Name == input.Opponent.Opponent_Name ];
  27. input.Location = NewLocRecord.ID;
  28. }
  29. }

    Zoho Desk Resources

    • Desk Community Learning Series


    • Digest


    • Functions


    • Meetups


    • Kbase


    • Resources


    • Glossary


    • Desk Marketplace


    • MVP Corner


    • Word of the Day


      Zoho CRM Plus Resources

        Zoho Books Resources


          Zoho Subscriptions Resources

            Zoho Projects Resources


              Zoho Sprints Resources


                Zoho Orchestly 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




                          Zoho Writer Writer

                          Get Started. Write Away!

                          Writer is a powerful online word processor, designed for collaborative work.

                            Zoho CRM コンテンツ




                              ご検討中の方