How can I create a Custom Function that searches for tickets based on part of the subject of the ticket just created

How can I create a Custom Function that searches for tickets based on part of the subject of the ticket just created

I am looking for examples or documentation of custom functions for Desk but I don't find examples of search for tickets based in part of the subject. (subject contains a string).

Something like:

zoho.support.searchRecords("Tickets","PORTAL","DEPARTMENT","Subject","contains(*tarea*);

Any ideas on how to accomplish this?

The objective is to link the tickets or merge the tickets with the function.