Update Record

omyvadiya
Member Posts: 124
Hi,
I have a Sales Order which has option on printing as:
1. Print
2. Email (Pdf)- It attaches an email and sends.
3. Pdf (It creates a pdf and saves to certain location)
The requirement is whenever after selecting any one of the options, a report runs -> on clicking on the print (on request form of report).
The status of the respective record must changes from Created to Sent.
I tried writing code on OnPostRecord Report as:
recSHNew := SH;
MESSAGE('TRIP-NEW %1',FORMAT(recSHNew."No."));
IF NOT CurrReport.PREVIEW THEN
recSHNew.SETRANGE("No.",recSHNew."No.");
recSHNew.Status := recSHNew.Status::"Sent to Carrier";
recSHNew.MODIFY;
WHERE
SH = Sales header record variable
recSHnew = New Sales header record variable
I tried assigning SH to new recSHNew record variable and then changing the status only for the that specific Sales order.
But it gives error:
Microsoft Dynamics NAV
Another user has modified the record for this Rit after you retrieved it from the database.
Enter your changes again in the updated window, or start the interrupted activity again.
Identification fields and values:
Nr.='13012954'
OK
I closed the complete navision client and reopened it, still the same error persists.
](*,)
I have a Sales Order which has option on printing as:
1. Print
2. Email (Pdf)- It attaches an email and sends.
3. Pdf (It creates a pdf and saves to certain location)
The requirement is whenever after selecting any one of the options, a report runs -> on clicking on the print (on request form of report).
The status of the respective record must changes from Created to Sent.
I tried writing code on OnPostRecord Report as:
recSHNew := SH;
MESSAGE('TRIP-NEW %1',FORMAT(recSHNew."No."));
IF NOT CurrReport.PREVIEW THEN
recSHNew.SETRANGE("No.",recSHNew."No.");
recSHNew.Status := recSHNew.Status::"Sent to Carrier";
recSHNew.MODIFY;
WHERE
SH = Sales header record variable
recSHnew = New Sales header record variable
I tried assigning SH to new recSHNew record variable and then changing the status only for the that specific Sales order.
But it gives error:
Microsoft Dynamics NAV
Another user has modified the record for this Rit after you retrieved it from the database.
Enter your changes again in the updated window, or start the interrupted activity again.
Identification fields and values:
Nr.='13012954'
OK
I closed the complete navision client and reopened it, still the same error persists.
](*,)
0
Comments
-
If your report is similar to standard (205 - Order Confirmation), you can perform order update in OnAfterGetRecord of Sales Header dataitem, without needing of any record variable assignment since the right record is already retrieved.* Daniele Rebussi * | * Rebu NAV Diary *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