I have a problem refreshing a salesOrder after deleting the current record. I created some custom functionality what is validating a field. If checked it will ask to delete the record. That works fine by doing a rec.delete(true). However the form itself is not refreshing. I tried to fix that by adding some code in the OnAfterValidate trigger of this field on the form as: CurrForm.Update() (used true or false, both didn't work). But whatever I try nothing seems to work. If I then close the form I receive an error that says: 'Sales Header does not exist', with the document type and No. of the record I just deleted. Is there any trick how to overcome this problem?
0
Comments
Why not hit F4? or use sendkeys on check of the box to execute F4?
http://www.BiloBeauty.com
http://www.autismspeaks.org
I wish I just could use the F4 button.
But...any work around? I'm stuck.
Just a happy frood who knows where his towel is
Any suggestions anyone?
Just a happy frood who knows where his towel is
http://www.BiloBeauty.com
http://www.autismspeaks.org
I think this is a bug.
I had an almost similar issue many years ago. I did a lot of things to try to resolve it, but never could. Basically in the code I have it creates the record, does some work on the record then deletes it. Sometimes the refresh does not work, and if you close the form, then open again it gives a message that the record exists.
A temporary table would solve the technical issue, but the created record needs to in the database, so that was not an option. In the end I had to add code to prevent the users form closing the form incorrectly or from being able to accidentally cause the error. And of course a lot of training. Even then, at least twice a year they have the problem, and the only fix is to either delete the users ZUP or design and save the form to lose the stored settings.
If you ever work out the issue, please let us know, it will help me too.
By the way, this started on 3.10 (native) then 4.00(native) then 5.00sp1(SQL). Each exe upgrade made it more stable, but even in 500sp1 there are still issues.
I'll keep you posted if I come up with a solution.
In the meanwhile if anyone has an idea, just let me know.
viewtopic.php?f=5&t=25712
http://www.BiloBeauty.com
http://www.autismspeaks.org
What I did so far was making a call to my delete function from one of the SalesHeader table fields. Instead I'm making the call from the same field but on the SalesOrder form (header form). In the OnAfterValidate trigger I add the following code (I have done this before BUT without using the CurrPage.SAVERECORD line. That did the trick). Here is my code:
//Start
CurrPage.SAVERECORD;
Cancel_Order;
CurrPage.UPDATE;
//End
The CurrPage.SaveRecord was needed to overcome my problem. Don't ask me why.
THe CurrPage.Update is refreshing the form. (I have used this before. It didn't work until now with this 'CurrPage.SaveRecord' line)