Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Run X++ static method in CIL using runClassMethodIL

(0) ShareShare
ReportReport
Posted on by

I try to use the below code to run  static method in X++ in CIL but I face the error shown below where Request for the permission of type 'XppILExecutePermission' is failed although the permission is asserted . how can I solve this issue ?

3618.Untitled.gif

*This post is locked for comments

  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,458 Most Valuable Professional on at
    RE: Run X++ static method in CIL using runClassMethodIL

    The best approach is not using a job at all; you'll have to move your code to a class before deployment anyway (because no real business logic belong to jobs), so you can start with a class straight away. A class can be configured to run on a specific tier, or you can use SysOperation framework to collect input on client and execute business logic on server.

    A workaround (strictly for development purposes) is creating a menu item with RunOn = Server and execute the job through it, but creating a class is less work.

  • maram fraij Profile Picture
    maram fraij on at
    RE: Run X++ static method in CIL using runClassMethodIL

    So what Should I do to enforce the job to be executed on the server ?

  • Martin Dráb Profile Picture
    Martin Dráb 230,458 Most Valuable Professional on at
    RE: Run X++ static method in CIL using runClassMethodIL

    Ah, sorry, I thought you would already know (after a few years working with AX) that X++ can be executed at two different "tiers". One is the client tier, which is physically represented by the client process, ax32.exe. The other is the server tier, or AOS (ax32serv.exe).

    If you look at the call stack, you'll see (C) at the line with your job. It means that it was executed on client (by the client application), not on server (by the AOS).

  • maram fraij Profile Picture
    maram fraij on at
    RE: Run X++ static method in CIL using runClassMethodIL

    I execute the job on the server where AX service is running .

    0143.Untitled.gif

  • Martin Dráb Profile Picture
    Martin Dráb 230,458 Most Valuable Professional on at
    RE: Run X++ static method in CIL using runClassMethodIL

    No, it isn't, if you just run the job.

  • maram fraij Profile Picture
    maram fraij on at
    RE: Run X++ static method in CIL using runClassMethodIL

    The code is executed on the server itself .

  • Martin Dráb Profile Picture
    Martin Dráb 230,458 Most Valuable Professional on at
    RE: Run X++ static method in CIL using runClassMethodIL

    Try running your code on server. Adding "server" keyword to a job doesn't make the job to run on server.

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,711 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,458 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans