Need to disable a Button Based on Enum Value

Hi All,

I have added a Enum in purachase order header & added a button in Purch lines.

Now my Requirement is Depending on header enum value i want to disable the button in lines.

if the enum value is 0 the button should be diable. Other than 0 the button should be enable.

How can i achive this ?

Have a look at here,

where i am writing that code in table level methods or IN form -->method?

Hi Kranti,

i am unable to understand that method. Can u plz explain some more clear.

if i call the method in form level field modified method. Where i have to mention the button. Can u plz make it clear for me and where i have to add that method ?

HI Roshan,

Place a code in the Form – DataSource — Fields ---- [Enum Field] ---- modified() override it and place a logic as
if(TableName.Fieldname[enumfield)] == 0)
button.enabled(true) // make the button property autodeclaration to yes…

Naresh Kolli


  1. set the autodeclaration property of the button in line to “Yes”

  2. write the following code in PurchTable:Active() in PurchTable form.

let us assume buttonName is BN





Hope this will help u…

Thanks Naresh…

it’s working fine…

Hi Naresh,

Plz test for if u do modify the enum field, then check buttons behaviour…

CommandButtonsVisibility is a flagsenum, so you can OR together all the buttons you want to show.



india payroll software

Hi PrasannaKumar,

I have checked u r code. it is also working fine for my scenario. But i found a small problem in that code. i.e when ever i change the value in the enum the button status should not be change until i click on lines.

It is better to use the name of the Enum Value (like Enum::Value) for better readability of your code.

and you can write this in single line - button.enabled(Table.EnumField == EnumField::value); only for this value the button will be enabled…

Not useful here

What you are looking for?