Featured Post

Dynamics GP 2019 is now Released

It is now released, Microsoft Dynamics GP 2019 which moves the system to the modern product life cycle   " Beginning with the October...

Wednesday, July 8, 2015

Document Attachment Error with GP 2015 R2 - "A Save Operation on table 'coAttachMSTR' has created a duplicate key error"


We have recently encountered an issue with GP 2015 R2 in the Document Attachment functionality, the case has been reported by various community members such as this case.
Symptoms
Users are not able neither to attach documents or to view attached documents. The issue is related to all Dynamics GP users except for 'sa' specifically, regardless of the security roles granted to the users. 

When attaching a new document, the systems responds with an error stating that "A Save Operation on table 'coAttachMSTR' has created a duplicate key error"
 
Save Operation Error when Attaching Documents

When a user tries to preview already attached documents, the systems responds with an error message stating that "Unable to preview this attachment"

Error previewing Attached Documents


Technical Perspective 
Tracking this error on the SQL profilers shows that this is mostly a dysfunctional issue related to all users other than 'sa', and the reason is not security since granting any of the users a "Sys Admin" just for the sake of testing doesn't resolve the issue. 


As retrieved from the SQL profiler, the 'sa' user is getting the attachment ID properly, and then getting it inserted into the CO00100 (procedure zDP_CO00101SI ),

-- The code below is retrieving the Attachment ID  
EXEC sp_executesql N'INSERT INTO coAttachmentItems (Attachment_ID, fileName, BinaryBlob) VALUES (@Attachment_ID, @fileName, 0x0) ',
    N'@Attachment_ID nvarchar(36),@fileName nvarchar(6)',
    @Attachment_ID = N'7e063e4d-4d5c-4c14-9337-70d0a15a337a',
    @fileName = N'12.mac'
go
    
-- The code below is inserting the record into CO00100 including the attachmentID    
BEGIN
    DECLARE @num INT
    EXEC FIVER.dbo.zDP_CO00101SI '7e063e4d-4d5c-4c14-9337-70d0a15a337a',
        '12.mac', '', 'sa', '2017.04.12', '03:12:37', 'IC', 0, 0, 0, '', 0,
        0, @num OUT
    SELECT  @num
END


On the other hand, the other test user is not retrieving any attachmentID, and the field is blank as shown below:

BEGIN
    DECLARE @num INT
    EXEC FIVER.dbo.zDP_CO00101SI '', '12.mac', '', 'USER15', '2017.04.12',
        '03:07:48', 'IC', 0, 0, 0, '', 0, 0, @num OUT
    SELECT  @num
END

As you see, the first parameter which is the AttachmentID is blank, and that's why the error is popping on the screen.

Solution

The case is currently reported to Microsoft support team on MSConnect and it has been marked as "Tracking", any further official responses will be provided immediately on this post. Meanwhile, you may review the report on MSConnect on this link


Best Regards, 
Mahmoud M. AlSaadi



4 comments:

  1. Hi Mahmoud,

    Any update for above reported issue from Microsoft?

    ReplyDelete
    Replies
    1. Hello Soma
      This has been resolved with the most recent release (july Hotfix Round 2), further details can be found on:
      http://mahmoudsaadi.blogspot.com/2015/08/document-attachment-error-with-gp-2015.html


      Best Regards,
      Mahmoud M. AlSaadi

      Delete
    2. Yes. Mahmood.

      This has been resolved by updating latest hot fix (804). Yesterday I have updated and confirmed.

      Thanks

      Delete
  2. BE SMART AND BECOME RICH IN LESS THAN 3DAYS....It all depends on how fast 
    you can be to get the new PROGRAMMED blank ATM card that is capable of
    hacking into any ATM machine,anywhere in the world. I got to know about 
    this BLANK ATM CARD when I was searching for job online about a month 
    ago..It has really changed my life for good and now I can say I'm rich and 
    I can never be poor again. The least money I get in a day with it is about 
    $50,000.(fifty thousand USD) Every now and then I keeping pumping money 
    into my account. Though is illegal,there is no risk of being caught 
    ,because it has been programmed in such a way that it is not traceable,it 
    also has a technique that makes it impossible for the CCTVs to detect 
    you..For details on how to get yours today, email the hackers on : (
    atmmachinehackers1@gmail.com ). Tell your 
    loved once too, and start to live large. That's the simple testimony of how 
    my life changed for good...Love you all ...the email address again is ;
    atmmachinehackers1@gmail.com

    ReplyDelete