Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Answered

View data is not updating until rebuild of application is done.

(0) ShareShare
ReportReport
Posted on by 338
Hi Team,
 
 
Issue::
====
View data is not updating until rebuild of application is done.
 
I have created AOT query(which has around 25 tables) and added that query into my view. When I check data in SQL by writing SQL query same as AOT query and view data everything is perfect.
 
When I update any data in front end of form (D365FnO) and then execute sql query then result data is updating but when am executing view updated data is not showing. When I rebuild D365FnO application and go back to SQL and execute view I can see updated data.
 
Do I need to write any methods on view for refreshing or missing anything? Please guide me.
 
Thank you in advance.
  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 230,817 Most Valuable Professional on at
    View data is not updating until rebuild of application is done.
    Yes, this is exactly the kind of bug I expected.
     
    There is no way how SQL code could call the X++ function, therefore what happens is that the function is executed on DB synchronization (not code build) and the value is inserted to the generated SQL code.
     
    Instead of trying to put these ranges to the view definition, use them when reading data from the view.
  • Srimdax Profile Picture
    Srimdax 338 on at
    View data is not updating until rebuild of application is done.
    Thanks Martin for quick reply, as I was using in query range as validto <DateTimeUtil::getSystemDateTime() and validfrom >DateTimeUtil::getSystemDateTime() this date getting stored as exact rebuild time which is causing issue and if I try to use in AOT query rand as <=DateTimeUtil::getSystemDateTime() and >=DateTimeUtil::getSystemDateTime() which system is not supporting can you specify exact dates function to be used plz? if not please specify what should be used maxdate function which will accept in AOT query range? DateTimeUtil::maxdate() is not correct function. 
  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,817 Most Valuable Professional on at
    View data is not updating until rebuild of application is done.
    A view is actually a piece of SQL code. When you say that running a SQL query returns data by querying the view doesn't, it must mean that SQL code of your query isn't the same SQL code that the view uses to fetch the data. Open the view definition on SQL Server Management Studio and copy the right SQL code from there.
     
    You told us almost nothing about your view, but I suspect you have a wrong range value there, one that is updated when doing DB synchronization. It it's the case, looking at SQL code of the view will show you an unexpected hard-coded value in a WHERE condition.
     
    There is no method to call to refresh the data because, as I explained, a view doesn't store data anywhere. A view is a wrapper of a SQL query. What you need to do is fixing the problem in the query.

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

Announcing Our 2025 Season 1 Super Users!

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

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,965 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,817 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans