Change the value of a list (which is in a child table) based upon a condition

Hi Everyone,

I have list item (custom) which has two values “Yes”, and “No” which in a child table.
I want to set the value of a list on the basis of a particular condition.

I am using the below code but it works when the condition get satisfy but when the condition doesn’t satisfy it becomes invisible.

frappe.ui.form.on("Expense Claim Detail","expense_type", function(frm, cdt, cdn) {
var d =locals[cdt][cdn]
frm.get_docfield("expenses", "claim_amount").read_only = false;
cur_frm.refresh_fields();
if(d.expense_type=="Local Conveyance")
{
frm.get_docfield("expenses", "vehicle_type").reqd = true;
frappe.model.set_value(cdt, cdn, "invoice_copy", "No");
cur_frm.refresh_fields();
}
else
{
frm.get_docfield("expenses", "vehicle_type").reqd = false;
frappe.model.set_value(cdt, cdn, "invoice_copy", "Yes");
cur_frm.refresh_fields();
}
});

I appreciate, if anyone can help me in this regard.

Regards
Ruchin Sharma

Is there any error on console, when condition doesn’t matches?

No, there is no error but when condition becomes false the “Invoice Copy” list becomes invisible.

Edit: @saurabh6790 any idea about it?

Regards
Ruchin Sharma

@ruchin78 ever get this working?