Cant get a schedule function to run correctly
Hello I have a custom function that I have written and I know works as I have tested it in a workflow, I need the function to run every morning at 6am so have created a schedule but when I create the function in the schedule I cannot associate the argument with the correct module to get the ID.
the module is called Sales_Contract. my code is attached below.
any help would be great thanks.
Cheers Kevin
- ScDetails = zoho.crm.getRecordById("Sales_Contract",salescontractId.toLong());
- info ScDetails;
- date1 = ifnull(ScDetails.get("Start_Date"),"");
- date2 = ifnull(ScDetails.get("End_Date"),"");
- currentDate = today;
- info date1;
- info date2;
- info currentDate;
- //if(date1 != "")
- if(currentDate > date1.toDate() && currentDate < date2.toDate())
- {
- Status1 = "Open";
- mp = Map();
- mp.put("Status",Status1);
- updateRecord = zoho.crm.updateRecord("Sales_Contract",salescontractId.toLong(),mp);
- info mp;
- info updateRecord;
- }
- else if(currentDate > date2.toDate())
- {
- Status2 = "Closed";
- mp = Map();
- mp.put("Status",Status2);
- updateRecord = zoho.crm.updateRecord("Sales_Contract",salescontractId.toLong(),mp);
- info mp;
- info updateRecord;
- }
- else if(currentDate < date1.toDate())
- {
- Status3 = "Awaiting Start";
- mp = Map();
- mp.put("Status",Status3);
- updateRecord = zoho.crm.updateRecord("Sales_Contract",salescontractId.toLong(),mp);
- info mp;
- info updateRecord;
- }