> For the complete documentation index, see [llms.txt](https://docs.calwincloud.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.calwincloud.com/calwin-script/system-script-events/onchecksalesheaderrules.md).

# OnCheckSalesheaderRules

This event can be used to check order header rules

### Example and syntax

```objectpascal
procedure OnCheckSalesheaderRules(aWrapper:TSalesheaderWrapper);
begin
  //Required E-mail adress
  if (aWrapper.DebtorAccount <> '') and (aWrapper.Email = '') then
  begin
    if aWrapper.SalesType = 0 then //Quote
      aWrapper.AddRuleWarning('EMAIL','E-mail adress must be entered before quote is converted to order');
    if aWrapper.SalesType = 1 then //Order
      aWrapper.AddRuleViolation('EMAIL','E-mail adress must be entered');    
  end;
end;
```
