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, ...
Suggested Answer

SysOperation Framework and refresh form grid

(0) ShareShare
ReportReport
Posted on by 709

Hello,

I created a batch job class using SysOperation Framework, however this class  also can be called from a form button. The class it self is creating new records which in the end will be shows in that form grid.

My question is, while this class as a batch job supposedly to run in background (scheduled), there are time I want to run it as well (manual) from the button of the form. The process is running well, and the records created, but how to refresh the grid ? because currently I need to press Refresh after ran this class in order to make the new records appears in my grid. Any advice how to do this correctly ? as I don't want the logic looks odd while it is also will running in background which obviously no Form called him.

Please advised. 

Thank you

I have the same question (0)
  • Suggested answer
    Deepak Agarwal Profile Picture
    8,602 on at

    Hey,

    On the form button, write your code on the clicked method of the button or the respective event of the button. You need to refresh the query of the form once this operation is done.

  • ShaqAX Profile Picture
    709 on at

    Hi Deepak,

    Sorry just to confirm again, so it's the menu item button's clicked button is where I should put the refresh ? whereby the menuitem, we can let it set to call my action menu item set to my SysOperation class, this is correct, right ?

    And may I know how to refresh the query ? just "table_ds".executequery(); ?

    Thanks

  • Suggested answer
    Arunraj Rajasekar Profile Picture
    1,743 on at

    After super(), add table ds.executeQuery to the clicked method of your action menu item.

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

    Which execution mode are you using? If Synchronous, you can simply run the refresh executing the operation, but it won't work with any of the asynchronous modes.

    Also, should this be logic specific to this one form, or do you want to do it in all forms where the menu item can be placed? If it's the latter, you should place the logic to the controller, not to all the individual forms. SysOperationServiceController offers afterOperation() method for these purposes.

  • Ferhat.S Profile Picture
    238 on at

    I was facing same issue. As Martin says seems like there is no easy way with asynchronous working style. Other hand if u are using menu item button there is a Auto Refresh Data property on behevior turn it to yes and its worked fined for me. "however this class  also can be called from a form button" its same as mine. I put a parameter on form call and changed working style to synchronous.

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

    I didn't say it's impossible - I said you can't simply run the code after calling the operation, because the operation probably hasn't been completed yet. You would need a different solution. But I would rather avoid it. Either run it synchronously, if it's short, or run it asynchronously and don't try to reload data under user's hands.

  • Deepak Agarwal Profile Picture
    8,602 on at

    Yes you need to use the menu item button's clicked. You can refresh the DS by something like, VendTable_ds.refresh();

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

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 250 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans