web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Getting Enum value for display method x++

(0) ShareShare
ReportReport
Posted on by 65

I wrote a display method for an extension table. ServiceSubStatus is an enum field so 0,1,2 are displaying but I need to display the value of the enum.

Can you please help me with this?

   [ExtensionOf(tableStr(EntAssetObjectTable))]
public final class ObjectTable_Extension
{
    public display ServiceSubStatus ServiceSubStatus()
    {    


        return (ServiceStatus::findByRecId(this.ServiceStatus).ServiceSubStatus);

    
    }

}

I have the same question (0)
  • Suggested answer
    TracyXing Profile Picture
    on at
    RE: Getting Enum value for display method x++

    You can use enum2Str function to get the string value of Enum, refer to:

    enum2Str Function | Microsoft Docs

  • Martin Dráb Profile Picture
    236,297 Most Valuable Professional on at
    RE: Getting Enum value for display method x++

    What you're describing isn't the expected behavior. What you should see is enum's label, not numeric values.

    Could you please look at ServiceSubStatus enum (it doesn't exist in my F&O application) and check the Label property of enum elements? A possible explaination is that somebody set the numbers as labels.

  • YCeren Profile Picture
    65 on at
    RE: Getting Enum value for display method x++

    ServiceSubStatus exists as Base Enum (I have created it) and labels are fine, I am not sure why I get this result

  • Verified answer
    atajjo Profile Picture
    509 on at
    RE: Getting Enum value for display method x++

    [ExtensionOf(tableStr(EntAssetObjectTable))]
    public final class ObjectTable_Extension
    {
        public display str ServiceSubStatus()
        {    
    
    
            return (enum2str(ServiceStatus::findByRecId(this.ServiceStatus).ServiceSubStatus));
    
        
        }
    
    }

    Try the code above (I used enum2str and changed return type to string)

  • YCeren Profile Picture
    65 on at
    RE: Getting Enum value for display method x++

     public display str ServiceSubStatus()
        {
    
            SysDictEnum dictEnum = new SysDictEnum(enumNum(ServiceSubStatusEnum));
    
            ServiceStatus serviceStatus = ServiceStatus::findByRecId(this.ServiceStatus);
            if(serviceStatus)
            {
                return dictEnum.value2Label(serviceStatus.ServiceSubStatus);
            }
           

    I coded this way and it worked but thank you so much for your answer

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 2,167

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 867 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 617 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans