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

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

(0) ShareShare
ReportReport
Posted on by 2,114

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,093 on at

    Hi,

    Is it about AX 2012 or D365?

  • Verified answer
    nmaenpaa Profile Picture
    101,160 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,114 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

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 584 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 254 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans