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");
}
_____________________________________________