Child Table set value of SELECT field once the Link Doctype choosen

Hi guys,

May i know how do i achieve something like set value of SELECT field when one of the link doctype field is alter/choose,

My code is like this :

frappe.ui.form.on("Item Group", {

item_group:function(frm, cdt, cdn){
var itemGroup = frappe.get_doc(cdt, cdn);
console.log("item group is  : " + itemGroup.item_group);{
            alert("Invalid in somewhere, please log out and log in again.");
        else if(r.message!=null){
            console.log("items : " + JSON.stringify(r.message.ret.items));
            var items = JSON.stringify(r.message.ret.items);
            var itemsSize = JSON.parse(items).length;
            var itemShow = [];
            for(var i=0; i<itemsSize; i++){
            frappe.meta.get_docfield("Item Group", "item_code", = ["hello", "bye"];


What i want to achieve is , when go to doctype name as A , inside there is a table link to B doctype, this B got field as item_group, item_code(SELECT fieldtype), when i select item_group, it will send external service to get items return display in item_code (Select fieldtype). , i refer to some of the tutorial, i do not get how can i do it ~

Could anyone please help me?

1 Like

I got what i want from here…

this is the code:

cur_frm.cscript.operation_no = function(doc, cdt, cdn) {
var child = locals[cdt][cdn];
} = function(doc) {
var op_table = doc.bom_operations || [];
var operations = [];

for (var i=0, j=op_table.length; i<j; i++) {
	var op = op_table[i].operation_no;
	if (op && !inList(operations, op)) operations.push(op);

frappe.meta.get_docfield("BOM Item", "operation_no",
	cur_frm.docname).options = operations.join("\n");