Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

find() and exist() both need to add in Add Ins:

Posted on by 5,901

Dear All,

I have one requirement. I am creating a new table. Customer wants to add find() and exist() bothin Add Ins:

5707.table.png

Please give me more shed on this.

Thanks!

Arpan Sen

*This post is locked for comments

  • @rp@n Profile Picture
    @rp@n 5,901 on at
    RE: find() and exist() both need to add in Add Ins:

    Thanks Vilmos and Grigory

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: find() and exist() both need to add in Add Ins:

    I am sorry but I haven't link (I saw it at the consulting company) But it is not difficult

    +-

    stackoverflow.com/.../add-a-method-dynamically-in-ax-2012-component

  • Suggested answer
    Vilmos Kintera Profile Picture
    Vilmos Kintera 46,149 on at
    RE: find() and exist() both need to add in Add Ins:

    So this is what I would do on such request.The logic can easily be changed to also filter by name of the table, in case you still want to add it in Add-ins menu, using Grigory's link.

    static void WIK_findTableWithoutFindExist(Args _args)
    {
        SysModelElement         modelElement;
        SysModelElement         modelElementMethod;
        SysModelElementData     modelElementData;
        SysModelManifest        modelManifest;
    
        void doFind(MethodName _methodName)
        {
            int i = 0;
            
            while select modelElement
                order by Name
                where modelElement.ElementType == UtilElementType::Table
                notexists join modelElementMethod
                    where  modelElementMethod.ElementType   == UtilElementType::TableStaticMethod
                        && modelElementMethod.Name          == _methodName
                        && modelElementMethod.ParentId      == modelElement.AxId
                // --> if you want to filter it by layer, i.e. standard SYS is Foundation
                exists join modelElementData
                    where modelElementData.ModelElement     == modelElement.RecId
                exists join modelManifest
                    where  modelElementData.ModelId         == modelManifest.Model
                        && modelManifest.Name               == 'Foundation'
                // <--
            {
                info(strFmt('%1 missing %2', modelElement.Name, _methodName));
                i++;
                // Early interrupt, not to loop whole SYS layer, for example's sake
                if (i==10) 
                {
                    break;
                }
            }
        }
    
        doFind('exist');
        doFind('find');
    }
  • @rp@n Profile Picture
    @rp@n 5,901 on at
    RE: find() and exist() both need to add in Add Ins:

    Thanks Vilmos and Grigory.

    I asked with customer also. they told the same thing the purpose of those methods in Add Ins that those methods are available in Table level or not.

    If yes, they want to open from there.

    @ Grigory : Could you please send me the link. How to add find() and exist() in Add Ins.

    Thanks!

    Arpan Sen

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: find() and exist() both need to add in Add Ins:

    "Is't possible?"

    It is possible. I see same thing

  • Suggested answer
    Vilmos Kintera Profile Picture
    Vilmos Kintera 46,149 on at
    RE: find() and exist() both need to add in Add Ins:

    What is the difference of going to the table in the AOT, expanding the table, then the Methods node to see if two methods are there or not, compared to implementing the check in the Add-ins menu - isn't it the same amount of clicks?

    If they want to verify whether find or exist method is present on a table, why not just do it as a select statement on the ModelElement and ModelElementData tables?! I would do it that way. You could even filter it out to only care for tables that are on a specific layer, and so on.

  • @rp@n Profile Picture
    @rp@n 5,901 on at
    RE: find() and exist() both need to add in Add Ins:

    Vilmos

    for example when we need to check find() in table then we generally navigate table \ method \ find()

    The same thing they want to use from Add Ins. They want find() and exist() there .

    If required they open find() or exist() from Add ins instead of Table \ method \ find() or exist().

    Is't possible?

    Thanks!

    Arpan Sen

  • Vilmos Kintera Profile Picture
    Vilmos Kintera 46,149 on at
    RE: find() and exist() both need to add in Add Ins:

    We still do not understand what the functionality should do from a clickable menu item.

  • @rp@n Profile Picture
    @rp@n 5,901 on at
    RE: find() and exist() both need to add in Add Ins:

    Thanks Vilmos,

    I go through the above link.

    Actually customer requirement is they want to show find() and exist() both in Add Ins in Table level.

    In table level method node both methods are there but they want to use those method from Add Ins not from method node form table level.

    Is't possible? I think it's not possible as i understood.

    please confirm.

    Thanks!

    Arpan Sen

  • Suggested answer
    Vilmos Kintera Profile Picture
    Vilmos Kintera 46,149 on at
    RE: find() and exist() both need to add in Add Ins:

    Your requirement is unclear.

    If you are on table, you have to add the find and exist methods yourself under the Methods treenode for record manipulation.

    Adding something to the Add-ins menu is a different story, that can be done as per the link above, but what would be the purpose of a find, and exist there? If you want a code template, that could done instead in the EditorScripts class.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,056 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans