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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

New methods added to a class not shown Dynamics AX 2009

(0) ShareShare
ReportReport
Posted on by

Hi All,

I'm new to Dynamics AX development.

When I add a new method to a class and try to call it in another function, the newly added method is not shown but all the other methods of the same class are shown.


Any suggestions???

Thanks in advance.

*This post is locked for comments

  • Rohin Profile Picture
    4,624 on at

    Hello Ashique,

       what is the Modifier (Public,Private or Protected) of your method ? and you are calling  your method in same class method or in subclass method ?

    would be great if you provide some more information so we can help you

    Thanks.

    Visvash Walia

  • Community Member Profile Picture
    on at

    Hi Visvash,

    The modifier is public.

    I tried to use in the below code.

    switch(args.menuItemName())

           {

               case menuitemactionstr(SignLetter):

                   DocManagement::SignLetter(args.record());

               break;

               case menuitemactionstr(SignLetter2):

                  DocManagement::NewMethod(args.record());

               break;

       }

    It shows an error says the "NewMethod is not a class function"

    Thanks.

  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at

    That double-colon is a static method reference. That means your NewMethod must be declared as:

    public static ReturnValue MethodName(ParameterList _parameter)
    {
    }

    See the documentation:

    https://msdn.microsoft.com/en-us/library/aa584754.aspx

    If you want to call it as a public method, then you should instantiate the class first by using a constructor (if construct() static method is implemented), or use new YourClass(parameters), then on that you may call non-static methods.

    I would suggest reading some developer documentation first.

  • Community Member Profile Picture
    on at

    Hi Vilmos,

    Thanks for the reply.

    I have declared the method as,

    public static void create_Letter(Common _record)
    {

    }

    and I call the method in the main method of the same class.

    public static void main(Args    args)
    {
        //Manage the user driven export to word / excel via caller
        ;

        if(args.menuItemName())
        {

          switch(args.menuItemName())

           {

               case menuitemactionstr(SignLetter):

    DocManagement::create_Letter(args.record());

                  

               break;

               case menuitemactionstr(SignLetter2):

                 DocManagement::SignLetter(args.record());

               break;

          }

       }

    }

    Thanks.

  • Verified answer
    DavidGunawan Profile Picture
    1,381 on at

    Hi Ashique,

    Please make sure your environment has development license. If it's doesn't the license then you will not able to create a new class or modified the existing class. As a hint, you can modify a class but when you save it, it's not able to be saved (a red mark shown in the class).

    As the workaround, after you modify it then you need to export the class to XPO and import XPO back.

    Regards

  • Vilmos Kintera Profile Picture
    46,149 on at

    Please mark the answer which helped as verified.

  • Community Member Profile Picture
    on at

    Hi David,

    The licenses does not include the developer license.

    I'm using an existing class.

    When I modify an existing method and export the XPO and import the XPO back the changes are saved and can be called from other methods and also the changes get applied.

    But when I add any new methods and do the export and import the changes are saved but the new methods cannot be called from the other methods.

    Thanks.

  • DavidGunawan Profile Picture
    1,381 on at

    If that case, you need to check the access modifier of the method. Like Vilmos explained before.

    From your code example, the method should be defined as a public static method. And I believe that last code that you posted will work correctly.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
nmaenpaa Profile Picture

nmaenpaa 2 Moderator

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans