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

Notifications

Announcements

No record found.

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
    237,880 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
    237,880 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
    237,880 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
    237,880 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans