Thursday 23 April 2015

COPYLINKS + The requested record cannot be located.

Error Message:
---------------------------
Microsoft Dynamics NAV Development Environment
---------------------------
The requested record cannot be located.
---------------------------
OK  
---------------------------

Scenario  :

Create Sales Order with Notes(Notify should be Yes), now the user have notification when clicking on the notes the Order Page will open
 
Post the Order completely , user will receive two notifications one for the shipment and other for the Invoice, if we click on notes now we will receive the error because the links have been copied from Order to shipment & Invoice but the url in the Record Links points to Order which was deleted



Solution:
We need to update the URL and descriptions of these Notifications in the Sales Post Code unit using below and call this function after Copy links.(the below function is only for Sales Invoice)

CustomCopLinks(TableId : Integer)

OldRecRef.OPEN(TableId);
OldRecRef.GETTABLE(SalesInvHeader);
OldRecLink.SETRANGE("Record ID",OldRecRef.RECORDID);
IF OldRecLink.FINDFIRST THEN BEGIN
  OldRecLink.URL1 := GETURL(CLIENTTYPE::Windows,COMPANYNAME,OBJECTTYPE::Page,132,SalesInvHeader);
  OldRecLink.Description := 'Posted Sales Invoice' + ' - ' + SalesInvHeader."No." + ' . ' + SalesInvHeader."Sell-to Customer Name";
END;
OldRecLink.MODIFY;
OldRecRef.CLOSE;
 

Best Regards

Rajasekhar.Y