Method is Allowed hook
Use this hook to control whether new records can be inserted, existing records can be updated or deleted. The input argument for this hook is the method.
This tables shows the Method values:
Method | Description |
---|---|
DAL_NEW |
The hook is called to know whether records can be added. There is no current record, but in case of a session with a view, the view fields are available. |
DAL_UPDATE |
The hook is called to know whether the current record can be updated. |
DAL_DESTROY |
The hook is called to know whether the current record can be deleted. |
Example:
function extern boolean method.is.allowed(long method)
{
on case method
case DAL_NEW:
select tdsls400.cdf_blck
from tdsls400
where tdsls400.orno = :tdsls401.orno
as set with 1 rows
selectdo
if tdsls400.cdf_blck = tdcdf______chk.yes then
dal.set.error.message(
"@Order is blocked, you cannot add Lines to it.")
return(false)
endif
endselect
break
case DAL_UPDATE:
break
case DAL_DESTROY:
break
endcase
return(true)
}
See the Infor ES Programmers Guide (Infor Customer Portal KB2924522) for more information about method.is.allowed()
of the standard Data Access Layer. Note that this hook can only be used to set more restrictions. If the standard functionality does not allow a certain action, the extension cannot allow it either.