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 :
Microsoft Dynamics AX (Archived)

Running existing code on the batch server

(0) ShareShare
ReportReport
Posted on by 455

Hi,

 

In the system I am developing we have changed the invoicing completely from scratch because we need it to do things which invoice proposals can't do and would be too much work to upgrade it.

Our existing logic is currently freezing the client window if they have a complex invoice so we thought that we would push the posting logic onto a batch job like the invoice proposals do currently.

I make our class extend RunBaseBatch and put some info message into the code so that I can see it clearly on the history but it is still running on the client. I am aware this sounds like a stupid question but i have had difficulty finding out on the internet how we can upgrade our class to run on the batch.

Something which I found which may or may not be relevant is the fact that the posting logic on the proposals extends FormLetter which does seem to have some batching and performance enhancements. Would refactoring the code to extend this be the only way to get it working on the batch?

Thanks in advance.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    Extending RunBaseBatch isn't difficult, but I suggest not to do it, because AX 2012 has a new and better framework for this purpose: SysOperation framework. Switch to it before you invest more time to the RunBase framework.

    By the way, I would be much more careful before abandoning the default invoice framework - it has many performance-related features that you're obviously not aware of.

  • Keith Hirst Profile Picture
    455 on at

    Hi Martin,

    Thanks for your reply, I will look into SysOperation framework, it seems really well documented actually I am quite suprised. Would you advise that in my situation I start with a basic SysOperation framework and build our custom code into it or should I be able to upgrade our existing code.

    There are business reasons why we didn't go with the existing invoicing.

  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    In the simplest case, you just ask the SysOperation framework to call a given method in a given class and you don't have to change it at all.

    Things are usually more complex, though. For example, you may need to rework your dialogs or remove dependencies on client-bound code.

  • Keith Hirst Profile Picture
    455 on at

    So I implemented the sysOperation Framework which was relativly easy to do, as you said I did need to change a few things around so that the records were passed in correctly to the main method and it seems to be mostly working (a few bugs but nothing too hard to handle)

    The problem I'm facing atm though is that we need it to do something different if it is running in batch than when it isnt. When we implemented this kind of behavior we noticed that the dialog ALWAYS returned signs that the code was running in batch. I.e. we tried using this.isInBatch() and that always said yes. We tried various other methods and it all seemed to point that it was running it on batch.

    Have you any advice? What method should we be overriding to get the behaviour we are wanting. At the moment we think it could be a problem with the sysOperation framework itself but before we ask Microsoft for advice we wanted to see whether you had experienced something similar and how you got around it.

    BTW I do intend to mark your answer as the correct answer but wanted to keep it open untill I finish.

  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    Which execution mode do you use there? You can find it in executionModel variable or by calling parmExcecutionMode().

  • Keith Hirst Profile Picture
    455 on at

    Its using reliableAsynchronous.

    The example that we are using initially set it to Synchronus when in the construct method but then we needed it to be populated from Args and for some reason it didn't set it in the new constructFromArgs method. This would explain why it is acting differently.

    According to the white paper i've just read from the link your provided it gives examples of the execution modes. Would you suggest that in my code I change the execution mode to asynchronus when not running in batch as it is quite a lengthy process.

    Thanks for all your help so far.

  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    Use the execution mode that meets your requirements. I'm not sure what problem are you trying to address in the moment.

    My opinion is that reliability is important for invoice postings and therefore reliable asynchronous mode makes sense to me.

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans