Skip to main content

Notifications

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

When closing a form, the CanClose() is not run through

(0) ShareShare
ReportReport
Posted on by 549
Hi all...
I create an extension code on form MarkupTrans like:
 
/// <summary>
/// Code extension for table MarkupTrans.
/// </summary>
[ExtensionOf(formStr(MarkupTrans))]
public final class myMarkupTransFrm_Extension
{
    /// <summary>
    /// additional logic on canClose methode
    /// </summary>
    /// <returns>true if form can be closed otherwise false</returns>
    public boolean canClose()
    {
        boolean ret = next canClose();
 
        if (ret && this.args() && this.args().caller() && this.args().callerName() == identifierStr('myWhsLoadTableCheckMarkupCaptured'))
        {
            ret = this.myCheck();
        }
        return ret;
    }
}
 
But when I close the form this extension is not run through although the standard method FormRun.CanClose() is passed... I can see that by set a breakpoint on both methods...
  • Verified answer
    Christian Busche Profile Picture
    Christian Busche 549 on at
    When closing a form, the CanClose() is not run through
    GirihS,
    thanks for the hint...
     
    I made this adjustment a long time ago... During a test in the debugger I noticed several times that this method is (apparently) not (anymore) run.
    Thereupon I compiled the model again and then also this method was run again... I have no idea why only one compile has activated the method again... So everything seems to be ok again...
  • Verified answer
    GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    When closing a form, the CanClose() is not run through
    Hi Christian,
     
    Have you consider adding this validation in validateWrite method of the DataSource or table?
     
    Thanks,
    Girish S.

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,971 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,846 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans