Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

Updating Ship To Address using Visual Studio and Table Buffers

(0) ShareShare
ReportReport
Posted on by 411

I have a working Visual Studio for Dynamics GP application where I successfully update Location Codes and Line Item Quantities in Sales Transaction Entry using Global Table Buffers as demonstrated in the Visual Studio Tools for Microsoft Dynamics GP Programmers Guide. I have run into a problem when trying to update the Ship To Address information on a Return Sales Document. Running .Change() gives noerror as the response but after specifying changes and running .Save() the error is "Sharing".

These are the same steps I use elsewhere to update values, including Location and Quantites. I have sample code below. Has anyone successfully updated Ship To Address information using this?

Dim lastError As TableError
Dim SopHdrWorkTable As SopHdrWorkTable = Dynamics.Tables.SopHdrWork

SopHdrWorkTable.Key = 1
SopHdrWorkTable.SopNumber.Value = "SOP1234"
SopHdrWorkTable.SopType.Value = 4

' Open the table buffer by getting the record
lastError = SopHdrWorkTable.Change
If lastError = TableError.NoError Then SopHdrWorkTable.Address1.Value = "Some Address 1 Value"

lastError = SopHdrWorkTable.Save()

If Not SopHdrWorkTable Is Nothing Then SopHdrWorkTable.Close()
End If

*This post is locked for comments

  • Suggested answer
    Craig Fuller Profile Picture
    Craig Fuller 411 on at
    RE: Updating Ship To Address using Visual Studio and Table Buffers

    For anyone interested, much time and trial was put into trying to update the Ship To Address information via .Net. I tried all that I knew and could think of including opening the Sales Ship To Address Entry window and writing directly into the fields. But clicking OK to that window would not save the values populated via code (yes I even runvalidated the fields after updating their values). This was the strangest thing and quite frustrating.

    So, I concluded I must update the record using Global Table Buffers but this is apparently not possible while the record is pulled up in the Sales Transaction Entry window. I ended up using the SaveRecord_ValidateBeforeOriginal to capture the document number into a variable and then execute my Global Table Buffer sub in the SaveRecord_ValidateAfterOriginal, only notifying the user if the SopHdrWorkTable.Save() operation failed. This didn't allow the record to remain in the window in the event of a failure but was a compromise that was acceptable for this particular need.

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,430 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans