Skip to main content

Notifications

Announcements

No record found.

How to permanently delete a Document Attachment in Microsoft Dynamics GP

Terry R Heley Profile Picture Terry R Heley Microsoft Employee

Hello,

Today I would like to discuss Document Attachment. We see a common scenario where a Attachment is deleted but is still seen in the Deleted section of Document Attachment and don’t want this to be seen associated with the Journal Entry as an example.

First, let’s run through a scenario on how this can occur. We can then go over how to remove the attachment from the deleted section if it is not wanted.

  1. First, create a Journal Entry and attached any document to it.
    1. Transaction >> Financial >> General

      pastedimage1584991218102v4.png

  2. Now, delete the Attachment from the Journal Entry by clicking the button with the red arrow.

    pastedimage1584991255562v6.png    pastedimage1584991263897v7.png


  3. Now, we can see on the Journal Entry, near the look up, the yellow which denotes an attachment. If we open the attachment window, it will only show under the deleted section, highlighted below

    pastedimage1584991291459v10.png

When we see these cases, it is usually due to the wrong document being selected and don’t want any trace of the wrong document attached as this can cause confusion.

How do we remove the Attachment so there is no link to the Journal Entry you might be asking yourself?

The process to identify the attachment is pretty simple as we hold the file name. To do this, we can use the following approach:

  1. First, we identify the name of the attachment by looking at the Document Attachment Management window for the JE in question.
    1. Transaction >> Financial >> General >> Select the Journal Entry >> Click the Document Attach button >> Click the Paper Clip icon >> Click the Delete tab in the Document Attachment window.
    2. You can get the file name of the attached document which we will use in SQL to locate the records.

      pastedimage1584991311323v11.png


  2. Once we have the file name, can get the Attachment_ID from the CO00101 using the File Name.

select * From CO00101 where fileName = '22regionsbai.txt'

  1. In the CO00101 table, we can take the Attachment_Id and use as our identifier in the script below to locate all the CO00X0X tables are associated with this Attachment.

select * From CO00101 where attachment_ID = '191c2f00-b4bc-4e6d-8a9a-e6a8d73587f2'

select * From CO00102 where attachment_ID = '191c2f00-b4bc-4e6d-8a9a-e6a8d73587f2'

select * From CO00103 where attachment_ID = '191c2f00-b4bc-4e6d-8a9a-e6a8d73587f2'

select * From CO00104 where attachment_ID = '191c2f00-b4bc-4e6d-8a9a-e6a8d73587f2'

select * From CO00105 where Attachment_ID = '191c2f00-b4bc-4e6d-8a9a-e6a8d73587f2'

 

  1. Once we have located the records and verify these are the attachment records in question, we can delete these out of the CO tables that returned results.
    1. These are just example statements.

delete CO00101 where attachment_ID = '191c2f00-b4bc-4e6d-8a9a-e6a8d73587f2'

 

delete CO00102 where attachment_ID = '191c2f00-b4bc-4e6d-8a9a-e6a8d73587f2'

 

delete CO00103 where attachment_ID = '191c2f00-b4bc-4e6d-8a9a-e6a8d73587f2'

 

delete CO00104 where attachment_ID = '191c2f00-b4bc-4e6d-8a9a-e6a8d73587f2'

 

delete CO00105 where Attachment_ID = '191c2f00-b4bc-4e6d-8a9a-e6a8d73587f2'

  1. After running these, the attachment is not longer seen on the JE.

    pastedimage1584991390606v12.png

  2. There are times where you will need to remove this records out of the SY03900 table as well if it exists.

There is also a product suggestion to have the Delete process delete the attachment entirely instead of moving it to the deleted section. Please feel free to vote this as the more votes we receive the higher chance this feature will be added to a later version of Microsoft  Dynamics GP.

This information is provided as is. It is always recommended to test in a test company with a copy of live to verify the end results.

I hope this helps and saves you a call to support.

Brandon Jarret | Microsoft Support Engineer.

Comments

*This post is locked for comments