Skip to main content

Notifications

Dynamics 365 Community / Forums / Finance forum / method does not denote...
Finance forum

method does not denote a predefined function, a static method on the Global class nor a previously defined local function d365

Posted on by 920

Hi,

I develop a class that contains many methods:

public class EUKSecurityPrivilege
{

    #EUKMacro

    /// <summary>
    ///     Method can verify if Node is an output  MenuItem
    /// </summary>
   public static boolean isMenuItemOutput(EUKSecurityTreeNode _eukSecurityTreeNode)
    {
        boolean isTrue = false;
        if(_eukSecurityTreeNode != null && _eukSecurityTreeNode.SecurableType == SecurableType::MenuItemOutput)
        {
            isTrue = true;
        }
        return isTrue;
    }
 public   str generatePrivilegeName(EUKSecurityTreeNode _eukSecurityTreeNode)
    {
        str finalSecurableName   =   _eukSecurityTreeNode.SecurableName;
        if (isMenuItemOutput(_eukSecurityTreeNode))
        {
            // Concatenate Prefix Output Menu item with its name
            finalSecurableName = #MenuItemOutputPrefix + finalSecurableName ;
        }
}


the method generatePrivilegeName calls the method isMenuItemOutput  => I get error : 

Severity Code Description Project File Line Suppression State
Error The name 'isMenuItemOutput' does not denote a predefined function, a static method on the Global class nor a previously defined local function.

  • BASMA Profile Picture
    BASMA 920 on at
    RE: method does not denote a predefined function, a static method on the Global class nor a previously defined local function d365

    thanks Blue Wang :)

  • Suggested answer
    Blue Wang Profile Picture
    Blue Wang on at
    RE: method does not denote a predefined function, a static method on the Global class nor a previously defined local function d365

    Hi Basma,

    Because your method is static, call it by class name. In addition, return is omitted from your generatePrivilegeName() method.

    if (Class1::isMenuItemOutput(_eukSecurityTreeNode))
    {
    // Concatenate Prefix Output Menu item with its name
    finalSecurableName = #MenuItemOutputPrefix + finalSecurableName ;
    }

    _5563B783_.PNG

  • BASMA Profile Picture
    BASMA 920 on at
    RE: method does not denote a predefined function, a static method on the Global class nor a previously defined local function d365

    Thanks Nikolaos Mäenpää :)

  • Verified answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: method does not denote a predefined function, a static method on the Global class nor a previously defined local function d365

    isMenuItemOutput is a static method. So you need to call it like this: "EUKSecurityPrivilege::isMenuItemOutput". If it were not a static method, you would call it like "this.isMenuItemOutput".

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

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

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,228 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