Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

Store F&O Attachments in external document management system

(1) ShareShare
ReportReport
Posted on by 73
Hi
 
I'm looking into if it would be possible to store attachments elsewhere than Azure or SharePoint. I would like that when a user clicks the paperclip and uploads an attachment from anywhere, we detect that this is happening and save the file to an external document management system. Ideally I would also like to catch any automatic creation of an attachment. I've tried searching, but I can't seem to find anyone that has a similar requirement.
 
I've been thinking about a few possible approaches:
  • I understand that the attachments are managed through the DocuRef and DocuValue tables. Hooking into events here will at least give us the file details and will work even if the attachment was made by a user or otherwise, but it won't prevent the file upload to Azure. Edit: Forgot to mention that this option will not get me to the file itself without letting it upload and download it again.
  • Customizing the DocumentUpload form, either by replacing the upload with another File Upload Control, or somehow manipulate what's happening here. But this won't help with attachments created by other systems.
  • An automatic job that goes through all the attachments and moves them periodically
Either of these could be bad practice for all I know.
 
Are there anyone who has experience with this and can please point me in the right direction?
 
Thanks!
  • hca Profile Picture
    hca 73 on at
    Store F&O Attachments in external document management system
    Hi
     
    I'm bumping this thread. I've not been able to use the storage provider framework. We've put in an extensibility request a while back, but there is no activity.
     
    Instead, I would like to look into using business events for this purpose. Is there anyone who can give me some pointers if I want to get a business event when any attachment is added? Would it be appropriate to hook into the DocuRef table? I'm not going to export the attachment via business event, I just need to know that it was created.
     
    I would also like tips for how I can insert attachments into Finance from the outside world, as well as deleting attachments in Finance.
     
    Thanks!
  • hca Profile Picture
    hca 73 on at
    Store F&O Attachments in external document management system
    I understand now that I can probably use CoC in relation to the "Docu" class to return my storage provider. However, there is functionality that deals with the Id of a storage provider, which is the type "DocuStorageProviderType", as mentioned. It has the options
    • None
    • Azure
    • SharePoint
    • OneDriveForBusiness
    • StorageFramework
    This type has the property "Is Extensible" as false. I don't understand why this type exists, it seems redundant when you have "DocuFilePlace" enum.
     
    "None" and "OneDriveForBusiness" does not seem to have any logic attached to it. The logic supports that "StorageFramework" can be used, but I can't find any information about how to use it. I think it would be wrong of me to just assume that I should select this type, and there is a function "Microsoft.Dynamics.AX.Framework.FileManagement.StorageFrameworkDocumentStorageProvider::HasValidFrameworkProvider()" which seems to throw a null reference exception. I can't see what the function does.
     
    So now I'm wondering if it would be valid to submit an extensibility request for "DocuStorageProviderType"? If not, I guess I will end up with "None"/"0" as the storage provider id, which seems not ideal.
     
     
  • hca Profile Picture
    hca 73 on at
    Store F&O Attachments in external document management system
    Hello again
     
    I've finally had time to look into this again. It's possible to implement the IDocumentStorageProvider interface in my own C# class. The next step I thought was to extend the "DocuFilePlace" enum with my own storage provider. That would make it possible to select it in the settings (I believe). Then next I would have to extend "DocuStorageProviderType" enum, but it turns out not to allow extending. Then I'm getting a little stuck, because this is what seems to be used together with the actual files in "DocuValue" table. There is a class "Docu" that deals with storage providers, and those methods are static for the most part so I suppose I can't extend them either.
     
    I see there is something called "Storage Framework". I basically have no other option than to select this as my type. If the system is indeed supporting the suggested way of adding a storage provider, is it this one I should use? In that case, how can I inject my custom one there?
     
    Thanks!
     
  • hca Profile Picture
    hca 73 on at
    Store F&O Attachments in external document management system
    Ok, nice, I will have to look into that.
     
    If it's made for people to extend like that, it would have been nice to have a description of the interface. It's not easy to know what is possible when it's not described anywhere.
     
    Thanks for the tip!
     
  • Martin Dráb Profile Picture
    Martin Dráb 230,445 Most Valuable Professional on at
    Store F&O Attachments in external document management system
    The framework of storage providers is designed to support this scenario, therefore I assume that everything will work as it should. Nevertheless I've never created one, therefore I've never tested it.
     
    When asking for documentation, what information are you looking for?
  • hca Profile Picture
    hca 73 on at
    Store F&O Attachments in external document management system
    Yes, the custom document storage provider sounds like the correct approach. If I do it this way, will it then appear fully integrated, showing up in System Administration, showing the attachment count etc.? Or will that require extending further?
     
    I want to use .NET library whenever possible. Is there some documentation available for this approach?
     
    Thank you.
     
     
     
     
  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 230,445 Most Valuable Professional on at
    Store F&O Attachments in external document management system
    The right approach, in my opinion, is implementing a custom document storage provider.
     
    It means creating a class implementing Microsoft.Dynamics.AX.Framework.FileManagement.IDocumentStorageProvider and adding logic for reading and writing files there. It can either by a .NET class (as Microsoft.Dynamics.AX.Framework.FileManagement.AzureDocumentStorageProvider and Microsoft.Dynamics.AX.Framework.FileManagement.SharePointDocumentStorageProvider are) or an X++ class (as DocuDatabaseStorageProvider). I guess a .NET class will be a better option - your document management may already have a .NET API and if not, you'll likely communicate through web services, which is easier to do in .NET than in X++.
     
    Then you'll need to extend Docu::GetStorageProvider() to use your new storage provide (based on some setup).
     
     
  • Kevin Xia Profile Picture
    Kevin Xia Microsoft Employee on at
    Store F&O Attachments in external document management system
    Hi,
    Maybe your third option can be considered. Create an automated job that runs regularly to check and move all attachments to an external document management system. This approach can capture attachments created by any means, but may require dealing with performance and synchronization issues.
    Best regards,
    Kevin

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,391 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans