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.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
error('Posting Date %1', SalesHeader."Posting Date");