Skip to main content

Notifications

Announcements

No record found.

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,550
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
    Martin Dráb 230,466 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
    GirishS 27,816 Super User 2024 Season 1 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
    junior AX 1,550 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
    Martin Dráb 230,466 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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,466 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans