I've seen an issue twice with the most recent upgrade to GP 18.6 where random Word Templates disappear during the upgrade process.
After the upgrade, the user reported that they could not print the templates, an exclamation appears in the GP bar at the bottom. Attempting to open the template file from template maintenance does not work, and I notice the file downloaded to the temp folder was quite small. I opened the file with notepad, and it's a blank file.
I then tracked down the records in the DYNAMICS database - look in SY20000 for the header record which details the template name and TemplateID. Then look in the syReportTemplates table where RELID equals the TemplateID. This table contains the actual binary data for the Word Template, and the templates in question had a binary value of 0x00 which means an empty file.
To resolve, I restored a pre-upgrade backup of DYNAMICS to DYNAMICS_OLD and checked the same records which contained the large string of characters in the BinaryBlob column.
Custom templates are typically higher that 10000. Use this query to quickly compare the before and after (note the highlighted rows):
SELECT * FROM DYNAMICS_OLD..syReportTemplates WHERE RELID>10000 ORDER BY RELIDSELECT * FROM DYNAMICS..syReportTemplates WHERE RELID>10000 ORDER BY RELID
Now that I identified the missing template data, I updated the following script with the specific ID's to recover those files. Change your db names as needed if you use other names for the live, and restored DYNAMICS.
UPDATE NEW SET NEW.BinaryBlob=OLD.BinaryBlob
FROM DYNAMICS..syReportTemplates NEW
INNER JOIN DYNAMICS_OLD..syReportTemplates OLD ON NEW.RELID=OLD.RELID
WHERE NEW.RELID IN (10002,10004)
This script copies the binary contents from the pre-upgrade Dynamics template table to the upgraded template table.
Note the other 0x00 records are legitimately deleted templates from GP, no longer used.
Hope this helps someone out there. Not sure why it's happening - we've never seen this with prior upgrades.