confirm dialog to go back to document without error

samantha73samantha73 Member Posts: 94
Hi Guys
I have a confirm dialogue on the sales order to check if the posting date is equal Today. If the date is not equal to Today I want to go back to the sales order without the error message as we have already shown this to the user. Below code works except unnecessary showing of error message. How to not show error message and exit back to sales order screen?

SalesHeader.SETRANGE("Document Type", SalesHeader."Document Type"::Order);

SalesHeader.SetRange("No.", SalesHeader."No.");
SalesHeader.SetFilter("Posting Date", '<>%1', Today);
IF SalesHeader.FindFirst() THEN
IF NOT CONFIRM('Do you want to change Posting Date. Click "Yes" to go back and change', true) then
exit else
error('Posting Date %1', SalesHeader."Posting Date");

Best Answer


Sign In or Register to comment.