Error when using zoho.crm.getRecordById and no record found

Error when using zoho.crm.getRecordById and no record found

I am trying to use the zoho crm api function zoho.crm.getRecordById but get an error when this function does not find a value.

How can i prevent this error?

  1. Error in executing Set Variable task. Unable to update template variable crmRecord. Error evaluating MAP expression :

The code I am using is as follows:

  1. crmRecord = zoho.crm.getRecordById("Leads", quote.Lead_ID.toLong());

Some background on my applications...
When a lead is created in crm it passes the lead ID to creator. 
The trouble I have is when the crm lead is converted the Lead ID no longer exists and then this error arises.

I think i need to be able to check if the  crmRecord is null or has a zero record count. Since i cant use count function here how can i solve this problem if im getting the error just by using the api?



    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