XRec Values = rec Values in Modify Trigger

jens_DEBER
Member Posts: 3
Hi,
it seem i have found a bug with the XRec. Please confirm me or correct me.
I tested in NAV2013 (7.0.36347) and NAV2013R2 (7.10.35473)
Best Regards Jens
it seem i have found a bug with the XRec. Please confirm me or correct me.

Vendor.INSERT(TRUE); Vendor.Name := 'Name 1'; Vendor.MODIFY(TRUE);After this piece of Code in the Vendor - OnModify - Trigger xRec.Name is equal to Rec.Name. Is that correct or do I something wrong? Should it be so?
I tested in NAV2013 (7.0.36347) and NAV2013R2 (7.10.35473)
Best Regards Jens
0
Comments
-
If you need to trust xRec, you need to get it your self.
Just insert a xRec.FIND('=') in the beginning of the OnModify trigger.Regards
Peter0 -
Hi Jens
This is expected beheavior. See online help:
http://msdn.microsoft.com/en-us/library ... 9(v=nav.70).aspx
pdj's solution is one way to solve the issue, but it could lead to unexpected beheavior depending on the following code and from where the trigger is called from other objects.
Further links:
http://dynamicsuser.net/forums/p/12614/61225.aspx
viewtopic.php?t=27859&f=23
viewtopic.php?f=23&t=41483&start=0
http://dynamicsuser.net/blogs/vanvugt/a ... ports.aspx
Best,
B.0 -
I read somewhere that it is the behavior when the validation doesn't come from the form that bounds to the table. One workaround would be creating a custom OnModify(xrec) function and do your xrec vs rec validations in there.
So in
1. So your table's onModify trigger would call the custom OnModify(xrec) function when it needs comparison implicitly
2. And when xrec happens to be same as rec when it actually should not, you can call the Table.OnModify(xrec) function externally in your code by using a temp rec.0 -
i've just met the issue and understood, that there are two events: OnBeforeModifyEvent, OnAfterModifyEvent (My problem appeared in subscriptions). So on OnAfterModifyEvent the situation is just like you described - the xRec is fully same with Rec. But on OnBeforeModifyEvent - everything is just on place. You would see xRec.Name as `''` and Rec.Name as `Name 1`
If you really want to check the changes use the subscriptions and OnBeforeModifyEvent. Tested on NAV20180 -
I have checked all the scenarios - from code and from page in NAV18 works fine...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