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

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Trigger a form open from a background(async) batch job

(0) ShareShare
ReportReport
Posted on by 10

Hi Everybody,

Is there a way to trigger a form open through code executing in a background(async) batch job?

The problem i am facing is that the batch runs in IL and the form opens in client so it gives an error.

*This post is locked for comments

I have the same question (0)
  • Eben Abraham Profile Picture
    10 on at
    RE: Trigger a form open from a background(async) batch job

    Thank you I will use something like watchdog()

  • Verified answer
    Martin Dráb Profile Picture
    235,914 Most Valuable Professional on at
    RE: Trigger a form open from a background(async) batch job

    You can't just somehow connect to another client computer and open a form there. The action needs to come from the client itself.

    I also don't see how SysOperation framework would help for this requirement.

    You could do something like periodically executing a method with delayed start (using setTimeOut()), checking the value and opening the form if a condition is met.

    Look at Info.watchDow() for an example of this approach (performing a different action).

  • Eben Abraham Profile Picture
    10 on at
    RE: Trigger a form open from a background(async) batch job

    What I am trying to do is

    Suppose two users A and B are logged into AX, based on some action done by A(this action will have some relation with B like userId), I want to open a form in B's session.

    To achieve this I am trying to run a reliable asynchronous batch in B's session to check if any update is done by anyone(in this case A), once the batch gets a record in the table, the batch should stop and a form open should be called in B's session.

    Or is there a way to trigger a form open across different user sessions? By using xSession may be?

  • Martin Dráb Profile Picture
    235,914 Most Valuable Professional on at
    RE: Trigger a form open from a background(async) batch job

    Maybe you should first tell us what business logic you're trying to implement.

  • Martin Dráb Profile Picture
    235,914 Most Valuable Professional on at
    RE: Trigger a form open from a background(async) batch job

    Let me repeat the first sentence: If it's a real, server-side batch, then there is no client at all to open a form in.

    Because the requirement has no sense for batches, the rest of my reply is about asynchronous tasks, not batches.

    It seems to me that you still try to open a form in a batch, ignoring the fact that the batch server has no relation to any client.

  • Eben Abraham Profile Picture
    10 on at
    RE: Trigger a form open from a background(async) batch job

    thanks Martin for the answer, I tried the same, In after operation if I call the info() and the form call inside info, it saves the message in Log of the batch and from there we can open our form from the infolog,

    If I call the menu item directly, it still gives me the same error saying form is in client

  • Suggested answer
    Martin Dráb Profile Picture
    235,914 Most Valuable Professional on at
    RE: Trigger a form open from a background(async) batch job

    If it's a real, server-side batch, then there is no client at all to open a form in.

    But if you run an asynchronous task (using the SysOperation framework), you can override the afterOperation() method and run you code there. Look at IntrastatExportController_IT.afterOperation() (in AX 2012 R3 at least; not sure about older versions).

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Syed Haris Shah Profile Picture

Syed Haris Shah 9

#2
Mea_ Profile Picture

Mea_ 4

#3
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans