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, ...
Unanswered

Get Form Header Data in Batch Job Contract using X++

(2) ShareShare
ReportReport
Posted on by 2
Business Requirement:
 
On Inventory Movement Journal Header form , there is some logic  based on that I have to create journal lines based on some values in Header table i.e, InventJournalTable , but i want to process this using a batch , So how can i get  header jounal ID or Recid , and process this to add lines using Sysoperation framework
 
 
I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    303,139 Super User 2026 Season 1 on at
    Hi Sachin,
     
    Can you clarify if a journal ID should be determined automatically in the batch job execution, or should a user fill the journal as parameter value for the batch job? IS the requirement to have a one-time only or recurring batch job?
  • Sachin Mittal Profile Picture
    2 on at
    It will be one time batch only , and in contract of batch job it should show journal ID from which we open the batch , we add a menu item in action pane and on opening it gets header Journal ID as parameter in contract
     
  • Layan Jwei Profile Picture
    8,165 Super User 2026 Season 1 on at
    Hi Sachin,
     
    So what's ur issue exactly? can you please show us the code u did so far and where are you stuck?
  • Anton Venter Profile Picture
    20,629 Super User 2026 Season 1 on at
    Hello,
     
    From the main method, I usually do something like this on the Key field of the table. You can then use the query in SysOperation class method and it will only contain the one record. This example is based on CustTable.
     
    public void modifyQueryFromArgs(Args _args)
    {
        CustTable custTable = _args.record();
        
        if (custTable)
        {
            MyContact contract = this.getDataContractObject(); // Todo: change contract type to your own.

            if (contract)
            {
                Query query = contract.getQuery();

                if (query)
                {
                    QueryBuildDataSource custTable_ds = query.dataSourceTable(tableNum(CustTable));
                    
                    SysQuery::findOrCreateRange(custTable_ds, fieldNum(CustTable, AccountNum)).value(
                        queryValue(custTable.AccountNum));
                    
                    contract.setQuery(query); // Replace query in contract with modified query.
                }
            }
        }
    }
     

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!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
André Arnaud de Calavon Profile Picture

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

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 366

#3
Adis Profile Picture

Adis 256 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans