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

How can I get a class buffer set in previous caller to a batch job class?

(0) ShareShare
ReportReport
Posted on by 2,120

Hi Techies,

I have written a multi-threading batch job class(extends RunbaseBatch) in which I need to access one class buffer that is traversing from previous callers. I brought that buffer till this multi-threaded class by setting and getting with parm methods. whereas I can access this buffer if I don't run this class in batch, but when I enable the 'Run in batch' checkbox and executes, it loses the buffer and sets to null.

I can't add it in macro list as it is a heavy object and cannot be added in container.

I have an alternate solution, where I can reconstruct this when I run in batch and that works too, but to see the output after successful execution of batch job I need to open a complete new form and then navigate till this form to check the output. Whereas the expectation is whenever execution of batch job completes successfully I should close the form and it should show result in previous form, so the refresh is not happening correctly on this previous form even after writing refresh code because we construct new buffer in batch class.(which losses few other references).

Can anyone help me out here on how can I access the same class buffer instead of reconstructing new? or suggest other solution where I can see output once I close the current form instead of opening in new tab.

Any response is appreciated.

Thanks!

I have the same question (0)
  • Sergei Minozhenko Profile Picture
    23,095 on at

    Hi,

    Is it about AX 2012 or D365?

  • Verified answer
    nmaenpaa Profile Picture
    101,172 Moderator on at

    I'm not sure if I understand correctly. But perhaps it helps if we think how the batch class works.

    When you set it to run in batch, it stores all "input parameters" (defined in [tag:CurrentList]), packs them in a container and saves this container in the database.

    When the batch actually runs, it reads this container from the database, unpacks it, retrieves the variables and instantiates the class. Then the class is executed.

    This instance of your class can't see any "caller" classes (there aren't any - this class was just instantiated by the batch framework!). And it can't see (or refresh or close!) any forms that some user session might or might not have open.

    It's just not possible that the caller class instance could be somehow stored in the batch. It exists only in your user session. When you don't run your class in batch, different class instances in your session can see each other (presuming you pass pointer of that class to another class). But it can't work like that in batch.

  • Sangram Shinde Profile Picture
    2,120 on at

    Agreed Nikolaos, thanks for the inputs!

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!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

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

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 694

#2
André Arnaud de Calavon Profile Picture

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

#3
CP04-islander Profile Picture

CP04-islander 337

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans