web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Record Link to Service Header

(0) ShareShare
ReportReport
Posted on by 911

We have a requirement to programmatically add links to photographs, saved on cloud storage, to a Business Central Service Order using an oData Connected Service. As a test, we manually added a link to a file using the 'Links' option on the 'Show Attached' menu of the Service Order. This worked fine. I can see the row has been added to the 'Record Link' table. However, it doesn't appear to contain any values that link it to the Service Header table? There are Link ID & Record ID columns, neither of which contain a Service Order Number? So, my questions are:-

1. How does the Record Link table link to the Service Header table?
2. Is there a better way of achieving this?

I have the same question (0)
  • Suggested answer
    Asif Shahzad Profile Picture
    410 on at

    You need to customize Record Link and add a new field named "service order no". This way it ll link up both tables.

  • Nick Webb Profile Picture
    911 on at

    Thanks for your response. I could extend the Record Link table as you suggest, but they are already linked. The question is HOW? If I go into Show Links for the particular Service Order it shows the correct link. How is this achieved when there doesn't appear to be a key field joining them?

  • Nick Webb Profile Picture
    911 on at

    Is it possible the 'Document Attachment' table could be used? I tried the code below:-

    string lstrFileName = @"C:\Users\user.name\Documents\PDF\BCTest\Test Attachment 3.pdf";

    System.IO.FileInfo lfi = new System.IO.FileInfo(lstrFileName);

    NAV.API_Document_Attachment lobjDA = NAV.API_Document_Attachment.CreateAPI_Document_Attachment(5900, "SO000006", "Order", 0, 1);

    lobjDA.AttachedDate = DateTime.Now;

    lobjDA.FileName = lfi.Name;

    lobjDA.FileExtension = lfi.Extension.Replace(".", string.Empty);

    lobjDA.FileType = "2";

    objContext.AddToAPI_Document_Attachment(lobjDA);

    objContext.SaveChanges();

    … but when it gets to SaveChanges, I get: "{\"error\":{\"code\":\"Application_DialogException\",\"message\":\"Please attach a document first.\"}}"

    How do I programmatically attach a document?

  • Suggested answer
    Marco Mels Profile Picture
    Microsoft Employee on at

    Hello,

    We currently do not have dedicated Dev support via the Dynamics 365 Business Central forums, but I wanted to provide you some additional resources to assist.  If you need assistance with debugging or coding I would recommend discussing this on one of our communities.

    www.yammer.com/dynamicsnavdev

    dynamicsuser.net/.../developers

    I will open this up to the community in case they have something to add.

    Thanks.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 595 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 364 Super User 2026 Season 2

#3
Grigorios Mavrogeorgis Profile Picture

Grigorios Mavrogeorgis 331 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans