Technical description
Instead of programming TESTFIELD in a setup field that would result in an error message to the user, we need to implement a function that guides users through the process.
The function is a member of the setup table, and should explain its purpose. As an example, we will look at CompanyInfo.VerifyAndSetPaymentInfo
.
This function is called from the Sales Invoice report, and it shows the following message when executed:
The following is the code:
VerifyAndSetPaymentInfo() GET; IF IsPaymentInfoAvailble THEN EXIT; IF CONFIRM(NoPaymentInfoQst,TRUE,TABLECAPTION) THEN BEGIN CompanyInformationPage.SETRECORD(Rec); CompanyInformationPage.EDITABLE(TRUE); IF CompanyInformationPage.RUNMODAL = ACTION::OK THEN CompanyInformationPage.GETRECORD(Rec); END; IF NOT IsPaymentInfoAvailble THEN MESSAGE(NoPaymentInfoMsg,TABLECAPTION);
This function has a logical structure that tests whether the setup is correct, and exits if so.
The user gets a question asking if they...