Показать сообщение отдельно
Старый 23.01.2019, 11:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
ax.docentric: Comment on Append Terms and Conditions to printed Purchase orders or Invoices in D365FO by Ana
Источник: https://ax.docentric.com/append-term...o/#comment-644
==============

Hi Bablu,You did everything OK but the thing is that we did this example on the existing DSP class for Purchase order (DocPurchPurchaseOrderReportDSP), which can be found in our additional model: Docentric AX SSRS Replicas.We actually strongly recommend to install this model no matter if you are using Free or Full Edition because it will bring you numerous benefits such as report specific placeholders and support for improved Print archive:https://ax.docentric.com/d365-how-to...-free-edition/ How to make it work with your custom classThe method which was modified in the blog article is the private method which is not overridden nor called from your custom class, so it gets never executed.I suggest to move this code snippet in your overridden generateXmlDataSource() method, after calling the super().It should look like the following:protected void generateXmlDataSource(DocXmlRecordBuilder _recordBuilder){ super(_recordBuilder); _recordBuilder.goToParentRecord(); DocXmlRecord topDataRecord = _recordBuilder.currentRecord(); DocXmlRecord subDocumentsDataRecord = topDataRecord.addChildCalculatedRecord('Subdocuments'); purchTable = PurchTable::find(purchId); // Use PurchId stored in the onSelectedRdpTableRecord() method. DocuRef docuRef; while select docuRef where docuRef.RefTableId == purchTable.TableId & docuRef.RefRecId == purchTable.RecId & docuRef.TypeId == 'File' { using (System.IO.Stream docuRefStream = DocumentManagement::getAttachmentStream(docuRef)) { using (System.IO.MemoryStream subdocMs = new System.IO.MemoryStream()) { docuRefStream.Position = 0; docuRefStream.CopyTo(subdocMs); subDocumentsDataRecord.addCalculatedField(docuRef.Name, DocGlobalHelper::convertMemoryStreamToContainer(subdocMs)); } } }protected void onSelectedRdpTableRecord(Common _rdpTableRecord, TableName _rdpTableName){ PurchPurchaseOrderHeader purchPurchaseOrderHeader; super(_rdpTableRecord, _rdpTableName); // Store PurchId into a class global variable to use it in this.generateXmlDataSource() // method in order to add additional data related to the printing purchase order. if (tableStr(PurchPurchaseOrderHeader) == _rdpTableName) { purchPurchaseOrderHeader = _rdpTableRecord; purchId = purchPurchaseOrderHeader.PurchId; }}Please let me know if this worked out for your scenario.And yes, this code will work only if you attach Terms and conditions on each purchase order, which is not OK.Probably is better to attach this document, e.g. on particular legal entity and then fetch it from there.Kind regards,Ana

Источник: https://ax.docentric.com/append-term...o/#comment-644
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.