How to update child table of one doctype from button click on another doctype using Server Script?

Hi there! I have a doctype called Planning and a child table in it. I added a button called Create task. When I click this button, task details in child table should create values in child table in another doctype called Phases.

How can i achieve this using Server script?

Hi @NCP !, Could you help me with this topic?

Hi @ibalajib,

I have no idea about the set value in the child table via the click button.

But you can set parent doctype value via click button using client/custom script.

Example:

frappe.ui.form.on('Your DocType', {
	    test_sf_connection: function(){
 		frappe.db.set_value('Another DocType', 'Name', {
 		    'Another DocType Field Name': 'Test',
 		});
	    }
});

Otherwise, it works on the server-side using the before/after save events.

Thank You!