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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
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

I have the same question (0)
  • Martin Dráb Profile Picture
    240,055 Most Valuable Professional on at

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

  • maram fraij Profile Picture
    on at

    The code is executed on the server itself .

  • Martin Dráb Profile Picture
    240,055 Most Valuable Professional on at

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

  • maram fraij Profile Picture
    on at

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

    0143.Untitled.gif

  • Martin Dráb Profile Picture
    240,055 Most Valuable Professional on at

    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
    on at

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

  • Verified answer
    Martin Dráb Profile Picture
    240,055 Most Valuable Professional on at

    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.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans