Page 1 of 1

attach a document to sales order with file watcher

PostPosted: Tue Aug 24, 2021 7:11 pm
by indikad
below is a code sample that works on Jiwa 7.2.1 ( on the UI on save ending ) - this attaches a pdf file to the current sales order

Can someone share the bit of code that can replace the line below for Jiwa 7.0.175 ( older version ) pls and that too on the SalesOrder file watcher plugin ( csv import ). This line wont compile with error
"manager is not a member of JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrder"
Code: Select all
Dim sdoc As JiwaFinancials.Jiwa.JiwaApplication.Documents.Document =  oSalesOrder.Manager.CollectionItemFactory.CreateCollectionItem(Of JiwaFinancials.Jiwa.JiwaApplication.Documents.Document)()


Code: Select all
Private Sub SalesOrderSaveEnding( sender As Object ,  e As System.EventArgs )
Dim oSalesOrder As JiwaSales.SalesOrder.SalesOrder   = DirectCast( sender , JiwaSales.SalesOrder.SalesOrder )
      Dim sdoc As JiwaFinancials.Jiwa.JiwaApplication.Documents.Document =  oSalesOrder.Manager.CollectionItemFactory.CreateCollectionItem(Of JiwaFinancials.Jiwa.JiwaApplication.Documents.Document)()
      sdoc.FileBinary = System.IO.File.ReadAllBytes("C:\temp\test.pdf")
       sdoc.Description = "test.pdf"
           sdoc.DocumentType = oSalesOrder.Documents.DocumentTypes.GetDefaultDocumentType()
           sdoc.PhysicalFileName = "C:\temp\test.pdf"
         oSalesOrder.Documents.Add(sdoc)
      'oSalesOrder.Save()' // optional depending
End Sub

Re: attach a document to sales order with file watcher  Topic is solved

PostPosted: Wed Aug 25, 2021 2:50 pm
by SBarnes
In having a look at a plugin I had from back then and looking inside the old Jiwa Application DLL at the actual document object I am pretty sure a collection Item didn't have manager so there was no factory you can just new one up and all should be good as when it needs the manager it uses the old instance one.