Try ERPNext Try Frappe Cloud Buy Support Partners Foundation

Create New Record in another doctype without quick entry , client side js

I want To create new record in other doc type called 'Salary Structure 'based on the doctype called “employee contract” using custom button in" employee contract" doctype ,
I did this in parent doctype but can’t with child table
this the code ,my problem is with in the Doctype contract term that have many rows i want to select some of the row and all Colum field to put in salary child table that on other doctype ,
this code write on employee contract doctype,

data = {
            'doctype': 'Salary Structure',
            '__newname': cur_frm.doc.party_name,
            'employee':cur_frm.doc.employee_name,
            'contract_date_start':cur_frm.doc.start_date,
            'salary':[]
        }
        
        frappe.db.insert(data).then(data => {
            console.log("Inserted");
        	frm.save_or_update();
        	frappe.msgprint(__("Salary Structure Created"));
        	})

Any Idea,pls

Hi @omar_salama

Seems like you may still need to do a bit of research on custom scripts and specifically inserting documents via custom scripts. I’m sure if you search this forum you’ll find lots of examples

Cheers