2

Is it possible to make sure a user only can open one instance of a specific form, for instance CustTrans from CustTable? Modal form is not an option. Some sort of Singleton pattern?

mrsalonen
  • 343
  • 2
  • 15

1 Answers1

7

You can use the global cache for this, more info on MSDN: http://msdn.microsoft.com/en-us/library/aa891830.aspx. However a lot of the time the use of the global cache is a sign of bad design.

You can use the global cache to implement a singleton pattern as demonstrated here: http://www.axaptapedia.com/Singleton_pattern

Also consider alternative solutions to your problem, for example the one used on inventory journals. When you open the lines for a journal, it is marked as "in use" so no one else can open that particular journal.

Side note: I believe what you are trying to achieve is a bit of an anti-pattern. Dynamics AX uses dynalinks to link forms together. All of this functionality will be lost if you implement this.

Klaas Deforche
  • 1,151
  • 5
  • 9
  • Yeah, but this is a custom form and I've been told that if the users open more than one and then input data, there's problems... – mrsalonen Feb 18 '14 at 11:02
  • Oh okay. You should probably also get the bottom of that problem en keep the solution above as a temporary fix. But I understand this can be a requirement sometimes. You should be able to achieve this using the methods above. – Klaas Deforche Feb 18 '14 at 11:08
  • 1
    I think the "in use" method might be more handy in this particular case. Funny that I didn't think about that at all myself :) Thanks! – mrsalonen Feb 19 '14 at 08:47