Automate ToDo creation for Support Issues

Hi all, I am fairly new to ERPNext. We are currently testing out ERPNext in the hopes that it will be a good replacement for our current ERP. So far we have been thoroughly impressed, however I have been having a bit of trouble with the client-side scripting.

We are a service oriented business, and I have been trying to script the auto-creation of ToDo’s from Issues based on a custom employee linked field. Below is my script so far:

    current_technician(frm) {

            try {
                current = frappe.db.sql("select name from tabToDo where status= Cancelled")
                //frappe.db.delete('ToDo', current[0][0])
            catch (exception) {


            doctype: 'ToDo', 
            description: cur_frm.doc.subject, 
            owner: cur_frm.doc.current_technician.user_id,
            reference_type: 'Issue',

I have been able to succeed at create the ToDo documents, but have not been able to delete old ones(we are wanting to have the ability to escalate and de-escalate the issue and keep the most recent ToDo for all related technicians). Any help would be greatly appreciated :grin:

1 Like