Disable run button while code is executing

Hi,

I have created a button with type = ‘Run’. I have some codes in “OnRecord” and “OnFinish”.

User can select multiple records and click the button.

Question: When the user click the button, how can I temporary disabled the button till the code has finished executing?

Reason: Under “OnFinish”, I have an update statement to increase columnA by 1 whenever user select the records and press the button. However, if the user click the button once and while the code is executing, the user tried to click the button 2nd time, columnA will increased by 2.

Can anyone kindly help?