Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

formHasMethod not checking for form extension methods

(0) ShareShare
ReportReport
Posted on by 10

Hi !

I have the following form extension class:

[ExtensionOf(formStr(EcoResProductDetailsExtended))]
public final class EcoResProductDetailsExtended_Extension
{
    public Set myMethod()
    {
        Set mySet;
return mySet; } }

Then I want to evaluate if that method exists before call it:

 if (formHasMethod(_formRun, 'myMethod'))
 {
 	localSet= _formRun.myMethod();
 }


The formHasMethod return false. It isn't being able to evaluate the extension method. If I call myMethod() without checking for it before hand, it is executed correctly.

I'm trying to use MetadataSupport helper class but I'm not succeeding.

Does anyone have some clue about it?

Thanks!

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: formHasMethod not checking for form extension methods

    As Martin pointed, this does work in 8.0!

  • Martin Dráb Profile Picture
    Martin Dráb 230,371 Most Valuable Professional on at
    RE: formHasMethod not checking for form extension methods

    I was told that formHasMethod() has got this capability in PU18.

  • István Orosz Profile Picture
    István Orosz 2,137 on at
    RE: formHasMethod not checking for form extension methods

    It is generally the same solution as was suggested on 15 Nov 2017 by Axaptus.

  • Suggested answer
    Sheikh Sohail Profile Picture
    Sheikh Sohail 6,125 on at
    RE: formHasMethod not checking for form extension methods

    Please have look this blog, maybe you will get the resolution from here...

    Please mark as Verified if shared blog helpful to you.

    http://d365technext.blogspot.com/2018/08/formhasmethod-extension-in-d365fo.html

  • Axaptus Profile Picture
    Axaptus 10 on at
    RE: formHasMethod not checking for form extension methods

    I've found a posible solution and I posted it here:

    community.dynamics.com/.../256465

  • Axaptus Profile Picture
    Axaptus 10 on at
    RE: formHasMethod not checking for form extension methods

    I'm using Platform update 5.

  • Axaptus Profile Picture
    Axaptus 10 on at
    RE: formHasMethod not checking for form extension methods

    Thanks Zain for your prompt answer.

    Yes, I've verified calling formHasMethod method for a standard form method and it worked well.

    The method is called from an event handler class wich is in the same model where the Extension class.

    I'm looking for some metadata helper yet. Any clue will be appreciated.

  • Zain Bokhari Profile Picture
    Zain Bokhari 3,208 on at
    RE: formHasMethod not checking for form extension methods

    Have you tried to check this condition for a default method name from original form? Does the condition work then?

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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,371 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans