Trigger row change in matrix form (subform)

asok
Member Posts: 3
I need to do checking on sales line data inputted by the user and this should happen when user changes row on sales order subform and if qty > 0
By using on trigger OnAfterGetRecord I can see row change when changing already inserted rows and OnNewRecord when changing to newline. Problem is that OnAfterGetRecord loops through all records when opening a form or changing from subform to main form.
Now I am thinking of inserting boolean field on sales line table, that indicates if checking is made or not on the line. Is there any other way to do this?
By using on trigger OnAfterGetRecord I can see row change when changing already inserted rows and OnNewRecord when changing to newline. Problem is that OnAfterGetRecord loops through all records when opening a form or changing from subform to main form.
Now I am thinking of inserting boolean field on sales line table, that indicates if checking is made or not on the line. Is there any other way to do this?
0
Comments
-
You could use the OnAfterGetCurrRecord trigger. Also you could use the onValidate trigger on the table and compare Rec.Qty and xRec.Qty to check the previous value of the field on the record. There are many ways to do something depending an the exact result you are seeking. Could you provide some more details about what you want to check and when exactly? Maybe such a check could also be moved to the posting routine if you just want to prevent something specific to be blocked from posting. Where it is possible though, try keeping the code on the record (using insert,modify and validate triggers) and not on the form. It really helps...0
-
Hi kapamarou,
Thanks for your answer, requirements are these:
Sales person inserts line than can be Bills of materials and sometimes they want to explode BOM and sometimes not, but we don't want them to forget to do this selection. We could explode the BOM after quantity is filled but they might do adjustments on price. We have made modification that takes main item price to BOM items in propotion.
So we want to check is quantity changed or >0 if item is BOM when line changes and give dialog box to ask does user want to explode BOM.
OnAfterGetCurrRecord works better for this purpose and problem that I now have, is case where user clicks directly to form header, then I can use OnDeactivateForm but this gives same xRec.Quantity as Rec.Quantity from the line where clicked to form header.0 -
One fast thought is to use the OnActivate of the field, not the form, and then the onDeactivate of the field. Keep the first value in a temporary variable and compare it to the new value. It could work but it poses some other issues. For example: The value of the field is changed due to validation of another field...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