| Name | Data Type | Description |
Network | Map | The details of your network |
User | Map | Details of the configuration owner. |
returnMap = Map();
scopeId = network.get("id");//Network id on which the scheduler getting executed
//zohoconnectoauth authtentication to fetch data from Zoho Connect
response = invokeurl
[
url :"https://connect.zoho.com/pulse/api/tasks"
type :GET
parameters:{"dates":"today","scopeID":scopeId}
connection:"zohoconnectoauth"
];
info response;
if(response.containKey("result") && response.get("result") == "failure")
{
returnMap.put("status","failure");
}
else
{
tasks = response.get("tasks").get("tasks");
formatedDate = response.get("tasks").get("todayFormattedDate");
rows = list();
for each task in tasks
{
row = map();
row.put("Title", task.get("title"));
row.put("Section", "["+task.get("section").get("name")+"] ("+task.get("section").get("url")+")");
row.put("Board", task.get("partition").get("name"));
row.put("Status", task.get("taskStatus").get("name"));
row.put("Priority", task.get("taskPriority").get("name"));
rows.add(row);
}
//Use a message format that is compatible with Cliq
content = "Task to be completed by "+formatedDate+".";
message = {"text":content,"card":{"title":"Today's task", "thumbnail":"https://play-lh.googleusercontent.com/_g", "theme":"modern-inline"},"slides":[{"type":"table", "title":"Tasks", "data":{"headers":["Title","Section","Board","Status", "Priority"],"rows":rows}}]};
info message;
//post message on the Cliq bot using `zohocliqoauth` `
cliqResponse=zoho.cliq.postToBot ("A new task",message, "zohocliqoauth");
if(cliqResponse == null || cliqResponse.containKey("status") == false || cliqResponse.get("status") != "success")
{
returnMap.put("status","failure");
}