Microsoft provides an feature to make any field mandatory from the front end, but what if we want to make a "field" mandatory in Dynamics 365 for Finance and Operations with customization?
It is often a requirement from the customer side to make the field mandatory on the forms for some users, user groups, and sometimes for all the users of the organization.
Let's take an example if we want to make Main Category field mandatory on the main account page.
[extensionof(formdatasourceStr(MainAccount, MainAccount))]
internal final class COMPMainAccount_Extension
public boolean validateWrite()
{
boolean ret = next validateWrite();
FormStringControl LedgerCategory = this.formRun().design().controlName("Ledger_Category") as FormStringControl;
if (!LedgerCategory.valueStr())
{
ret = checkFailed("Ledger Category must be filled in");
}
return ret;
}
Comments
Post a Comment