Description
The AfterAdd event is executed after the record is physically added to the database. It works in all add modes: Inline Add, Regular Add and an Add page in a popup.
Syntax
AfterAdd($values, $keys, $inline, $pageObject)
Arguments
Note: Field names are case-sensitive. If the field name is PlayerId, you should use $values["PlayerId"]. Note that $values["playerid"] or $values["PlayerID"] will not work.
Note: If the field was assigned an alias in the SQL query, then the $values array will get the alias instead of the field name from the database.
E.g., if you have an SQL query SELECT salesrep_id AS Inv_Salesrep ..., you should use $values["Inv_Salesrep"].
$values
an array of values to be written to the database. To access a specific field value, use $values["FieldName"].
$keys
an array of key column values that point to the newly added record. To access a specific key column value, use $keys["KeyFieldName"].
$inline
equals to true for the Inline Add, false otherwise.
$pageObject
an object representing the current page. For more information, see RunnerPage class.
Note: If you need to display a message on the page or pass a variable value to JavaScript, you need to add the following to the end of your event code:
$pageObject->stopPRG = true;
Example
Passing true to pageObject.stopPRG = true variable named "saved":
$pageObject->stopPRG = true;
$pageObject->setProxyValue("saved", true);
Applies to pages
Add, Inline Add.
Recommended sample events:
•Add new button to Add/Edit pages
•Change message after record was added or saved
•Redirect to details page after master record was added
•Speed up data entry using events
See also:
•AJAX helper object: setMessage()