Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5932585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:51:16+00:00 2026-05-22T14:51:16+00:00

The run method shown below is from the class Tutorial_RunbaseBatch to run it in

  • 0

The run method shown below is from the class Tutorial_RunbaseBatch to run it in batch.

I made the following changes:

  1. Modified the method constructSecurityKeySet in class SysSecurity to server client static public SecurityKeySet constructSecurityKeySet()

  2. Modified the method runJobStatic in class BatchRun to server client static void runJobStatic(recId batchId)

I am aware of the fact that I should not be playing around with the framework classes but this is just a research. It worked fine until I added the following code sections.

Code change 1:

MenuItemName    menuItemName;
AccessType      act;

Code change 2:

act = securitySet.secureNodeAccessmenuItemName,SysSecurity::accessRecType2UtilElementType(AccessRecordType::MenuItemDisplay)); // Line 24

Now, I get the below error message after adding the above code sections

The server-side impersonated (RunAs) session tried to invoke a method that is available for client-side processing only.
(S)\Classes\Tutorial_RunbaseBatch\run - line 24 
(S)\Classes\BatchRun\runJobStatic - line 62 //which is  batchClass.run();

The SecurityKeySet(SystemClass) has the property RunOn set to calledFrom and is executed wherever the object is called from, which could be client or server. It also has dependencies on Class Batchable and BatchRunable. Both the classes have the property RunOn set to calledFrom

I tried changing the properties to server on the classes but that did not work

Is there anyway to make this code work?

Complete code:

public void run()
{
    SecurityKeySet      securitySet;
    UserGroupId         fromUserGroupId;
    DomainId            domainId;
    MenuItemName        menuItemName;
    AccessType          act;
    ;

    #OCCRetryCount

    fromUserGroupId = "XXXX";
    domainId        = "YYYY";

    if (!this.validate())
        throw error("");

    try
    {
        ttsbegin;
        // this.Update();
        securitySet=SysSecurity::constructSecurityKeySet();//error
        securitySet.loadGroupRights(fromUserGroupId,domainId);
        act = securitySet.secureNodeAccess(menuItemName,SysSecurity::accessRecType2UtilElementType(AccessRecordType::MenuItemDisplay));
        ttscommit;
    }
    catch (Exception::Deadlock)
    {
        retry;
    }
    catch (Exception::UpdateConflict)
    {
        if (appl.ttsLevel() == 0)
        {
            if (xSession::currentRetryCount() >= #RetryNum)
            {
                throw Exception::UpdateConflictNotRecovered;
            }
            else
            {
                retry;
            }
        }
        else
        {
            throw Exception::UpdateConflict;
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T14:51:16+00:00Added an answer on May 22, 2026 at 2:51 pm

    Reason for the issue:

    SysSecurity class is by default set to run on the Client. Changing the method constructSecurityKeySet to server client static will not help to run the code on the server. You can change the RunOn property on the class SysSecurity but there might be a reason why it is set to run on Client. Hence, I would not recommend the option of changing the RunOn mode to Client.

    However, if you still want to try running the code in batch. You can read through the below description about the same error that I faced and how I resolved the issue using a workaround.

    Similar issue:

    I faced the same error message while trying to run SalesInvoice report in Batch to e-mail invoice PDFs.

    The server-side impersonated (RunAs) session tried to invoke a method that is available for client-side processing only.

    The issue with my scenario was the report had an image and embedding logo into the report involved client side processing and the batch process could not handle that while running on the server. Jobs added to the batch process always runs on the Server.

    Perform the following steps in AX to find this information.

    1. Navigate to Basic \ Inquiries \ Batch job
    2. Click the batch job
    3. Click View tasks on the right side to bring the tasks window
    4. On the Tasks window, the column Run location should display Server, where the job executes.

    Caution:

    I would suggest using caution with the below mentioned approach to update the batch job data in the database using T-SQL query.

    Possible fix:

    To run the SalesInvoice job on the client, like it used to do in 4.0, I ended up modifying the value directly in the database using the below query.

    UPDATE dbo.BATCH SET RUNTYPE = 0 WHERE CAPTION = '<Your job caption name...>'
    

    Once the query has been executed to update the batch job data, verify that the Run location column under the Tasks window of the job is set to Client. When the job task is set to run in Client, it will not execute unless the Batch processing is initiated. Batch processing can be started by navigating to Basic \ Periodic \ Batch \ Processing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to pop up dialog from run method it gives me exception
Suppose I want to run the following method foo() once every hour in Grails:
Is it possible to run a class method (starting with a '+') in a
I have a method which uses CyclicBarrier as shown below: public void getMessage(Message obj){
I'm loading a Groovy script/class from a remote server, creating a new instance, and
I am trying to run a batch script from within a c sharp program
im trying to kick off a Runnable classes run method however i keep getting
I need to run some method in Swing application in separate thread. What is
I'd like to run a method when a user switches to another tab or
I realize that the method run() must be declared because its declared in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.