Friday, 1 July 2016

Hidden file revisions clearing action in Acumatica

Hi All,

Today I want to show you one one trick that can help you to purge revisions history of all files in Acumatica and keep database lighter.
Acumatica has a hidden button, that can go through all files in the system and check revisions. If date of revision is older that specified one, Acumatica will delete all revisions except the latest one.

By default this function is hidden for security reasons, so if you want to enable it be really careful and restrict assess rights from all uses except system administrator.

Ok, to enable this hidden function, you should use Acumatica customization tools for screen "Search In Files" (SM202520).
Our main goal is to change visibility of hidden button:
To change the PXUIFieldAttribute property we shall do:

  • Create an customization project
  • Add graph extension for graph "PX.SM.UploadFileInq"
  • Add new action with the same name as base one - in this case Acumatica platform will call ours action instead of base one.
  • Add button handler to call base logic.
  • Publish customization.
Code snippet:
  public class UploadFileInq_Extension:PXGraphExtension<UploadFileInq>
  {
    public PXAction<FilesFilterClearFiles;
    #region Event Handlers
    [PXButton(Tooltip ActionsMessages.ttipClearFiles)]
    [PXUIField(DisplayName ActionsMessages.ClearFilesVisible true)]
    internal IEnumerable clearFiles(PXAdapter adapter)
    {
      Base.ClearFiles.PressButton();
      return adapter.Get();
    }
    #endregion
  }

After customization publishing process you will find new button on the search in files screen.

By clicking on this action you will be able to provide date, by what all revisions should be cleared.
Depend on the database size, process may take significant amount of time

Have a nice clearing!

No comments: