Microsoft GP 2010 Visual Studio Tools has defeated me.
I would like to prevent particular SOP order documents from loading into SOP Entry, say depending on batch it is in.
I can't figure out how to do it using a visual studio tools add in and I've sunk to many hours experimenting be feel certain there must be a way.
Can anyone give me any pointers?
I have tried sopentry.close on the window triggered from a method attached to sopnumber.change, but causes an error if sopdocument lookup was used to select a document as the look up is still open and wants to return to the form that is now closed. I'd really like to leave the window in the state you find it in when you first launch SOPEntry anyway, with blank fields and the default doucment type if possible. It seems a little rude and crude to close the window on the user.
Next I tried changing the SOPTYPE back and forward of the drop down with the .ischanged=false to try and trigger the emptying effect this has when done in the UI directly. It works but complains about the document number not being found and sometimes the header from the order that was refused access can end up with a new order number as a duplicate and with no lines in. I guess the table buffer is not emptied and when the user selects a new SOP document it gets the header from the previously refused document. This is no good at all!
I'm certain there must be a technique I don't know here.
Currently trying...
MessageBox.Show("Document in a batch that does not allow editing. ", "Restricted Batch", MessageBoxButtons.OK, MessageBoxIcon.Information)SupressDocDoesNotExist = True
Dynamics.Forms.SopEntry.IsChanged = False
Dynamics.Forms.SopEntry.SopEntry.SopType.Focus()
Dynamics.Forms.SopEntry.SopEntry.SopType.Value = 1
Dynamics.Forms.SopEntry.SopEntry.SopNumber.Value = String.Empty
Dynamics.Forms.SopEntry.SopEntry.SopType.RunValidate()
Dynamics.Forms.SopEntry.SopEntry.SopType.Value = 2
Dynamics.Forms.SopEntry.SopEntry.SopType.RunValidate()
Also tried messing with
In an attempt to get rid of the child window before closing the sopentry window thus preventing the error I got when using that method.
Dynamics.Forms.SopEntry.CloseChildrenProcedure.Invoke()
Also tried loading and empty document with
Dynamics.Forms.SopEntry.Functions.OpenWindow.Invoke(
"", 2, False, ""
, 0)
ANY advise welcome.
*This post is locked for comments