New Doctype Creation-2 diffrent Doctypes

Hi Guys,

I have the foolowing situation:

->2 different doctypes

When I submit Doctype A I want to have the Doctype B also created and also to have some fileds added into it?

Is this possible to be done from CUstom Script?

Thanks!

You can create entry for DocType B by:

const funcs = docs.map((doc) => {
frappe.call({
method: “frappe.client.insert”,
args: {
doc: doc // doc object,
},
async:true,
callback: function® {
//callback script
}
});
});
Promise.all(funcs).then(()=> {
// console.log(“Done Done Done”);
});

DoctypeA is named Acces
DoctypeB is named ATR
In both doctypes I have 2 identicall fileds named ,prenume" and ,nume"

So how can I addapt thescript to have the Doctype B creatd when Doctype A is submitted/created?

Thanks!

@johnskywalker

from the script I gave
replace doc with your dictionary (contains fields and values)

@johnskywalker still not getting it…

const funcs = docs.map((doc.atr_atp) => {
frappe.call({
method: “frappe.client.insert”,
args: {
doc: doc // doc object,
},
async:true,
callback: function® {
//callback script
}
});
});
Promise.all(funcs).then(()=> {
// console.log(“Done Done Done”);
});

Please help me