Options

Update Record

omyvadiyaomyvadiya Member Posts: 124
edited 2013-12-02 in NAV Three Tier
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.

](*,)

Comments

  • Options
    geordiegeordie Member Posts: 655
    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.
Sign In or Register to comment.