NOTE: You need to create a connection for zohodesk under settings -> Developer Space -> Connections. We named our connection zohodesk with link name 'zohodesk' and under choose scopes select all options.
I am sharing my current solution that may benefit other users needing similar functionality.
Name your custom function something internally identifiable.
OrgID = ####;
getthreads = zoho.desk.getRelatedRecords(OrgID,"threads","tickets",ticketId,0,1);
threadid = getthreads.getJSON("data").getJSON("id");
getthreadcontent = zoho.desk.getRelatedRecordById(OrgID,"threads",threadid,"tickets",ticketId).getJSON("content");
if(getthreadcontent.containsIgnoreCase("cancel"))
{
updateticket = zoho.desk.update(OrgID,"tickets",ticketId,{"status":"Cancel"});
info updateticket;
}