Created
April 21, 2023 21:29
-
-
Save yuriycto/0772a453a6e70278bca6a9b1f3b017d9 to your computer and use it in GitHub Desktop.
Delete attachment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fileGraph = PXGraph.CreateInstance<UploadFileMaintenance>(); | |
var savedFilesIDs = PXNoteAttribute.GetFileNotes(this.Document.Cache, this.Document.Current); | |
foreach (var savedFileID in savedFilesIDs) | |
{ | |
var savedFileInfo = fileUploadGraph.GetFile(fileID); | |
if (savedFileInfo != null | |
&& VerifyFileName(savedFileInfo.Name)) | |
{ | |
fileGraph.Files.AllowDelete = true; | |
fileGraph.Files.Delete(fileUploadGraph.Files.Current); | |
fileGraph.Persist(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment