After Save hook
Use this hook to perform additional actions after the current (new or existing) record is saved. Think of updating fields in other tables, etc. The input argument for this hook is the mode.
This table shows the Mode values:
Mode |
Description |
---|---|
|
A new record is being inserted. |
|
An existing record is being updated. |
This hook is executed before the after.save.object()
hook of the standard Data Access Layer is executed. If the standard hook must be executed before the extension hook is executed, you can force the standard hook being executed anytime you prefer. This can be achieved by calling the table.super()
function.
All field values of the current record of the table are available.
For more information, see after.save.object()
of the standard Data Access Layer in the Infor ES Programmers Guide (Infor Customer Portal KB2924522).
Example:
function extern long after.save.object(long mode)
{
table.super()
with.old.object.values.do(get.old.values)
if tcmcs004.cdf_city <> old.city then
ret = txcomdll0001.log.city.change(
old.city, tcmcs004.cdf_city)
if ret < 0 then
dal.set.error.message(
"@Error during logging city change")
return(DALHOOKERROR)
endif
endif
return(0)
}