Question

Extending the functionality of File Attachment Query

  • 24 February 2022
  • 2 replies
  • 59 views

Userlevel 1
Badge +7

Hi Team,

 

We have a requirement to save attachments in FSM based on File Type in respective folders. For example, Solution document type to saved into the folder Solution created inside the default File Attachment directory. We were advised that we can try extending the method SaveAttachmentAsFile in AttachmentPolicy file. I tried creating a custom Attachment Policy and inherited it from AttachmentPolicy class. But I am not getting an option to override the method SaveAttachmentAsFile.

 

Below code is giving error, no suitable method found to override. Please advise hoe I can extend the functionality to create paths dynamically for attachments.

public class TestAttachmentPolicy : AttachmentPolicy
    {
        public TestAttachmentPolicy() : base() 
        {
            AttachmentPolicy policy = new AttachmentPolicy();
            AttachmentManager mgr;
            base.TableName = attachmentRow.TABLE_NAME;
        }

        private override void SaveAttachmentAsFile()
        {

        }
    }

 

Regards,

AJAY


This topic has been closed for comments

2 replies

Userlevel 7
Badge +22

Hi @ajayifs ,

SaveAttachmentAsFile is a private method in the baseline. Therefore, you won’t be able to override the method in this way as it’s not visible. Instead, perhaps you could implement a separate method and call that before the base.BeforeRowUpdate. What is the sole purpose of completely overriding the base method? 

Userlevel 1
Badge +7

Hi Saranga,

 

Thank you very much for replying on this. 

 

We understand that when we save attachment in FSM it gets created into the physical location configured in APP PARAM ATTACHMENT_DIRECTORY. As per the requirement we want to save attachments being uploaded into a new folder inside ATTACHMENT_DIRECTORY. For example, if document type is SOLUTION then attachment should get saved inside the path ATTACHMENT_DIRECTORY/SOLUTION. Please advise how we can achieve this.

 

If we try overriding base.BeforeRowUpdate, please advise how we can retrieve ATTACHMENT_DIRECTORY path and attachment to be saved inside?

 

Kind regards,

AJAY