I was recently tasked with learning the Zoho scripting language Deluge for a project.
That project is essentially to take a list of the tickets that come through Zoho Desk based on priority/shift times and sort them by ones that are unassigned, and then taking that list to send out as an email to inform the team of what needs to be taken.
My issue stems from actually getting the list to be pulled into the email body. When I do the list on its own I'm able to pull the info, and I'm also able to send the emails on their own, but when I end up combining them it always seems to tell me there's an error with the overall script.
Here's the script I have so far:
url = ".../api/v3/requests/";
headers = {"authtoken":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"};
first_shift_starts_at = (zoho.currentdate + ' ' + '08:00:00').toDateTime();
first_shift_ends_at = (zoho.currentdate + ' ' + '16:00:00').toDateTime();
is_first_shift = zoho.currenttime > first_shift_starts_at && zoho.currenttime < first_shift_ends_at;
second_shift_starts_at = (zoho.currentdate + ' ' + '17:00:00').toDateTime();
second_shift_ends_at = (zoho.currentdate + ' ' + '22:00:00').toDateTime();
is_second_shift = zoho.currenttime > second_shift_starts_at && zoho.currenttime < second_shift_ends_at;
third_shift_starts_at = (zoho.currentdate + ' ' + '23:00:00').toDateTime();
third_shift_ends_at = (zoho.currentdate + ' ' + '07:00:00').toDateTime();
is_third_shift = zoho.currenttime > third_shift_starts_at && zoho.currenttime < third_shift_ends_at;
if(is_first_shift=="Result": "success")
{
input_data = {
"list_info": {
"row_count": 250,
"start_index": 1,
"sort_field": "id",
"sort_order": "asc",
"get_total_count": true,
"search_fields": {
"priority.name": "1st Shift",
"status.name": "Open",
"technician": "null"
}
}
};
}
else if (is_second_shift=="Result": "success")
{
input_data = {
"list_info": {
"row_count": 250,
"start_index": 1,
"sort_field": "id",
"sort_order": "asc",
"get_total_count": true,
"search_fields": {
"priority.name": "2nd Shift",
"status.name": "Open",
"technician": "null"
}
}
};
}
else (is_third_shift=="Result": "success")
{
input_data = {
"list_info": {
"row_count": 250,
"start_index": 1,
"sort_field": "id",
"sort_order": "asc",
"get_total_count": true,
"search_fields": {
"priority.name": "2nd Shift",
"status.name": "Open",
"technician": "null"
}
}
};
};
params = {"input_data": input_data};
response = invokeurl
[
url: url
type: POST
parameters: params
headers: headers
];
info response;
emailSubject = "Unassigned Tickets";
emailBody = "These tickets are currently unassgined in the queue" + input_data "please make sure they are taken ASAP!";
sendmail
[
from: <from_address>
to: <to_address>
subject: emailSubject
message: emailBody
]
returnObj = Collection();
returnObj.insert("result":"success");
returnObj.insert("message": "Update Notification Mail sent successfully");
return returnObj;
Any help is very much appreciated!