Search for fields with null values

Search for fields with null values

Hi all,

I'm writing a custom function in Desk. Part of this function must search for all tickets that are unassigned in a certain department. This is the part of the code:
  1. unassignedTicketSearchCriteria = Map();
  2. unassignedTicketSearchCriteria.put("assigneeId",null);
  3. unassignedTicketSearchCriteria.put("status","Open");
  4. unassignedTicketSearchCriteria.put("departmentId",departmentId);
  5. unassignedTicketResponse = zoho.desk.searchRecords(orgId,"tickets",unassignedTicketSearchCriteria,0,100,"new_desk");
This search is returning tickets where there is an agent assigned to and unassigned. This query is ignoring the search criteria "assigneeId". What I'm suspecting is that the code interpreter is ignoring the search criteria because it reads the query as being empty (null).
I tried sending it as a string "null", this gives a data type mismatch error. I tried converting the string to Long using toLong(), this gives me an error that the parameter can't be empty. Setting it as null (like in the code above) does nothing.

Has anyone been able to get this working? 

    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