Tier-2 + sandbox missing attachments after restore database
Scenario : A Tier-2 sandbox used for end user training has to be refreshed from a baseline version every 2 or 3 days (backup of the same sandbox environment) to start over with fresh database with config, setups and master data. After each restore the attachments against some of the master / config data stored in Azure storage is missing or isn't accessible.
Solution:
Record attachment information is stored in the DocuRef and DocuView tables. The DocuRef table is the record that represents the attachment. The DocuRef record points to the record being attached to and to a DocuView record. The DocuView record points to the file that is the attachment. Attachments saved in azure storage (blob) has a major benefit, any database operations, like restoring from backup, will only affect the database information about the attachment, not the attachment file itself stored in blob.
So, all you need to do is correct some of the access information of that files in DocuValue table, where this information is stored.
e.g 'https://d365fo594ad1b.blob.core.windows.net/documents/' do not include the fileid after 'documents/'
update docuvalue set storageproviderid=1, accessinformation=concat(',docuvalue.fileid)
*This post is locked for comments