AX 2009 - MenuItemButton property

Hi All,
I’m looking for a solution to achieve this.
Here is the scenario:
On ‘ProdTabe’ form, MenuItemButton:‘btnB’ calls a form ‘B’.
I need to set ‘enabled’ property of menuItemButton ‘btnB’ of ProdTable form to ‘NO’ if the form ‘B’ is opened or ‘Yes’, if the form ‘B’ is closed.

Does anyone have any idea on how to achieve this?
I’d appreciate any help.

You need two events: on clicking the button and on closing the form. The former is trivial - you can use clicked() method of the button. The later requires the child form to notify the parent form that its close() method was called.

Nevertheless don’t think that it prevents users from opening more forms B if they want - they can always open more ProdTable forms or even more AX sessions.

(Question moved to the Developer forum.)

Thank you for your respond!

Yes, that’s a point, we’d like to prevent user(s) to open this form one at a time.

I got your point …could you please explain ,how child/parent forms communicate ?

Thanks much!

I hope I already showed that if your goal is preventing users from opening the form several times, your solution wouldn’t achieve that. You would have to implement a more robust solution, such as setting a flag to database when user opens the first instance of the form and checking the flag on subsequent attempts for opening. But then you risk that the user will be unable to use the form at all, if the open instance ends incorrectly and doesn’t clear the flag.

If I was you, I would change the form to work correctly even if it’s open several times. It’s seem to be the core problem that you should resolve.

Regarding your last questions - forms are objects, therefore they communicate through method calls. Nevertheless they are not types, therefore you have to call their methods in a special way, you won’t get compile-time validation and so on. It’s often better to pass a class in args.parmObject() and use this object in strongly-typed manner.

Thank you so much! Got it.