web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

How to keep only 1 form instance open

(0) ShareShare
ReportReport
Posted on by

Hi Experts 

I have a custom form , currently a user can open as many instance as he wants by clicking on the menu item.

I want to restrict this in a way that user at any given point can open only 1 instance of the form, please share how do i achieve this.

Thanks

Mav

I have the same question (0)
  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi Mav,

    Please take a look at "ReleaseUpdateCockpit" form. Only one instance of the form can be run at a time. It uses a class "ReleaseUpdateRunning" to save the session Id for the form.

    Please check the init method in this form.

    You could try doing something similar to make sure you have only one instance running per session, or else throw an error.

  • Mav Profile Picture
    on at

    That is having multi company scenario plus other scenarios which are not requried in my simple request which is to ensure that at any given time a user is able to open only 1 instance of the form.

    Found this, can anyone suggest how do i use Singleton for Ax custom form.

    http://thinkinginax.blogspot.com/2014/02/singleton-pattern-in-x.html

  • Ludwig Reinhard Profile Picture
    Microsoft Employee on at

    Hi Mav,

    Is this a question that is related to D365FO or AX2012?

    Best regards,

    Ludwig

  • Mav Profile Picture
    on at

    It’s related to ax2012

  • Sergei Minozhenko Profile Picture
    23,093 on at

    Hi Mav,

    Have you checked if the modal form can help you?

    www.axaptapedia.com/Modal_forms

    www.schweda.net/blog_ax.php

  • Mav Profile Picture
    on at

    Modal form as described would do this

    "Using this code, nearly every form could be opened in a modal way, so you have to close the form first before you will be able to return to AX."

    Which is not the requirement , user should be able to return to Ax & do multitasking with other forms , however at any given point a user should not be able to open more than 1 instance of the same custom form.

    Thanks

    Mav

  • Suggested answer
    Sergei Minozhenko Profile Picture
    23,093 on at

    Hi Mav,

    In this case, probably, server global cache will work and you can use formname+userId as cache key.

    Alternatively, You can use table where you can store information about the user who already opened the form.

    One form init you can check if there is a record in the table and if it's not, open a form and insert record to the table with current user id, if yes, throw an error that user can't open another instance of the form.

    On form close, you need to remove the record for the current user from the table.

    At least with the table, you have admin access to fix the issue by deleting the record if something goes wrong.

    Also, it would be good to clean the table on AOS startup (Application.starupPost) in case of AOS went down.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 456 Super User 2025 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 429 Most Valuable Professional

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans