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

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

(0) ShareShare
ReportReport
Posted on by 616
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...
I have the same question (0)
  • Verified answer
    Christian Busche Profile Picture
    616 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
    27,825 Moderator 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

Responsible AI policies

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

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

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

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 846

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 797 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans