Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

Programmatically import Document Attachments (GP 2015) ??

(0) ShareShare
ReportReport
Posted on by 67

I have a project and one of the requirements is to import images and attach to documents in GP (AP invoices). Will have to be done on an automated basis so I'll be importing using .NET to SQL if that's possible (using the file name as the voucher number to get the document the image should be attached to).

I've pretty well figured out the tables involved, but there's a single piece I can't quite figure out.

There is a value being generated that is a key used in all the tables called "BusObjKey" (char 201). In Fabrikam when I attach documents using GP this key looks like:

0\System\Notes\0000002D
0\System\Notes\000003D5

^^ These are for 2 separate vouchers. The last part is what I need but I can't find it stored in GP. When you pull up the Document Attachment window, the value is at the top of the form as "Record Number" but I can't track down the table as the resource description for the window shows some tables that I can't find in GP and the ones that do I can't find this value.

2 questions:

1) Does anyone know how the BusObjKey is generated?

2) Has anyone had success importing document attachments into GP through the database/code? How can I get from the voucher to "Record Number" (IE 0000002D, 000003D5) ?

*This post is locked for comments

  • JamesLyn Profile Picture
    360 on at
    RE: Programmatically import Document Attachments (GP 2015) ??

    I've done this successfully using Dexterity. Rather than trying to forcefully create the BusObjKey, I create a new note through Dexterity and let GP create a new record number and I retrieve that for the attachment. My code is written as an Add-in, and the most I've batched is <100 so I am not sure what the performance is like when you try to scale it further.

    Code: drive.google.com/.../view

    Walkthrough: jamesdlyn.wordpress.com/.../gp-batch-attach-code-walkthrough

    James

  • Brian P Connell Profile Picture
    859 on at
    RE: Programmatically import Document Attachments (GP 2015) ??

    We were "successful" with our import, but we get errors trying to post the checks applied to invoices with imported attachments. codocstatus duplicate key is the error. If you experienced the same and resolved it let me know if you are willing to discuss it. We are more than happy to pay for your time. 

  • Community Member Profile Picture
    on at
    RE: Programmatically import Document Attachments (GP 2015) ??

    Yes, we were successful in accomplishing this. The example code above is the only I figured out how to generated the BusObjKey from a NOTEINDX in the PM10000 table. It converts the decimal note index to its hexidecimal equivalent.

  • Brian P Connell Profile Picture
    859 on at
    RE: Programmatically import Document Attachments (GP 2015) ??

    Did you ever accomplish this ? we ended up creating an ssis package that imports the files from a file server. 

    we did this for a customer that had over 200,000 attachments from an older file based attachment link. 

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: Programmatically import Document Attachments (GP 2015) ??

    I believe it is just a matter of converting the NOTEINDX to an int, then to a hexidecimal, then to a varchar. Below is an example for Payables:

    select convert(varchar(max), CONVERT(VARBINARY(8), CONVERT(int, NOTEINDX)), 2), * from PM10000 where VCHRNMBR like '%TEST-VOUCHER%'

  • progrmr Profile Picture
    67 on at
    RE: Programmatically import Document Attachments (GP 2015) ??

    See table CO00102 for the BusObjKey I reference above, sorry forgot to put that in.

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

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > 🔒一 Microsoft Dynamics GP (Archived)

#1
Almas Mahfooz Profile Picture

Almas Mahfooz 3 User Group Leader

Featured topics

Product updates

Dynamics 365 release plans