Skip to main content

Notifications

Announcements

No record found.

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
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
 
 
  • Anton Venter Profile Picture
    19,610 Super User 2025 Season 1 on at
    Get Form Header Data in Batch Job Contract using X++
    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.
                }
            }
        }
    }
     
  • Layan Jwei Profile Picture
    7,782 Super User 2025 Season 1 on at
    Get Form Header Data in Batch Job Contract using X++
    Hi Sachin,
     
    So what's ur issue exactly? can you please show us the code u did so far and where are you stuck?
  • Sachin Mittal Profile Picture
    on at
    Get Form Header Data in Batch Job Contract using X++
    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
     
  • André Arnaud de Calavon Profile Picture
    294,261 Super User 2025 Season 1 on at
    Get Form Header Data in Batch Job Contract using X++
    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?

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,261 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 233,013 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans