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

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Dexterity window won't close

(0) ShareShare
ReportReport
Posted on by 4

I have a simple window I created in Dexterity that won't close.

This is what it looks like:

pastedimage1634319458090v3.png

Here is what it looks like after I run the script to close the form:

pastedimage1634318863300v2.png

The only script on the window is the Job Number change script, and to debug, I simplified it to only say:

close form DU_Next_PONumber_for_Job;

I also tried:

close window DU_Next_PONumber_for_Job of form DU_Next_PONumber_for_Job;

I am certain that this is the window and form name, and I get no errors.  This is the only window on the form, it is set to be the Main window, and window type is Primary.  I can close it manually.

Why won't it close?

Categories:
I have the same question (0)
  • Suggested answer
    Derek Albaugh Profile Picture
    on at
    RE: Dexterity window won't close

    The 'Open Form' and 'Close Form' along with 'Open Window' and 'Close Window' is what I found as well.

    I'll look to see if I can find anything more and hopefully someone in the Community will have some information on your issue of the window not closing.

    Thanks

  • Verified answer
    David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    14,087 Most Valuable Professional on at
    RE: Dexterity window won't close

    Hi Pam

    The close window command is all that should be needed to close the window. If the window is the main window (first in the form definition) it will also close the entire form when it closes.

    I am not sure that your change script is working. try adding a button with close window command in it to test.

    PS: As you are already on the form, there is no need (but no harm) to add of form XXX.

    Regards

    David

  • Almas Mahfooz Profile Picture
    11,009 User Group Leader on at
    RE: Dexterity window won't close

    From where you are trying to close your window? 

    If possible share your code on Job Number field.

  • Pam Robertson Profile Picture
    4 on at
    RE: Dexterity window won't close

    For now, the Job Number change script is:

    close form DU_Next_PONumber_for_Job;

    I also tried:

    close window DU_Next_PONumber_for_Job of form DU_Next_PONumber_for_Job;

    There are no other scripts on the window or form.

  • James McCullough Profile Picture
    371 on at
    RE: Dexterity window won't close

    This actually raises a question.  I find it better in my own debugging to be as explicit as possible, and add the extraneous "of form" bits and bobs.  What do others think of this practice?  Is it useful in debugging or does it add unnecessary confusion?

  • Pam Robertson Profile Picture
    4 on at
    RE: Dexterity window won't close

    This is so weird.  I followed David's advice, created a quick Close button at the bottom of the window with the exact same script as is now on my Job Number change:

         close window DU_Next_PONumber_for_Job;

    It worked!  But miraculously, my Job Number change script also started working, closed the window properly.

    So I took off the close window button.  My Job Number change script leaves the blank window open.

    Bottom line:  as long as I have a button with a script on it somewhere in the window, not on the toolbar, my script closes the window properly.  When it is the only script on the window, the my script leaves a blank window open.

  • David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    14,087 Most Valuable Professional on at
    RE: Dexterity window won't close

    James

    Adding of form when it is not needed makes the code harder to read AND means that if you duplicate the form, the code will need much more editing to make the duplicate work on the new form rather than referencing the original form.

    I would only use of form when it is needed.

    This is also a good reason to use form level functions as they don't need the of form when called when form level procedures do.

    David

  • David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    14,087 Most Valuable Professional on at
    RE: Dexterity window won't close

    Pam

    Normally an editable field change script is not used to close a window. However, the code should have worked the way you had it originally.

    I would as an OK Button and/or Cancel Button to the window and use run script to that button to close the window.

    You can move the button off the window or make it Visible=False if you don't want it shown to the user.

    Regards

    David

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
Martin Dráb Profile Picture

Martin Dráb 683 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 398 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans