[Tutorial] set_df_property for child table fields?

How to set property of field in child table?

Ans: We can set property of doc fields using following syntax.

cur_frm.set_df_property(FIELDNAME, Property, Value);


cur_frm.set_df_property("cheque_no", "reqd", doc.voucher_type=="Bank Entry");

We can also set property of fields in child table, which is the main reason for this post.

var df = frappe.meta.get_docfield("TABLE NAME","FIELDNAME", cur_frm.doc.name);
df.read_only = 1;


var df = frappe.meta.get_docfield("Employer Project Details","company_name", cur_frm.doc.name);
df.options = ["Tech M", "Wipro", "TCS"];

Using above code, I have generated dynamic drop-down in child table field of Select type.




Hi @kolate_sambhaji,

How can i change currency in child table as following image?

before it worked
cur_frm.set_df_property(“field_name”,“default”, “MMK”);refresh_field(“field_name”);


I think if you choose currency as type fetch it automatiqually.


1 Like

To change doc field use following script.

cur_frm.set_df_property(“total”, “fieldtype”, “Currency”);

also for table files use script
var df = frappe.meta.get_docfield(“Table Doctype Name”,“FIELDNAME”, cur_frm.doc.name);
df. fieldtype = “Currency”;

If you want to change precision, then from system setting you can change precision.

1 Like

Thanks @kolate_sambhaji. Your code is to change field type.

How can I change default currency?
Ex: total_claimed_amount, field type is Currency and USD as default. I want to change it depend on currency I choose.
Value $ 800, if you choose currency MMK, it will change to MMK 800.

before it worked
cur_frm.set_df_property(“total_claimed_amount”,“default”, “MMK”);

1 Like

yes, in Sales Order has multi currency which the currency in the table change based on Currency selection automatically.

In my case, I try to customize Expense Claim to have multi currency.

Hi @kolate_sambhaji,

I did what you said, finally i figure out there is something you mentioned wrongly,

frappe.meta.get_docfield(“TABLE Doctype NAME”,“FIELDNAME”, cur_frm.doc.name);

Shouldn’t be TABLE Doctype NAME => LINK DOCTYPE NAME (Table option link name) , i tried the code which make me always hit error if i include Table Name… work fine when i put Link Doctype Name~


Thanks for providing the information, but how can I push different option values in different rows.

@Deep Did you figure out how to push different option values in different rows? I am also trying it out.

Here me too. Do you have any updates?

How can I make a child table field mandatory based on value in parent table field?



This solution also not sufficient, i used it but did not able to solve my problem it works but for the current row, after save and refresh all the options will be cleared,
We can use stander property setter to achieve this
Just loop through the child table record and add following code.


This also have some drawback but works in my case.