Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

Batch job for all companies

(0) ShareShare
ReportReport
Posted on by 101

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?    

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 292,160 Super User 2025 Season 1 on at
    RE: Batch job for all companies

    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.

  • Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: Batch job for all companies

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

  • tl2022 Profile Picture
    tl2022 101 on at
    RE: Batch job for all companies

    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.

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 292,160 Super User 2025 Season 1 on at
    RE: Batch job for all companies

    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
    tl2022 101 on at
    RE: Batch job for all companies

    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
    André Arnaud de Cal... 292,160 Super User 2025 Season 1 on at
    RE: Batch job for all companies

    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.

  • Suggested answer
    Anton Venter Profile Picture
    Anton Venter 19,495 Super User 2025 Season 1 on at
    RE: Batch job for all companies

    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.

  • Suggested answer
    Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: Batch job for all companies

    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.

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,160 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,962 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans