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)

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

I have the same question (0)
  • Zain Bokhari Profile Picture
    3,208 Moderator on at

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

  • Axaptus Profile Picture
    10 on at

    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.

  • Axaptus Profile Picture
    10 on at

    I'm using Platform update 5.

  • Axaptus Profile Picture
    10 on at

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

    community.dynamics.com/.../256465

  • Suggested answer
    Sheikh Sohail Profile Picture
    6,125 on at

    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

  • István Orosz Profile Picture
    2,137 on at

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

  • Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

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

  • Community Member Profile Picture
    on at

    As Martin pointed, this does work in 8.0!

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
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans