FlowField not updating immediately in Purchase Header

mustafaAlsoufi
Member Posts: 66
I am trying to calculate the sum of the "Purchase Line Total Weight" from the Purchase Line table and display it in the Purchase Header using a FlowField. However, the FlowField only updates when I insert a new line or when I close and reopen the page.
What I want to achieve is for the Purchase Header field to update immediately whenever a new line is inserted, an existing line is modified, or a line is deleted in the Purchase Line.
Could someone help me understand why the FlowField isn't updating as expected and suggest the best approach to make sure the field in the Purchase Header updates in real-time?

What I want to achieve is for the Purchase Header field to update immediately whenever a new line is inserted, an existing line is modified, or a line is deleted in the Purchase Line.
Could someone help me understand why the FlowField isn't updating as expected and suggest the best approach to make sure the field in the Purchase Header updates in real-time?

0
Answers
-
You have to update header page to get update all header flowfields. You have a possibilities:
- if you want to show total to user, you have to apply time based script (https://www.packtpub.com/application-development/mastering-microsoft-dynamics-365-business-central)
- if you need total for internal calculation, you can define header record and use a calcfields method.0 -
@lubost I would like to display the total of the "Purchase Line Total Weight" in the Purchase Header, but I believe the link you shared doesn't work. Could you please provide the code here so I can implement it?
Also, where exactly should I add the code? I believe the code should be added to the Purchase Order Subform (the page where the lines are updated), since that's where the Purchase Line data gets updated. Would you agree with that approach?0 -
Hello You can have a FlowField on Purchase Header calculating Total Weight, that is fine.
But do you have to display it on Purchase Invoice page? Why not display it with the rest of the document totals?United Kingdom0 -
@Developer101 to clarify, I only want the total to be updated in the Purchase Header, not in the Purchase Line document totals. Is there a way to achieve this? I’m wondering if there’s a function or event that can trigger an immediate update to the Purchase Order page as soon as the Purchase Line fields are populated or modified. Would that be possible?0
-
- Purchase header page don't know that lines are changed.
- Purchase lines page don't know anything about purchase header page
You have following approaches:
- Refresh purchase header page every x seconds to update total fields. You can do it by using javascript addin in header page.
- Purchase line page has a "card like" part with some totals. You can add your total field to this part.0 -
Lubost’s reply is valid.
Flowfield on the purchase header table will be updated no problem. You don’t have to do anything in addition. So if you want to use it on a report or anything you could.
But your issue is that you want to update it on the purchase invoice page (header page) real time, isnt it. You said you want it to be updated immediately in your post. My question was why do you want it? What is the reason? Is this a requirement from customer?
If this real time update is for user to see when they add/modifying/ deleting then easier will as suggested by me and lupost is to add it in the document totals (card like part on the subpage!United Kingdom0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions