Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

Can Notes from Sales Orders be referenced using SQL?

(1) ShareShare
ReportReport
Posted on by 7

I have an SSRS report for NAV 2016; I'd like to add any Notes content to records that have them. Is there a way to find the record ID of the sales orders & link to the note (Record Links) using only SQL, without adding an assembly or a table column to the existing DB?

  • John.B@AMETEK Profile Picture
    John.B@AMETEK 7 on at
    RE: Can Notes from Sales Orders be referenced using SQL?

    Hi Zhu. Thank you for taking the time answer - I appreciate it. I think I can perform a workaround: the Record Link "Description" field can be filtered on "Sales Order - " - I can then pull out the sales orders from that. The RecordID field precedes note-specific entries with '24000000' (if I convert the RecordID to Varchar first). I can convert & decompress the Note field ~mostly~ cleanly using this:

      CONVERT(

          varchar(max)

          , DECOMPRESS(

              CONVERT(varbinary(max), 0x1F8B0800000000000400)

              +

              CONVERT(varbinary(max), SUBSTRING([Note],5,8000))

            )

        )

    That gives me what I need for this user; if I need to pull more information from the Sales Order, I can use the Sales Order # pulled from the Description field.

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 75,595 Super User 2024 Season 2 on at
    RE: Can Notes from Sales Orders be referenced using SQL?

    Hi, unfortunately, this cannot be done as far as I know. They are related by Record ID, but this value cannot be read directly from SQL.

    https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods/devenv-recordid-method-record

    pastedimage1684797617808v2.png

    pastedimage1684797781047v3.png

    Hopefully other experts can give you better advice.

    Thanks

    ZHU

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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,642 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,371 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans