Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

Updating requested ship date in SOP Transaction Entry grid.

Posted on by 75,730

Before I embark on another development task I want to ask if this is even possible. The client want a mass update on the Requested Ship Date value on all SOP lines. They sometimes have very long orders and would prefer not to have to land on each line and update the date. My question is, using C# and proceeding through the grid is it possible to update that date?

Categories:
  • Richard Wheeler Profile Picture
    Richard Wheeler 75,730 on at
    RE: Updating requested ship date in SOP Transaction Entry grid.

    Thanks Dave, that did the trick. I have been buried in other projects none of which required extraction of data from a field not on the current window. Thanks again for the reminder.

  • David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    David Musgrave MVP ... 13,917 Most Valuable Professional on at
    RE: Updating requested ship date in SOP Transaction Entry grid.

    Hi Richard

    string shipMethod;
    shipMethod = Dynamics.Forms.SopCustomerDetailEntry.SopCustomerDetailEntry.ShippingMethod.Value;

    gives an error if the Sales Customer Detail Entry window is not open.  You cannot reference a field on a window of a form if the form is not open.

    The alternate would be to get the value from the SOP_Entry form's table buffer for the SOP_HDR_WORK table.  The data is stored in the table buffer when it is not displayed in the window.

    I used GP Power Tools .Net Execute window to prototype and test this works.

    string shipMethod;
    shipMethod = Dynamics.Forms.SopEntry.Tables.SopHdrWork.ShippingMethod.Value;
    MessageBox.Show(shipMethod);

    Regards

    David

  • Richard Wheeler Profile Picture
    Richard Wheeler 75,730 on at
    RE: Updating requested ship date in SOP Transaction Entry grid.

    Why does this:

    string shipMethod;

    shipMethod = Dynamics.Forms.SopCustomerDetailEntry.SopCustomerDetailEntry.ShippingMethod.Value;

    result in this error message:

    Unexpected error Updating SHIPMTHD on SOP lines records illegal address for field 'Shipping Method' in script 'Not Found]' Script Terminated

  • Tim Wappat Profile Picture
    Tim Wappat 5,701 on at
    RE: Updating requested ship date in SOP Transaction Entry grid.

    ... if I were you, I would add a menu option to the additional menu of sales transaction enquiry for the order(s) or a button somewhere.

    First check the order is not locked using SQL (in dex_lock table), ask the user to come out the order using dialog if it is locked.

    Then when not locked, do a SQL update on the order, anything else is not worth faffing on with for a trivial data update.

    Tim.

  • Richard Wheeler Profile Picture
    Richard Wheeler 75,730 on at
    RE: Updating requested ship date in SOP Transaction Entry grid.

    I had pulled some old code I had used years ago just to illustrate what I was trying to do. Since T-SQL will be quicker that is what I will do.

  • David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    David Musgrave MVP ... 13,917 Most Valuable Professional on at
    RE: Updating requested ship date in SOP Transaction Entry grid.

    Hi Richard

    You are going through the wrong definition to get to the table.... like you have been for the forms and windows.

    Microsoft.Dexterity.Applications.Dynamics.Tables.SopLineWork

    The code you have listed is just setting the range on the line table, it is not scrolling through the grid. You are not updating the window but the table behind the window.

    You can then get first and loop with get next until you reach the EOF.  This is the equivalent of the Dexterity method which will read and write each record one by one.

    Doing a SQL Update will be much faster.

    Regards

    David

  • Richard Wheeler Profile Picture
    Richard Wheeler 75,730 on at
    RE: Updating requested ship date in SOP Transaction Entry grid.

    If I were to scroll through the grid using something like this, would it be possible to update the shipping method and then have the values be saved?

               Microsoft.Dexterity.Applications.DynamicsDictionary.SopLineWorkTable sopLineWorkTable;

               sopLineWorkTable = Dynamics.Tables.SopLineWork;

               sopLineWorkTable.Key = 1;

               sopLineWorkTable.RangeClear();

               sopLineWorkTable.Clear();

               sopLineWorkTable.SopNumber.Value = SopNumber;

               sopLineWorkTable.SopType.Value = SopType;

               sopLineWorkTable.RangeStart();

               sopLineWorkTable.Fill();

               sopLineWorkTable.SopNumber.Value = SopNumber;

               sopLineWorkTable.SopType.Value = SopType;

               sopLineWorkTable.RangeEnd();

  • David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    David Musgrave MVP ... 13,917 Most Valuable Professional on at
    RE: Updating requested ship date in SOP Transaction Entry grid.

    Yes, use T-SQL as it will be faster than using the using the Dexterity table buffers (which are available from VSTools).

    Try calling the form procedure Refill_Scroll, pass in the caller ID of the constant SOP_ENTRY (which has a value of 1)

                   Dynamics.Forms.SopEntry.Procedures.RefillScroll.Invoke(1);

    regards

    David

  • Richard Wheeler Profile Picture
    Richard Wheeler 75,730 on at
    RE: Updating requested ship date in SOP Transaction Entry grid.

    David, when you say running an update at the table level, do you mean running a T-SQL command?

    What is the technique to refresh the scrolling window?

  • Suggested answer
    David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    David Musgrave MVP ... 13,917 Most Valuable Professional on at
    RE: Updating requested ship date in SOP Transaction Entry grid.

    The Shipping Method is here

    Dynamics.Forms.SopCustomerDetailEntry.SopCustomerDetailEntry.ShippingMethod.Value

    I would suggest running an update at the table level and refreshing the Scrolling window to re-read the data.

    It is possible to iterate through a scrolling window, but I have only been able to do it using GP Power Tools which allowed me to combine both Dexterity and .Net methods together to make it work.

    winthropdc.wordpress.com/.../

    Regards

    David

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans