Error in Script

Hi All,

I tried with this code to get child table stock entry detail in document of Stock Entry

cur_frm.cscript.custom_validate = function(doc) {
	if(doc.purpose == "Material Transfer") {
		var item_details = frappe.get_doc("Stock Entry Detail",{parent:cur_frm.doc});       
		console.log('item_details', item_details);  

There are two entries in Stock Entry Detail, but I am getting only one object in console. Here is a screenshot.

Kindly tell me how to solve this.


frappe.get_doc(doctype, filters/doc name)
Always gives you one document. What is your use case? When you can directly access via,


Hi Sangram,

I need to access Stock Entry Detail Table in a Stock Entry Document. For Example, If Stock Entry Detail contains two rows, I want to access and restrict via custom script.



gives you no. of rows in Stock Entry Detail. Use it for your validation.