Comment a part of code through X++

Hi,

I am doing some R&D on this. What i need to do is place a button in a specific module say (admin) from here i need to block and unblock some part of code that is affecting the fields on the form,

Is there a way to put these lines of code in comments or remove the comments on a click of a button ?

It surely is possible to change code (it’s just a text, after all) when a button is clicked, but that’s definitely nothing what you should do as part of your business logic.

Simply add some condition to the code - e.g. it will execute only if the value of a boolean field is true and clicking the button will set the value.