Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

NAV RecordID in Record Links Table

(0) ShareShare
ReportReport
Posted on by

Hello

I am writing to the NAV Record Link table via a SQL Query and I can get this to work on NAV2009 but not in NAV2015.

The problem I have is with the RecordID field. The encoding seems to have changed between the two NAV versions.

I am entering a link for the Purchase Header Table for the Document Type of Order.

The Query I am using below worked for 2009, but not for 2015.

Select @RECORDID = 0x26000000008B01000000027BFF+CONVERT(VARBINARY(448),@CHVPONUMBER)

Up until the characters BFF that is not a problem as this is the table number and the keys, this part of the binary value can be hardcoded in the query as it will not change.

The problem is the Convert of the PO number to Varbinary.

In NAV2009, the PO Number would translate to this using the Query Below, and this works

0x26000000008B01000000027BFF505246303030303033

However for NAV2015, if I manually create the Record Link in NAV, the same PO Number is converted  to

0x26000000008B01000000027BFF50005200460030003000300030003000330000000000

How can I convert this in SQL please? There are additional bytes in between and at the end and I don't know what they mean!


Thank you

Ruth

*This post is locked for comments

  • jipsen Profile Picture
    12 on at
    RE: NAV RecordID in Record Links Table

    As I mentioned:

    Select 0x26000000008B01000000027BFF + convert(varbinary(16), N'PRF000003') +0x00000000  

    results in

    0x26000000008B01000000027BFF50005200460030003000300030003000330000000000

    the the Record Link in NAV Ruth got when she created the record manually.

    the query needs to be changed to:

    Select @RECORDID = 0x26000000008B01000000027BFF+convert(varbinary(16), @CHVPONUMBER) +0x00000000

    Note that you need N'(unicode string constant) only when applied to literals.

    If the variable @CHVPONUMBER is nvarchar it is already Unicode data.

  • jipsen Profile Picture
    12 on at
    RE: NAV RecordID in Record Links Table

    First Thanks, I had a similar problem creating Record links, and this post gave me some ideas.

    I believe your ,@CHVPONUMBER = 'PRF000003'

    What will work is resulting in exactly the above record link you got when entered manually is :

    Select 0x26000000008B01000000027BFF + convert(varbinary(16), N'PRF000003') +0x00000000

  • Suggested answer
    Suresh Kulla Profile Picture
    47,773 on at
    RE: NAV RecordID in Record Links Table

    Try this CONVERT(VARBINARY(448),@CHVPONUMBER,2).

    Use the third parameter as 2.

  • Suggested answer
    keoma Profile Picture
    32,727 on at
    RE: NAV RecordID in Record Links Table

    it seems the used base datatype in the part right of BFF is changed in nav2015. means they use 2 bytes instead of one byte, the original byte is followed by a zero double-byte: 50 goes to 5000, 52 goes to 5200, 46 goes to 4600. split the substring right of BFF into substrings containing 2 digits (50,52,...). then add a double 0, join the new substrings to a new right part. at the end add 4 double-zero digits. done.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics NAV (Archived)

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans