Update Form from SubForm

alex88
Member Posts: 4
I have a form Customer with a field Has Comment(boolean) and a button Comments that opens another form where i can put comments in. When i close the comments form, Has Comments field in my Customer form should be updated but i cant find a way to do it i have tried different triggers on my Customer form using CurrForm.UPDATE but i cant seem get it to work. The only way Has Comments is updated if i open the comment form again.
Code behind Comments button:
And this is the code that i have in my CodeUnit
Code behind Comments button:
CurrForm.SETSELECTIONFILTER(Customer); CheckComments.SetCommentForCustomer(Customer);
And this is the code that i have in my CodeUnit
IF pCustomer.FINDSET(TRUE,FALSE) THEN REPEAT Comments.RESET; Comments.SETRANGE(TableLink,pCustomer.Customer); Comments.SETFILTER(Comment, '<>%1',''); IF Comments.FINDFIRST THEN pExecise3Customer.HasComment := TRUE ELSE pCustomer.HasComment := FALSE; pCustomer.MODIFY; UNTIL pCustomer.NEXT = 0;
0
Best Answer
-
I found the problem. When i press my Comment button it does
CurrForm.SETSELECTIONFILTER(Customer); CheckComments.SetCommentForCustomer(Customer);
The problem with that is that is that it was running my CheckComment codeunit before i even made any changes. I just moved my codeUnit to OnCloseForm trigger so the codeunit runs after i made the changes and closed the form.0
Answers
-
0
-
I'm using Dynamiv Nav 2009 i've read that UpdatePropagation was added in Nav 2016? Or am i wrong? I can't find it anywhere.0
-
I'm using Dynamiv Nav 2009 i've read that UpdatePropagation was added in Nav 2016? Or am i wrong? I can't find it anywhere.
Yes, you are right. With NAV 2009 you can only achive this by using some tricky functions. I have found this blog article for example.
https://dynamicsuser.net/nav/b/mark_brummel/posts/tip-25-update-header-page-from-the-line-page1 -
I found the problem. When i press my Comment button it does
CurrForm.SETSELECTIONFILTER(Customer); CheckComments.SetCommentForCustomer(Customer);
The problem with that is that is that it was running my CheckComment codeunit before i even made any changes. I just moved my codeUnit to OnCloseForm trigger so the codeunit runs after i made the changes and closed the form.0
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