I am trying to email a file created in a process screen. The file must first be attached to a record before I can send it. I am trying to attach it to a setup screen in the module we added for this process and the code runs just fine, there is no error but the attachment is never put on the email. Also when I look at the records for UploadFile and UploadFileRevision the Primary screen is null. Also adding the file did not make the file option on the menu show.
This is the code to upload the file (runs without error but nothing happens, email created and no attachement):
byte[] filebytes = Encoding.ASCII.GetBytes(fileContent.ToString()); ;
FileInfo myFileInfo = new FileInfo(Guid.NewGuid(), operation.Trim() + ".txt", null, filebytes);
UploadFileMaintenance fileUploadGraph = PXGraph.CreateInstance<UploadFileMaintenance>();
fileUploadGraph.SaveFile(myFileInfo, FileExistsAction.CreateVersion);
PXNoteAttribute.AttachFile(this.Caches[typeof(JMSetup)], Setup.Current, myFileInfo);
//PXNoteAttribute.AttachFile(base.Caches[typeof(JMSetup)], Setup.Current, myFileInfo);
fileUploadGraph.Persist();
return myFileInfo.UID;
My question is can a setup screen have a file added to its record? Also how to get the File Menu on the setup screen? Does it need to have a note? I noticed most setup screens don’t have note ids and they also don’t have a file menu.
Best answer by edwardmcgovern53
View original