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 :
Microsoft Dynamics AX (Archived)

Call Form method from Button Clicked / "The class FormRun does not contain this method"

(0) ShareShare
ReportReport
Posted on by

Hi folks, hope ye are well.

I have read quite a bit on this topic but am failing to succeed.

I have a button under ActionPane/ActionPaneTab/ButtonGroup/myButton

the button has method 'clicked'.

Once clicked I wish to call a method on the Form, myMethod.

In the clicked method i have:

void clicked()
{
    FormRun myForm = element.args().caller();
    myForm.myMethod();
    super();
}


the myMethod() method displayed for me when I hit '.' and I can select it.

On compile it status the "The class FormRun does not contain this method"

Am just a little confused as to why this is not working for me as it seems quiet straight forward.

Any suggestions welcome.

rgds,

K.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    XB Profile Picture
    1,875 on at

    Are you on the same form where the method exists?

    so you can call him with reserve word element.

    element.mymethod

    think about formRun is a generic class object and only have default methods.

    if you want to call a method form other forms do something like this.

    in your destiny form

    init:
    this.parmCallerObject(element.args().caller());


    public Object parmCallerObject(Object _callerObject = callerObject)
    {
    if (!prmisDefault(_callerObject))
    {
    callerObject = _callerObject;
    }

    return callerObject;
    }

    //in your destinty form create a method to call method from orig form

    private void callOrigMethod()
    {

    if (formHasMethod(callerObject.owner(), "methodNamefromorigform"))
    {

    }
    }

  • Suggested answer
    Denis Macchinetti Profile Picture
    16,444 on at

    Hi

    If the method coming from the Caller form, you have to declare myform as Object, so:

    Object myForm = element.args().caller();

    myForm.myMethod();

  • Denis Macchinetti Profile Picture
    16,444 on at

    Again, you can use the global formHasMethod method in order to test if the method exist.

  • Community Member Profile Picture
    on at

    thank you both.

    yes, by button is on the main simple list form, and my method is under the form.

    element.myMethod() is exactly what i was looking for.

    thanks again.

    Rgds,

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 3

#3
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans