ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

Problem with set value in child table



I am trying to set values to a child table but it is not working. Here’s my code

      var d = res.message
      d.forEach( function(row,v) {
          frappe.model.set_value(row.doctype, , "category", d[v]['category'])
          frappe.model.set_value(row.doctype, , "name2", d[v]['name2'])
          frappe.model.set_value(row.doctype, , "min", d[v]['min'])
          frappe.model.set_value(row.doctype, , "max", d[v]['max'])

Although the loop is working correctly but value is not getting pushed to rows.


@nikzz try this :

  var d = res.message
  d.forEach( function(row,v) {
       var new_row = frm.add_child("child_table_name");
            new_row.category = d[v]['category'];
            new_row.name2 = d[v]['name2'];
            new_row.min = d[v]['min'];
            new_row.max = d[v]['max'];       })