Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Answered

Dexterity window won't close

(0) ShareShare
ReportReport
Posted on by 199

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:
  • David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    David Musgrave MVP ... 13,947 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

  • David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    David Musgrave MVP ... 13,947 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

  • Pam Robertson Profile Picture
    Pam Robertson 199 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.

  • James McCullough Profile Picture
    James McCullough 294 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
    Pam Robertson 199 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.

  • Almas Mahfooz Profile Picture
    Almas Mahfooz 11,003 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.

  • Verified answer
    David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    David Musgrave MVP ... 13,947 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

  • Suggested answer
    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

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,431 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,503 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans