Filter Based on Another Property of Selected Item

I have a doctype UOM (kg, km etc) with field uom_category (Mass, Length etc) as below:

I have another doctype UOM CONVERSION FACTOR as below:

In UOM CONVERSION FACTOR:

When the user selects ‘Meter’ (with uom_category == ‘Length’) in from_uom how do I filter to_uom field to list only UOM with uom_category == ‘Length’

Thanks

Add another field to the second doctype. Fetch the UOM category of the From field. Change the To field to a link field, linking to a UOM (i’m assuming that this isn’t already the case). Lastly add a client side script query on the To field to only show UOM’s with the same category as From. If you dont know how to write the script, read this :