How can I auto-populate Child Table items onto document when creating new?

What I want to do, for example is to Auto Fill the Quotation Items table when creating a new Quotation, via a Custom Script. How can I do this?

Where Form B is a quotation and you go from form A to form B you can add a custom button on Form A and pull its values when you get to form B with the below code.

frappe.ui.form.on( ‘Form A’, {
refresh(frm) {
if (frm.doc.allotted === 0) {

var add_button = function(frm)
frm.add_custom_button(__(“New Quotation”), function() {
() => frappe.new_doc(‘Quotation’),
() => cur_frm.add_child(“items”, {
item_code: frm.doc.item_code,
qty: 1,
uom : ‘Nos’,
item_name : frm.doc.item_name,
description : frm.doc.description

Read the last post in this thread: Child Table Link Field Population - #76 by Vesper_Solutions

Hello, get this from my youtube channel

or from my blog post

1 Like