Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

Cast from extensible enum 'Extensible Enumeration(EnumX)' to 'int' potentially harmful

(1) ShareShare
ReportReport
Posted on by 1,552
Hi,

how to fix the BP warning in this method (Cast from extensible enum 'Extensible Enumeration(EnumX)' to 'int' potentially harmful and deprecated)

    public str parmCacheKey()
    {
        return classStr(XEnumAtrribute) + enum2Symbol(enumNum(XEnum), xEnum);
    }
  • Suggested answer
    Martin Dráb Profile Picture
    233,664 Most Valuable Professional on at
    Cast from extensible enum 'Extensible Enumeration(EnumX)' to 'int' potentially harmful
    Use an explicit conversion from enum to int:
    enum2Symbol(enumNum(XEnum), enum2int(xEnum))
    It should make the compiler happy.
  • GirishS Profile Picture
    27,825 Moderator on at
    Cast from extensible enum 'Extensible Enumeration(EnumX)' to 'int' potentially harmful
    Hi Junior,
     
    Whats is the enum elements present in the XEnum?
    Also to confirm the issue can you separate each of the functions.
     classStr(XEnumAtrribute);
     enum2Symbol(enumNum(XEnum), xEnum);
    See if the same BP warning throws after seperating them.
     
    Thanks,
    Girish S.
  • junior AX Profile Picture
    1,552 on at
    Cast from extensible enum 'Extensible Enumeration(EnumX)' to 'int' potentially harmful
    Hi Martin,

    the type is the enum itself
     
    class XEnumAtrribute extends SysAttribute implements SysExtensionIAttribute
    {
        XEnum xEnum;
     
        public str parmCacheKey()
        {
            return classStr(XEnumAtrribute) + enum2Symbol(enumNum(XEnum), xEnum);
        }
    }
  • Martin Dráb Profile Picture
    233,664 Most Valuable Professional on at
    Cast from extensible enum 'Extensible Enumeration(EnumX)' to 'int' potentially harmful
    What is the type of xEnum variable?

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

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

#1
Martin Dráb Profile Picture

Martin Dráb 445 Most Valuable Professional

#2
Abhilash Warrier Profile Picture

Abhilash Warrier 310

#3
Saalim Ansari Profile Picture

Saalim Ansari 261

Overall leaderboard

Product updates

Dynamics 365 release plans