Hi we have an onprem BC20 customer.
We need to use the pdfDocuments API. When looking at the available API web Services on Table = 2000000193 we cannot see the PDFdocument page.
Ons BC18 and BC20 on prem we can see the pdfdocument page (ID 30056) is exposed.
But on our BC20 onprem version there is no pdfDocument page.
How can we add/install the pdf document?
Also I noticed there is only beta version API on the cliens webservice. How van I add the API v2.0?
Thanks
Thank you ZHU,
Although I didn't use your answer. It did lead me to the correct way.
For some Reason. APIV2 extension wasn't installed.
Here is the weird part. The extensions for API are not shown in extension management.
We got the Microsoft__Exclude_APIV2_.app file from the onPrem download file.
..\Dynamics.365.BC.38230.W1.DVD\Applications\APIV2\Source
After Publishing and installing V2.0 was available on the web service Table = 2000000193
Hi, You can use the following method to find the code of this API, then copy it to your Extension, change the ID, and publish. (Might need to do some code upgrades)
page 30056 "APIV2 - PDF Document" { APIVersion = 'v2.0'; EntityCaption = 'PDF Document'; EntitySetCaption = 'PDF Document'; DeleteAllowed = false; Editable = false; InsertAllowed = false; ModifyAllowed = false; DelayedInsert = true; EntityName = 'pdfDocument'; EntitySetName = 'pdfDocument'; ODataKeyFields = Id; PageType = API; SourceTable = "Attachment Entity Buffer"; SourceTableTemporary = true; layout { area(content) { repeater(Group) { field(id; Id) { Caption = 'Id'; Editable = false; } field(parentId; "Document Id") { Caption = 'Parent Id'; Editable = false; } field(parentType; "Document Type") { Caption = 'Parent Type'; Editable = false; } field(pdfDocumentContent; Content) { Caption = 'PDF Document Content'; Editable = false; } } } } actions { } trigger OnFindRecord(Which: Text): Boolean var PDFDocumentManagement: Codeunit "PDF Document Management"; DocumentType: Enum "Attachment Entity Buffer Document Type"; DocumentId: Guid; FilterView: Text; DocumentIdFilter: Text; DocumentTypeFilter: Text; IdFilter: Text; begin if not PdfGenerated then begin FilterView := GetView(); DocumentIdFilter := GetFilter("Document Id"); DocumentTypeFilter := GetFilter("Document Type"); IdFilter := GetFilter(Id); if (DocumentIdFilter <> '') and (IdFilter <> '') and (LowerCase(DocumentIdFilter) <> LowerCase(IdFilter)) then Error(ConflictingIdsErr, DocumentIdFilter, IdFilter); if (DocumentTypeFilter = '') then Error(MissingParentTypeErr); if (DocumentIdFilter = '') then if (IdFilter = '') then Error(MissingParentIdErr) else DocumentIdFilter := IdFilter else IdFilter := DocumentIdFilter; DocumentId := Format(DocumentIdFilter); Evaluate(DocumentType, DocumentTypeFilter); SetView(FilterView); if IsNullGuid(DocumentId) then exit(false); PdfGenerated := PDFDocumentManagement.GeneratePdfBlobWithDocumentType(DocumentId, DocumentType, Rec); end; exit(true); end; var PdfGenerated: Boolean; ConflictingIdsErr: Label 'You have specified conflicting identifiers: %1 and %2.', Comment = '%1 - a GUID, %2 - a GUID'; MissingParentIdErr: Label 'You must specify a parentId in the request body.', Comment = 'parentId is a field name and should not be translated.'; MissingParentTypeErr: Label 'You must specify a parentType in the request body.', Comment = 'parentType is a field name and should not be translated.'; }
Hope this helps.
Thanks.
ZHU
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156