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?
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.
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
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
... 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.
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.
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
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();
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
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?
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.
Regards
David
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156