Books Custom function - Not executing..

Books Custom function - Not executing..

Use case :
Module involved = Invoice
When an Invoice is "Approved", the "current date" is more than "n" days and the "Amount" to be received is more than 0
I want a cliq message to be triggered in a channel and to be executed Daily(Scheduled) at 10:30 am.
That is only if it meets the condition.

I have a custom function written. But daily it is giving an error (failure) when it gets executed.

I am attaching the script. Can anyone help me? I have contacted the ZOHO team n number of times and so far the team have not come out with any solution.
________________________

organizationID = organization.get("organization_id");
invoiceID = invoice.get("invoice_id");
invoicenumber = invoice.get("invoice_number");
StatusF = invoice.get("status_formatted");
Status = invoice.get("status");
SalesPersonaname = invoice.get("salesperson_name");
CustName = invoice.get("customer_name");
invoicededate = invoice.get("date");
invoiceBalance = invoice.get("balance");
Currencycode = invoice.get("currency_code");
invodateplus3days = invoicededate.addDay(3);
// can add any nuymber of days within bracket (3)
tday = zoho.currentdate;
Daydiff = invoicededate.daysBetween(tday);
info Daydiff;
info invoicededate;
info invodateplus3days;
info tday;
info invoicenumber;
info StatusF;
info Currencycode;
info invoiceBalance;
if(StatusF.containsIgnoreCase("Approved") && invoiceBalance >= 0 && Daydiff > 3)
{
Message = "Hi, Dear " + " " + " Prabhu (accountant), Balance of " + " " + Currencycode + invoiceBalance + "." + "  Looks like though Approved /Sent/Invoiced, payment either not received or details not marked  It is " + " " + Daydiff + " " + "days " + " " + invoicenumber + " " + StatusF + " " + " M/s " + CustName + ". " + "" + " Can obtain details if any, from the Salesperson " + " " + SalesPersonaname + " " + "Thanks.";
response = zoho.cliq.postToChannel("arbhuaccounts",Message,"invoicemsgcliq");// msg to be sent to two channels
response = zoho.cliq.postToChannel("aktest",Message,"invoicemsgcliq");               //msg to be sent to two channels
}
else if(StatusF.containsIgnoreCase("Over") && Daydiff > 3)
{
Message1 = "Hi " + " " + SalesPersonaname + " " + invoicenumber + " " + CustName + " " + "overdue by  " + "" + Daydiff + " " + "Days. Please send reminder or chase for the payment ";
response = zoho.cliq.postToChannel("arbhuaccounts",Message1,"invoicemsgcliq");
}

_____________________________________________


    Access your files securely from anywhere









                          Zoho Developer Community




                                                • Desk Community Learning Series


                                                • Digest


                                                • Functions


                                                • Meetups


                                                • Kbase


                                                • Resources


                                                • Glossary


                                                • Desk Marketplace


                                                • MVP Corner


                                                • Word of the Day


                                                • Ask the Experts





                                                          Manage your brands on social media



                                                                Zoho TeamInbox Resources



                                                                    Zoho CRM Plus Resources

                                                                      Zoho Books Resources


                                                                        Zoho Subscriptions Resources

                                                                          Zoho Projects Resources


                                                                            Zoho Sprints Resources


                                                                              Qntrl Resources


                                                                                Zoho Creator 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

                                                                                            Get Started. Write Away!

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

                                                                                              Zoho CRM コンテンツ






                                                                                                Nederlandse Hulpbronnen


                                                                                                    ご検討中の方