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

How to refresh data on the form level with X++?

(2) ShareShare
ReportReport
Posted on by
Hello, I have a form and a dialog in D365FO that when I click the Ok button, it modifies the data.
My only problem is when the dialog is closed, the data on the form level is not refreshed until I click the refresh button above the form.
How can I write this in my code.
 
I tried the datasource.refresh() and reread() but nothing worked.
 
Can someone help?
 
  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    3,622 Moderator on at
    How to refresh data on the form level with X++?
    After the update logic in the dialog code, you need to get the caller datasource and call research(true).
  • Suggested answer
    Nasheet Ahmed Siddiqui Profile Picture
    2 on at
    How to refresh data on the form level with X++?
     
    Just get the parent data source in the init of the form.
    ParentDataSource = element.args().record().dataSource();
     
    call the below in the close of the form to get the refresh of the parent datasource.
     ParentDataSource .research();
     ParentDataSource .refresh();
     
     
  • Waed Ayyad Profile Picture
    7,865 Super User 2025 Season 1 on at
    How to refresh data on the form level with X++?
    Hi,

    Is your issue resolved?  If yes, mark the answers that helped you as verified.

    Thanks
    Waed Ayyad
  • Anthony Blake Profile Picture
    2,339 Super User 2025 Season 1 on at
    How to refresh data on the form level with X++?
    I think you must be calling it from the wrong place/method/event handler, because the code below looks okay. Share your code & debug results.
  • Layan Jwei Profile Picture
    7,722 Super User 2025 Season 1 on at
    How to refresh data on the form level with X++?
    Hi Roy,
     
    I think it should work if you did this for the caller datasouece. Please share ur code with us.
  • Mohamed Amine Mahmoudi Profile Picture
    17,304 Super User 2025 Season 1 on at
    How to refresh data on the form level with X++?
    Hi @Roy
     
    I hope this can help you and give you some hints.
     
    Best regards,
    Mohamed Amine MAHMOUDI
  • Waed Ayyad Profile Picture
    7,865 Super User 2025 Season 1 on at
    How to refresh data on the form level with X++?
    Hi,
     
    Can you share your code? Did you get caller DataSource?
     
    Also try to use the following:
    YourCallerds.reread();
    YourCallerds.rereadreferencedatasource();
    YourCallerds.research(true);
    Thanks,
    Waed Ayyad
    If this helped, please mark it as "Verified" for others facing the same issue
     
  • Roy Saliba Profile Picture
    on at
    How to refresh data on the form level with X++?
    Yes I tried but nothing worked
  • Layan Jwei Profile Picture
    7,722 Super User 2025 Season 1 on at
    How to refresh data on the form level with X++?
    Hi,
     
    Did you try to call together "reread then refresh"?
     
    Or try to call research(true); alone
     
    Thanks,
    Layan Jweihan 
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,043 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,864 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans