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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Batch job for all companies

(0) ShareShare
ReportReport
Posted on by 103

Hello, I am trying to create a batch job to auto-post purchase invoice journal entries. The problem I have is that the business profile I am implementing this feature for has hundreds of companies, so it would be infeasible to manually go into each company's profile and re-create the same batch job.

I saw another post where someone mentioned the existence of a cross-company keyword that I can use for the batch job, but I cannot find where this is -    - can someone show me where this is?    

I have the same question (0)
  • Suggested answer
    Mohit Rampal Profile Picture
    12,565 Moderator on at

    Hi, You must have written logic in code to find and post purchase order journal entries. As mentioned in the thread you shared, you can use cross company to get data from all companies and post it. The usage of cross company depends on how you have written the logic.

    www.tech.alirazazaidi.com/.../

    If still doubt then please provide information like which class you are using and the code in it which will run the logic for batch job.

  • Suggested answer
    Anton Venter Profile Picture
    20,346 Super User 2025 Season 2 on at

    I would just create a small customisation (new batch job) that calls the existing job for all legal entities.

    while select id from dataArea
        where !dataArea.isVirtual
    {
        changeCompany(dataArea.id)
        {
            //call logic per legal entity here...
        }
    }

    In fact, I would make it configurable so that it can be reused for other batch jobs as well and not only the one. This should be standard functionality in my view.

  • André Arnaud de Calavon Profile Picture
    301,075 Super User 2025 Season 2 on at

    Hi tl2022,

    In addition to the replies above you can consider having a batch job which will create additional batch tasks to divide the workload is you would see some performance issues. Similar to this is the standard workflow processing batch job which creates a task per bundle of 100 workflow messages.

  • tl2022 Profile Picture
    103 on at

    Thanks everyone for their input. Can any of these solutions be used for the version of Finance and Operations I am using:

    Installed product version : 10.0.31 (10.0.1406.119)

    Installed platform version : Update55 (7.0.6651.110)

    In this version of the application, I did not write any code to create the batch job. I just more or less followed the instructions as seen in this post - community.dynamics.com/.../auto-post-journals - where I use the "General ledger > Journal entries > Post journals" utility. I don't know where I can add the customization to go across companies if I create the batch job using this method. Can anyone advise?

  • André Arnaud de Calavon Profile Picture
    301,075 Super User 2025 Season 2 on at

    Hi tl2022,

    You can create a new class for a new batch job which would change the company and per company then calls the same logic as the standard batch does which you are referring to.

  • tl2022 Profile Picture
    103 on at

    Hi Andre, I will read the documentation on classes. Do I have to install it as a plugin into D365? Asking because our client currently has a code freeze and I believe that I would have to get special approval to install any plugins.

  • Mohit Rampal Profile Picture
    12,565 Moderator on at

    Hi, No plug-ins required, as Andre mentioned, you can create new class within D365fo (using visual studio).

  • André Arnaud de Calavon Profile Picture
    301,075 Super User 2025 Season 2 on at

    Hi tl2022,

    What is the definition of "plugin" here?

    I had another look at the batch options. You can manually add tasks to batch jobs. You can setup one or more batch jobs manually have a different line per legal entity using the class "LedgerJournalMutiPost. Per line, you can set the Parameters to post the journal with the correct journal per legal entity. This will be a cumbersome task like creating the batch jobs separately per company. However, if the customer has a code freeze, you can explain that a customization could save time now and in the future.

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

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
Martin Dráb Profile Picture

Martin Dráb 551 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 278 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans