Issue with Control of CONFIRM with DELETE Code

itsandsllcitsandsllc Member Posts: 13
edited 2013-01-30 in NAV Three Tier
Hello everyone and thanks for the time to read my post.

Recently I have been working with a client and cleaning up some code around the system per. requests. Everything's been going fine but I have run into an issue that really is throwing me for a loop.

I have tried searching many sites / etc testing and can't seem to find information to help with the issue at hand. I have tried moving to functions, working with a boolean as a switch to control the confirm and table changes to try and stop the error.

A little background ::
The Open Assignments is the list page which looks to the Assignments Card for the records in the Assignments table. All ok - everything's good and no issues so far. The NSC had added some code to the assignments card OnClosePage trigger. The code confirms if the user would like to keep the assignment. I know, I know... non of this is best practice / etc. but it was not my design, just my job to clean it up. So the code there (see screen shots and snippit) is ok and meets the users needs.

The issue ::
The problem is that when the user deletes an assignment from the list (see screen shot) the page is opened and with the standard confirm to delete the record which is before the confirm. If the user says no there is no issue (duh) but if the user selects yes then the page still tries to run the OnClosePage trigger which generates the runtime error.

The goal ::
Despite all the not best practices in use it does meet the need for the client. So my goal is to prevent the standard delete confirmation from displaying when the user deletes from the Open Assignments list OR to prevent the confirm code from running when the user deletes the record from the list and page card.

I really have tried to get this one knocked out but its just not coming together. I have attached screen shots for all the steps described above and the OnClosePage code below.

Thanks so, so much for anyone's help on the issue. [-o<
IF ("Movement No." <= '') AND (xRec."Movement No." <= '') THEN
  EXIT
ELSE
IF NOT CONFIRM('Do you wish to save the assignment?',TRUE) THEN
  BEGIN
    Rec.DELETE(TRUE);
  END;
2.png 9.3K
3.png 32.6K
4.png 37.4K
Sign In or Register to comment.