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

Notifications

Announcements

No record found.

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 891

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
    891 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
    891 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
    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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,135

#2
YUN ZHU Profile Picture

YUN ZHU 733 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 612

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans