Help with "Record Not Found"

Help with "Record Not Found"

"Record Not Found" is not necessarily an error message, but a situation I want to prevent from disabling my Deluge script, and allowing it to finish with some alternative output. In it, The code is in a CRM custom function, and I'm searching for a record in the "Products" module of the CRM.

productSearchCriteria="(Product Name|=|" + ws1 + ")";
productSearchResults = zoho.crm.searchRecords("Products",productSearchCriteria);

This 2 line approach is necessary because "ws1" is a variable.

The problem I've observed is that if the value of ws1 is not found in the Products module, the script seems to end.
I've tried putting in a test for the size of the maplist(?) "found" in the search...

if(productSearchResults.size()  !=  0)

but that does not seem to work.

I'm wondering if I should be approaching this differently by using searchRecordsByPDC instead. Will that provide a means to catch a failed search and allow the script to finish?

    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


                                                                                  Zoho Show Resources


                                                                                    Zoho Writer Writer

                                                                                    Get Started. Write Away!

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

                                                                                      Zoho CRM コンテンツ






                                                                                        Nederlandse Hulpbronnen


                                                                                            ご検討中の方