ERROR MAKING "MODIFY" AFTER "TRANSFERFIELDS&q

foronavision
Member Posts: 79
Hello.
I'm using a form to copy records of a table. I use the instruction "TRANSFERFIELDS" to copy all the fields of one record to a new one and after this I modify two fields of this new record with new values. After this I use the instruction MODIFY but the next error message appears:
"Another user has modified the record for this my_table_name after you retrieved it from then database".
What do I have to do to copy all the fields? There are so many and I can't do this one by one.
Thank you very much!!
I'm using a form to copy records of a table. I use the instruction "TRANSFERFIELDS" to copy all the fields of one record to a new one and after this I modify two fields of this new record with new values. After this I use the instruction MODIFY but the next error message appears:
"Another user has modified the record for this my_table_name after you retrieved it from then database".
What do I have to do to copy all the fields? There are so many and I can't do this one by one.
Thank you very much!!
0
Comments
-
you get this error if the record variable you are working with isn't the latest copy of the record in the database.
Are you performing these steps in different functions using different variables?
In any case, you need to go "get", then do your changes, then a modify.0 -
If you just make the changes in your first variable, you don't have to worry about all that, you can just use MODIFY.0
-
Try this.
Works for me everytime.RecordNew.INIT; RecordNew := TRANSFERFIELDS(RecordOld); RecordNew.Field1 := NewValueField1; RecordNew.Field2 := NewValueField2; . . RecordNew.INSERT;
0 -
The destination record exits before I use transferfields but only with the two key fields completed so I can't use INSERT.
May be posible to delete the existing record previously saving the existing fields values and after this use transferfields and insert?0 -
Try this:
"New Record".TRANSFERFIELDS("Old Record",FALSE); // FALSE doesn't copy the primary key fields "New Record".MODIFY(TRUE);
Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
THAT'S THE SOLUTION!! THANK YOU VERY MUCH!!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