Layer Specific code in AX

Hi All,

How to run the sys layer code in USR layer?

For example, In USR layer I have modified the code of PurchFormLetter but I have to run the code only in SYS layer…

I have set the condition like

if(Layer == SYS)

{

}

How can I achieve this using X++ code…?

Thanks in Advance…

if(Layer == SYS)

{

This doesn’t make sense. You will not be able to open you application in SYS layer.

You will be able to do it by default, unless you have commented the sys layer code and had your own code.

Hi Kranthi,

Sorry for the inconvenience…

My Problem is in AX7.

There is OverLayering in Class. Due to this some other functinality is getting stopped.
If there is not overLayering in this class, the functionality would work fine. But, i also dont want the overlayered code to delete
or comment it out.
Say for example, there is method which is overlayered for some reason. Due to this standard process gets affected.
Im just thinking if there is any method or condtion there, where i can put it before the method calls, to get execute by Layer.

For eg,
If (obj = null)
{
// call the standard method(SYS Layer)
}
else
{
// call the customized overlayered method(USR Layer)
}

PS: I know we should not do overlayering instead we could for extension.
But i just needed to know if there is a way indeed.

In AX2012, we have UTILElements to get the layer, whereas in AX 7, i dont know if there is any possiblity.

This isn’t possible in any way. Layers are development-time concept and code from different layers is merged before compilation. The SYS code doesn’t exist in production; you can’t execute something that doesn’t exist.

You’ll have to fix your bugs in USR.