Search code examples
acumatica

How to fire FieldSelecting event only in the screen?


I have a number of non persistent fields that get its value via FieldSelecting events. The events do the same queries and calculations so I decided to move them into an attribute that implements IPXFieldSelectingSubscriber interface. This works fine and it minimises duplicate codes. However, the event fires every single time the DAC is accessed. Be that in GIs or called in some other graphs. Is there such a flag to verify if the event is being fired only from a specific screen ?


Solution

  • The easiest way to do that would be to add the validation of which screen is accessing the DAC, you can do that by simply putting an if statement like below into your event handler.

    if(graph.Accessinfo.ScreenID == "SO.30.10.00")
    {
    //execute the logic
    }
    else
    {
    //skip
    }