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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Passing Parameters from form to class in AX

(0) ShareShare
ReportReport
Posted on by 636

Hi Experts,

I have a table and form consider as TestTable with 2 fields in it. 

1. Employee (string)

2. Posted (NoYes, Checkbox) 

I am running a batch job through the class named TestClass to process the data if the checkbox is set to No for any record in the table. 

public void run()
{
ttsBegin;

while select forUpdate TestTable where TestTable.Posted == NoYes::No 
{
does the updates here.

}

ttscommit;

If I select only one record in the form and I need to process only that particular record. how the run method should be?. I have created a button in the form to call the class but no idea how to pass the arguments to the class through the clicked method on the button. I need to call the class and process the particular record whenever needed without harming the batch job's usual run. 

Appreciate helping with the clicked & run method sample. 

Thanks in advance.  

I have the same question (0)
  • Verified answer
    Sergei Minozhenko Profile Picture
    23,095 on at

    Hi AX Beginner,

    1. You should create an action menu item for your runbase class

    2. Add a new action menu item to the form instead of a button

    3. In main method you can get access to the current cursor on the from with Args parameter (_args.record()) and pass it to a class variable via parm method.

    4. Then you can modify your method like

    while select forUpdate TestTable 
        where TestTable.RecId = myTestTestPassedViaParmMethod.RecId //Or use other primary key fields instead of recId
           && TestTable.Posted == NoYes::No 
    {
    does the updates here.
    
    }

  • Verified answer
    Blue Wang Profile Picture
    Microsoft Employee on at

    Hi AX Beginner ,

    Args class is usually used in AX for passing parameters between forms.

    Please read these:

    faizanashraf.wordpress.com/.../

    rohitdynamics.blogspot.com/.../pass-value-from-form-to-class-in-ax-2012.html

    community.dynamics.com/.../passing-argument-from-form-to-class

  • Verified answer
    Martin Dráb Profile Picture
    239,040 Most Valuable Professional on at

    It depends on which framework was used to implement the batch job.

    If RunBaseBatch, you need to create a variable holding identification of the record, such as RecId. You'll set this variable from _args.record()). You also must add it to CurrentList macro.

    If it's based on SysOperation framework, add a variable and parm* method for RecId to the data contract class and set it in the service controller.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 658

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 468 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 333 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans