How to fetch record with multi condition and sort by desc
I would like to create a serial number; the code is by year and month: [YYMMXXXX], XXXX is from 0001 to 9999.
I create two fields as condition of filter, the Deluge code is:
- if(SerialNo == "")
- {
- CurrentYear = zoho.currentdate.getYear();
- CurrentMonth = zoho.currentdate.getMonth();
- query_map = Map();
- query_map.put("Create_Year",CurrentYear);
- query_map.put("Create_Month",CurrentMonth);
- query_map.put("sort_by","Serial_No");
- query_map.put("sort_order","desc");
- RecRequest2 = zoho.crm.getRecords("Request",1,5,query_map);
- if(RecRequest2.size() > 1)
- {
- NewSerialNo = RecRequest2.get(1).get("Ticket_No").toLong() + 1RecRequest2.get(1).get("Ticket_No").toLong() + 1;
- }
- else
- {
- NewSerialNo = CurrentYear.toString() + CurrentMonth.toString() + "0001";
- }
- }
The "query_map" with two condition: create year and month, but the "RecRequest2" are not including the condition, the result of Create Year and Create Month is empty.
How can I fix it?