Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Suggested answer

formHasMethod not checking for form extension methods

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!

  • 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 228,089 Super User 2024 Season 2 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?

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 9th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

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

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,252 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,089 Super User 2024 Season 2

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans