This works fine when firing off the email from the process end but what I would now like to be able to do is add the csv file to the documents collection on the sales order but the following code produces an error, is there any way to make this happen as it appears you can't do it through the UI either?
- Code: Select all
JiwaFinancials.Jiwa.JiwaApplication.Documents.Document sdoc = salesorder.Manager.CollectionItemFactory.CreateCollectionItem<JiwaFinancials.Jiwa.JiwaApplication.Documents.Document>();
sdoc.FileBinary = System.IO.File.ReadAllBytes(FileName);
sdoc.Description = "Invoice csv";
sdoc.DocumentType = salesorder.Documents.DocumentTypes.GetDefaultDocumentType();
sdoc.PhysicalFileName = FileName;
salesorder.Documents.Add(sdoc);
salesorder.Save();

