Mandatory depends on another field

Hi,
is there any way to set field A to mandatory only if field B is checked?
I want to make mandatory select field for serial number template only if “has_serial_no” is checked.
If I select Mandatory in customization, system will require to fill field even if I didn’t checked “has_serial_no”.

You can do this by giving a condition in “Mandatory depends on” field.
In your case it will be something like eval:doc.has_serial_no

2 Likes

Thanks, but for some reason I don’t see Property Depends On section.
Guess because I’m on v12.

	has_serial_no(frm) {
	    frm.toggle_reqd('serial_number_template', frm.doc.has_serial_no === 1);
	},

This solves my problem. Custom Script for Item doctype.