Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Finance forum / How to refresh data on...
Finance forum
Suggested answer

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

Posted on by 63
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
    Bharani Preetham Pe... 3,538 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
    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
    Waed Ayyad 5,197 Super User 2024 Season 2 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
    Anthony Blake 1,843 Super User 2024 Season 2 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
    Layan Jwei 6,886 Super User 2024 Season 2 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
    Mohamed Amine Mahmoudi 9,186 Super User 2024 Season 2 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
    Waed Ayyad 5,197 Super User 2024 Season 2 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
    Roy Saliba 63 on at
    How to refresh data on the form level with X++?
    Yes I tried but nothing worked
  • Layan Jwei Profile Picture
    Layan Jwei 6,886 Super User 2024 Season 2 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

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 9th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

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

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,339 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,177 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans