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

Notifications

Announcements

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
    301,551 Super User 2025 Season 2 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,135 Super User 2025 Season 2 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,385 Super User 2025 Season 2 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

News and Announcements

Season of Giving Solutions is Here!

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 763 Super User 2025 Season 2

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 413 Super User 2025 Season 2

#3
Martin Dráb Profile Picture

Martin Dráb 284 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans