Thursday, August 7, 2014

PeopleCode Events

•    Activate event.
•    FieldChange event.
•    FieldDefault event.
•    FieldEdit event.
•    FieldFormula event.
•    ItemSelected event.
•    PostBuild event.
•    PreBuild event.
•    PrePopup event.
•    RowDelete event.
•    RowInit event.
•    RowInsert event.
•    RowSelect event.
•    SaveEdit event.
•    SavePostChange event.
•    SavePreChange event.
•    SearchInit event.
•    SearchSave event.
•    Workflow event.

Activate Event:

1.    Initiated each time that a page is activated.
2.    Each page has its own Activate event.
3.    This event is valid only for pages that are defined as standard or secondary. This event is not supported for subpages.
4.    Activate PeopleCode associated with a popup page executes after the page activate event for the main page.
5.    Place PeopleCode related to page display or page processing, such as enabling a field or hiding a scroll area, in this event.
6.    Use this event for security validation: if an user does not have clearance to view a page in a component, you would put the code for hiding the page in this event.

FieldChange Event:

1.    Use to recalculate page field values, change the appearance of page controls etc other.
2.    Do not use for Data validation.
3.    Event applies to the field and row that just changed.
4.    FieldChange PeopleCode is often paired with RowInit PeopleCode.
5.    PeopleCode can be associated with record fields and component record fields.

FieldDefault Event:

1.    Use to programmatically set fields to default values when they are initially displayed.
2.    You must attach FieldDefault PeopleCode to the field where the default value is being populated.
3.    This event is initiated on all page fields as part of many different processes.
4.    Normally sets fields by default when new data is being added to the component; that is, in Add mode and when a new row is inserted into a scroll area.

FieldEdit Event:

1.    Use to validate the contents of a field, supplementing standard system edits.
2.    If the data does not pass the validation, the PeopleCode program should display a message (using ERROR statement or WARNING statement).
3.    Use Error statement to redisplay the page and displaying an error message by turning the field red.
4.    To permit the field edit but alert the user to a possible problem, use a Warning statement.
5.    The FieldEdit event applies to the field and row that just changed.
6.    FieldEdit PeopleCode can be associated with record fields and component record fields.

FieldFormula Event:

1.    Is not currently used.
2.    Use RowInit and FieldChange events rather than FieldFormula.
3.    FieldFormula is now often used in FUNCLIB_ (function library) record definitions to store shared functions.

ItemSelected Event:

1.    Event is initiated whenever a user selects a menu item from a pop-up menu.
2.    ItemSelected PeopleCode is only associated with pop-up menu items.
3.    ItemSelected PeopleCode executes in the context of the page field from where the pop-up menu is attached.

PostBuild Event:

1.    Event is initiated after all the other component build events have been initiated.
2.    This event is often used to hide or unhide pages.
3.    It is also used to set component variables.

PreBuild Event:

1.    Event is initiated before the rest of the component build events.
2.    This event is often used to hide or unhide pages.
3.    It is also used to set component variables.
4.    Use the PreBuild event to validate data entered in a search page after a prompt list is displayed.
5.    PreBuild PeopleCode is only associated with components.

PrePopup Event:

1.    The PrePopup event is initiated just before the display of a pop-up menu.
2.    Use to control the appearance of the pop-up menu.
3.    Event can be associated with record fields and component record fields.

RowDelete Event:

1.    Event is initiated whenever a user attempts to delete a row of data from a page scroll area.
2.    Use code to prevent the deletion of a row (using an Error or Warning statement) or to perform any other processing contingent on row deletion.
3.    Event triggers PeopleCode on any field on the row of data that is being flagged as deleted.
4.    RowDelete PeopleCode can be associated with record fields and component records.
5.    RowDelete does not trigger programs on derived/work records.

RowInit Event:

1.    Event is initiated the first time that the Component Processor encounters a row of data.
2.    Use it to set the initial state of component controls during component build processing and row insert processing.
3.    The RowInit event also occurs after a Select or SelectAll Rowset method, or a ScrollSelect or related function, is executed.
4.    RowInit is not field-specific. It triggers PeopleCode on all fields and on all rows in the component buffer.
5.    Do not use Error or Warning statements in RowInit PeopleCode. They cause a runtime error.
6.    RowInit PeopleCode can be associated with record fields and component records.

RowInsert Event:

1.    When a user adds a row of data, the Component Processor generates a RowInsert event.
2.     Use RowInsert PeopleCode for processing specific to the insertion of new rows.
3.    Do not put PeopleCode in RowInsert that already exists in RowInit, because a RowInit event always initiates after the RowInsert event, which will cause your code to be run twice.
4.    Event triggers PeopleCode on any field on the inserted row of data.
5.    Do not use a warning or error statements in RowInsert.
6.    RowInsert PeopleCode can be associated with record fields and component records.

RowSelect Event:

1.    Event is initiated at the beginning of the component build process in any of the update action modes (Update, Update/Display All, Correction).
2.    Is used to filter out rows of data as they are being read into the component buffer.
3.    PeopleSoft applications rarely use RowSelect, because it's inefficient to filter out rows of data after they've already been selected.
4.    RowSelect PeopleCode can be associated with record fields and component records.
5.    Do not use a warning or Error Statements.

SaveEdit Event:

1.    Event is initiated whenever a user attempts to save the component.
2.    Use SaveEdit PeopleCode to validate the consistency of data in component fields.
3.    Whenever a validation involves more than one component field, you should use SaveEdit PeopleCode.
4.    If a validation involves only one page field, use FieldEdit PeopleCode.
5.    SaveEdit is not field-specific. It triggers associated PeopleCode on every row of data in the component buffers except rows flagged as deleted.
6.    An Error statement in SaveEdit PeopleCode displays a message and redisplays the component without saving data.
7.    A Warning statement enables the user to click OK and save the data, or to click Cancel and return to the component without saving.
8.    Use the SetCursorPos function to set the cursor position to a specific page field following a warning or error in SaveEdit; to show the user the field (or at least one of the fields) that is causing the problem.
9.    Make sure to call SetCursorPos before the error or warning, because these may terminate the PeopleCode program.
10.    SaveEdit PeopleCode can be associated with record fields and components.

SavePostChange Event:

1.    After the Component Processor updates the database, it initiates the SavePostChange event.
2.    You can use SavePostChange PeopleCode to update tables not in your component using the SQLExec built-in function.
3.    Avoid errors and warnings in this event. It causes a runtime error.
4.    The system issues a SQL Commit statement after SavePostChange PeopleCode completes successfully.
5.     If executing Workflow PeopleCode, Workflow PeopleCode fails then SavePostChange PeopleCode is not executed.
If your component has both Workflow and SavePostChange PeopleCode, consider moving the SavePostChange PeopleCode to SavePreChange or Workflow.
6.    If you are doing messaging, your Publish PeopleCode should go into this event.
7.    SavePostChange does not execute if there is an error during the save.
For example, if there is a data conflict error because another user updated the same data at the same time, SavePostChange does not execute.
8.    SavePostChange PeopleCode can be associated with record fields, components, and component records.

SavePreChange Event:

1.    The SavePreChange event is initiated after SaveEdit completes without errors.
2.    SavePreChange PeopleCode provides one final opportunity to manipulate data before the system updates the database.
3.    If SavePreChange runs successfully, a Workflow event is generated, and then the Component Processor issues appropriate Insert, Update, or Delete SQL statements.
4.    SavePreChange PeopleCode is not field-specific: it triggers PeopleCode on all fields and on all rows of data in the component buffer.
5.    SavePreChange PeopleCode can be associated with record fields, components, and component records.

SearchInit Event:

1.    The SearchInit event is generated just before a search, add, or data-entry dialog box is displayed.
2.    SearchInit triggers associated PeopleCode in the search key fields of the search record.
3.    It enables to control processing before a user enters values for search keys in the dialog box.
Example: EMPLID = %EmployeeId; Gray (EMPLID); AllowEmplIdChg(True);
4.    You can activate system defaults and system edits in the search page by calling SetSeachDefault and SetSearchEdit in SearchInit PeopleCode.
5.    SearchInit PeopleCode can be associated with record fields on search records and prompt table records and on component search records and component prompt table records.
6.    You cannot use the following functions in SearchInit PeopleCode:
•    DoModal
•    DoModalComponent
•    Transfer
•    TransferExact
•    TransferNode
•    TransferPage
•    TransferPortal

SearchSave Event:

1.    SearchSave PeopleCode is executed for all search key fields on a search, add, or data-entry dialog box after a user clicks Search.
2.    This enables you to control processing after search key values are entered, but before the search based on these keys is executed.
3.    Event is also used to force a user to enter a value in at least one field, even if it’s a partial value, to help narrow a search for tables with many rows.
4.    SearchSave is not initiated when values are selected from the search list. To validate data entered in the search page, use the Component PreBuild event.
5.    You can use Error and Warning statements in SearchSave PeopleCode to send the user back to the search page if the user entry does not pass validations.
6.    SearchSave PeopleCode can be associated with record fields and component search records.

Workflow Event:

1.    Workflow PeopleCode executes immediately after the SavePreChange event and before the database update that precedes the SavePostChange event.
2.    The Workflow event segregates PeopleCode related to workflow from the rest of the application’s PeopleCode.
3.    Only PeopleCode related to workflow (such as TriggerBusinessEvent) should be in workflow programs.
4.    Your program should deal with the Workflow event only after any SavePreChange processing is complete.
5.    Workflow PeopleCode is not field-specific: it triggers PeopleCode on all fields and on all rows of data in the component buffer.
6.    WorkFlow PeopleCode can be associated with record fields and components.

No comments:

Post a Comment