Dynamics 365F&O - Forcing a refresh on a form via the refresh button

Sometimes in Dynamics 365 Finance & Operations (D365F&O) you need to refresh a form programmatically — for example, after executing some logic that updates records shown on the screen.
While formRun().dataSource().reread() or research() can work in many cases, they don’t always replicate the same behavior as clicking the built-in Refresh button. The most reliable way to trigger a full refresh identical to the user action is to programmatically invoke the click event of the standard refresh button itself.

        
            FormCommandButtonControl refreshButton = sender.formRun().control(sender.formRun().controlId('SystemDefinedRefreshButton'));
            refreshButton.clicked();
        
    
How It Works
  • sender.formRun() gives you access to the current form runtime object.

  • controlId('SystemDefinedRefreshButton') retrieves the control ID for the form’s system-defined Refresh button.

  • The control is cast to a FormCommandButtonControl, and the clicked() method is invoked to simulate a user click.

This approach ensures the form behaves exactly as if the user manually pressed Refresh — re-reading data sources, re-initializing controls, and executing any form refresh logic configured by Microsoft or customizations.

When to Use It

Use this method when:

  • You’ve performed backend logic that updates data displayed on the current form.

  • You need to ensure all controls and data sources are fully refreshed (not just re-read).

  • You want to maintain standard refresh behavior consistent with the D365F&O UI.

Caution
  • Make sure you call this from a safe context (e.g., within a button click handler, process guide step, or post-update event) to avoid recursion or refresh loops.

  • Avoid calling it repeatedly in a single transaction — it triggers a full UI refresh each time.

Dynamics 365 F&O Development Services

Does your dev team have too much on their plate? We can help by handling big or small Dynamics 365 customization projects at a competitive rate. Click here.

File based integration system for Dynamics 365 Finance and Operations

Ariene enables your Dynamics 365 Finance and Supply Chain Management system to seamlessly push or pull XML, CSV, and other file formats to and from external systems. It supports a wide range of file servers including SFTP, FTP, FTPS, Azure Storage, Azure Files, OneDrive, SharePoint, Amazon S3, BackBlaze B2, Google Cloud, Google Drive, WebDAV, Box and DropBox. You can build integrations using X++ code or configure them through a no-code interface—whichever fits your needs.. Click here.

×