In my current upgrade process I needed to copy the Record Link table from one database to another. I can use a copy-paste method for small number of records but in this case I needed something else.
A Dataport or a XML Port was the way I choose to go. There is one problem though. the Record Link table has a field for the Record ID and this field is not a field type that can be used in dataports or xml ports.
I created two new global variables, one text variable for the record position and one integer variable for the table number. And to help me with the conversion I needed to have two more global variables; RecID and RecRef.
Now for the code. To convert my Record ID field to a record position and a table number
and to convert from the table number and position to a Record ID
I use something like follows on different table:
Record Link – OnBeforeExportRecord()
StrRecordID := FORMAT(“Record ID”);
Record Link – OnAfterImportRecord()
EVALUATE(“Record ID”,StrRecordID);
I have been trying to use this for upgrading from NAV 2015 to NAV 2018. The client did not want to upgrade the obsolete customers and items. Will this process not import all record links nd leave some ghost links?
It looks like the RecRef.FIND in the import will fail if the related record is missing.
Another problem I have run into it XMLPorts do not work with BLOB type fields. In the case of record Links that would be the Note field. Do you have any suggestions on dealing with that?
Thank you.
BLOB values must be converted to Base64 text and added as such to the Xml.
And then back from Base64 during import.
In later C/AL version of NAV and BC you will find these functions in the TempBlob table.