In the script window, input the Custom Function you find below:
orgId = "paste orgId here";
DepartmentB_id = "paste department B id here";
keyword1 = "paste keyword value here";
keyword2 = "paste keyword value here";
TicketInfo = zoho.desk.getRecordById(orgId, "tickets", TicketID);
subj = TicketInfo.get("subject");
threads = zoho.desk.getRelatedRecords(orgId,"threads","tickets",TicketID).get("data").toList();
threadId = threads.getJSON("id");
Message_body = invokeurl
[
url :"https://desk.zoho.com/api/v1/tickets/" + TicketID + "/threads/" + threadId + "?include=plainText"
type :GET
connection:"zohodesk"
];
Message_body = Message_body.getJSON("plainText");
if ( Message_body.containsIgnoreCase(keyword1) || Message_body.containsIgnoreCase(keyword2) || subj.containsIgnoreCase(keyword1) || subj.containsIgnoreCase(keyword2) )
{
info zoho.desk.ticket.move(orgId, TicketID, DepartmentB_id);
}