Field mandatory

I have a combobox with an enumtype “DirPartyBaseType”.

i want if i select “organization” value in combobox , set another field mandatory to true else mandatory to false

How can i make this field mandatory?

  1. Override the modified method on combobox

  2. check the selection value is Organization

if(this.selection() == enum2int(DirPartyBaseType::Organization)
datasourcename_ds.object(fieldnum(tablename,fieldname)).mandatory(true);
else
datasourcename_ds.object(fieldnum(tablename,fieldname)).mandatory(false);

Regards,
Raghav.