PeopleCode Eventsv1.01

Post on 24-Nov-2014

354 views 91 download

Tags:

Transcript of PeopleCode Eventsv1.01

11

PeopleSoft PeopleSoft Application Application ServicesServices

PeopleCode PeopleCode EventsEvents

22

PeopleToolsPeopleTools PeopleSoft applications are designed using PeopleSoft applications are designed using

the powerful tools provided by PeopleSoft:the powerful tools provided by PeopleSoft: Application DesignerApplication Designer PeopleCodePeopleCode Application EngineApplication Engine

PeopleCode is a 4GL and has a rich syntax PeopleCode is a 4GL and has a rich syntax and structure to develop & incorporate and structure to develop & incorporate complex application logiccomplex application logic

33

PeopleCodePeopleCode

PeopleCode is simple but yet high-powered PeopleCode is simple but yet high-powered language to satisfy complex business language to satisfy complex business requirements within PeopleSoft.requirements within PeopleSoft.

It is used to incorporate sophisticated business It is used to incorporate sophisticated business rules into PeopleSoft Applications. rules into PeopleSoft Applications.

The language is designed specially to interact The language is designed specially to interact with the application processor, giving the with the application processor, giving the capability tocapability to enhance the application beyond the enhance the application beyond the capability of the PeopleTools.capability of the PeopleTools.

Using PeopleCode virtually any edit or validation Using PeopleCode virtually any edit or validation

can be accomplished.can be accomplished.

44

PeopleCode EventsPeopleCode Events PeopleSoft uses “Events” to control the flow and PeopleSoft uses “Events” to control the flow and

functionality of the applicationfunctionality of the application PeopleCode Programs are attached to the events PeopleCode Programs are attached to the events

supported by PeopleSoftsupported by PeopleSoft

Here, we will be focusing only on Here, we will be focusing only on PeopleCode Events, and how, why, where PeopleCode Events, and how, why, where and when these “Events” could be used for and when these “Events” could be used for developing Powerful Applications.developing Powerful Applications.

55

MENU

SearchInit

SearchSave

RowSelect

PreBuild

FieldDefault

FieldFormula

RowInit

PostBuild

Activate

Other Actions

FieldEdit

FieldChange

Popup Menu

NOPrePopup

ItemSelected

YES

RowInsert RowDelete

SaveEdit

SavePrechange

WorkFlow

SavePostChange

Page Displayed andWaits for User

Action

Row Actions?

Insert Delete

Save Action

PeopleCode Events – High Level PeopleCode Events – High Level FlowFlow

66

MENU

SearchInit

SearchSave

RowSelect

PreBuild

FieldDefault

FieldFormula

RowInit

PostBuild

Activate

Other Actions

FieldEdit

FieldChange

Popup Menu

NOPrePopup

ItemSelected

YES

RowInsert RowDelete

SaveEdit

SavePrechange

WorkFlow

SavePostChange

Page Displayed andWaits for User

Action

Row Actions?

Insert Delete

Save Action

PeopleCode Event - SearchInit PeopleCode Event - SearchInit EventEvent

77

PeopleCode EventsPeopleCode Events

SearchInitSearchInit

When is it fired?When is it fired?

This event is generated just before search dialog, This event is generated just before search dialog, add dialog or data entry dialog box is displayed.add dialog or data entry dialog box is displayed.

88

PeopleCode EventsPeopleCode Events

SearchInitSearchInit

Where is it used?Where is it used?

SearchInit can be associated with record fields SearchInit can be associated with record fields and component search records.and component search records.

99

PeopleCode EventsPeopleCode Events

SearchInitSearchInit

What is it used for?What is it used for?

SearchInit event triggers associated PeopleCode SearchInit event triggers associated PeopleCode in the search key fields of the search record.in the search key fields of the search record.

1010

PeopleCode EventsPeopleCode Events

SearchInitSearchInit

RestrictionsRestrictions

SearchInit will not trigger if run from a component SearchInit will not trigger if run from a component interfaceinterface

Can’t use functions like DoModal, Can’t use functions like DoModal, DoModalComponent,Transfer,TransferPage in DoModalComponent,Transfer,TransferPage in SearchInit event.SearchInit event.

1111

PeopleCode EventsPeopleCode Events

SearchInit eventSearchInit event

ExampleExample

This PeopleCode in SearchInit event on component search This PeopleCode in SearchInit event on component search key record field EMPLID sets the search key page field to key record field EMPLID sets the search key page field to the user’s employee ID, makes the page field unavailable the user’s employee ID, makes the page field unavailable for entry, and enables the user to modify the user’s own for entry, and enables the user to modify the user’s own data in the component.data in the component.

EMPLID=%EmployeeId;EMPLID=%EmployeeId; Gray (EMPLID);Gray (EMPLID); AllowEmp1IdChg(true);AllowEmp1IdChg(true);

1212

SearchInit EventSearchInit Event

This code is to directly go to the record where employee number is 10100

1313

SearchInit EventSearchInit Event

1414

SearchInit EventSearchInit Event

This code will displays the page which contains the employee details of the person whose Employee Number is 10010.

1515

SearchInit EventSearchInit Event

1616

PeopleCode Event - SearchSave PeopleCode Event - SearchSave EventEvent

MENU

SearchInit

SearchSave

RowSelect

PreBuild

FieldDefault

FieldFormula

RowInit

PostBuild

Activate

Other Actions

FieldEdit

FieldChange

Popup Menu

NOPrePopup

ItemSelected

YES

RowInsert RowDelete

SaveEdit

SavePrechange

WorkFlow

SavePostChange

Page Displayed andWaits for User

Action

Row Actions?

Insert Delete

Save Action

1717

PeopleCode EventsPeopleCode Events

SearchSaveSearchSave

When is it fired?When is it fired?

To control processing after search key values are To control processing after search key values are entered, but before the search based on these entered, but before the search based on these keys is executedkeys is executed..

1818

PeopleCode EventsPeopleCode Events

SearchSaveSearchSave

Where is it used?Where is it used?

SearchSave PeopleCode can be associated with SearchSave PeopleCode can be associated with record fields and component search records.record fields and component search records.

SearchSave PeopleCode is executed for all search SearchSave PeopleCode is executed for all search key fields on a search dialog, add dialog, or data key fields on a search dialog, add dialog, or data entry dialog box after the end-user clicks search.entry dialog box after the end-user clicks search.

1919

PeopleCode EventsPeopleCode Events

SearchSaveSearchSave

What is it used for?What is it used for?

The typical use of this feature is to provide cross-field edits The typical use of this feature is to provide cross-field edits for selecting a minimum set of key information.for selecting a minimum set of key information.

It is also used to force user to enter a value in at least one It is also used to force user to enter a value in at least one field, even if it’s a partial value to help narrow a search for field, even if it’s a partial value to help narrow a search for tables with many rows.tables with many rows.

We can use Error and Warning statements in SearchSave We can use Error and Warning statements in SearchSave PeopleCode to send the end-user back to the search dialog PeopleCode to send the end-user back to the search dialog box if the end-user entry doesn’t pass validations box if the end-user entry doesn’t pass validations implemented in the PeopleCode.implemented in the PeopleCode.

2020

PeopleCode EventsPeopleCode Events

SearchSaveSearchSave

RestrictionsRestrictions

SearchSave does not fire when values are SearchSave does not fire when values are selected from the search list.selected from the search list.

This event, and all it’s associated PeopleCode, This event, and all it’s associated PeopleCode, will not fire if run from a component interface.will not fire if run from a component interface.

2121

SearchSave eventSearchSave event

This code displays an error message when the user leaves the employee number field blank

2222

SearchSave eventSearchSave event

Employee number is blank

Error message displayed.

2323

MENU

SearchInit

SearchSave

RowSelect

PreBuild

FieldDefault

FieldFormula

RowInit

PostBuild

Activate

Other Actions

FieldEdit

FieldChange

Popup Menu

NOPrePopup

ItemSelected

YES

RowInsert RowDelete

SaveEdit

SavePrechange

WorkFlow

SavePostChange

Page Displayed andWaits for User

Action

Row Actions?

Insert Delete

Save Action

PeopleCode Event - RowSelect PeopleCode Event - RowSelect EventEvent

2424

PeopleCode EventsPeopleCode Events

RowSelect EventRowSelect Event

The RowSelect event fires at the beginning of The RowSelect event fires at the beginning of the Component Build process in any of the the Component Build process in any of the Update action modes (Update, Update/Display Update action modes (Update, Update/Display All, Correction).All, Correction). RowSelect PeopleCode is used to filter out RowSelect PeopleCode is used to filter out rows of data as they are being read into the rows of data as they are being read into the component buffer.component buffer. This event also occurs after a ScrollSelect or This event also occurs after a ScrollSelect or related function is executed.related function is executed.

2525

PeopleCode EventsPeopleCode Events

RowSelectRowSelect

When is it fired?When is it fired?

The RowSelect event fires at the beginning of the The RowSelect event fires at the beginning of the Component Build process in any of the Update action Component Build process in any of the Update action modes (Update, Update/Display All, Correction).modes (Update, Update/Display All, Correction).

2626

PeopleCode EventsPeopleCode Events

RowSelectRowSelect

Where is it used?Where is it used?

RowSelect PeopleCode is used to filter out rows of RowSelect PeopleCode is used to filter out rows of data as they are being read into the component data as they are being read into the component buffer.buffer.

2727

PeopleCode EventsPeopleCode Events

RowSelectRowSelect

What is it used for?What is it used for? A A DiscardRowDiscardRow function in RowSelect PeopleCode causes function in RowSelect PeopleCode causes

the Component Processor to skip the current row of data the Component Processor to skip the current row of data and continue to process other rows. and continue to process other rows.

A A StopFetchingStopFetching statement causes the Component statement causes the Component Processor to accept the current row of data, then stop Processor to accept the current row of data, then stop reading additional rows. If both statements are executed, reading additional rows. If both statements are executed, the program skips the current row of data, then stops the program skips the current row of data, then stops reading additional rows.reading additional rows.

2828

PeopleCode EventsPeopleCode Events

RowSelectRowSelect

Restrictions Restrictions

In RowSelect PeopleCode, you can refer to record In RowSelect PeopleCode, you can refer to record fields only on the record that is currently being fields only on the record that is currently being processedprocessed

This event, and all it’s associated PeopleCode, will not This event, and all it’s associated PeopleCode, will not fire if run from a Component Interface.fire if run from a Component Interface.

2929

PeopleCode EventsPeopleCode Events

RowSelectRowSelect

Row Select ProcessingRow Select Processing

Row Select processing enables PeopleCode to filter out Row Select processing enables PeopleCode to filter out rows of data after they have been retrieved from the rows of data after they have been retrieved from the database server using a SQL Select statement and before database server using a SQL Select statement and before they are copied to the component buffers. they are copied to the component buffers.

Row Select processing is a subprocess of component build Row Select processing is a subprocess of component build processing in add modes. It also occurs after a ScrollSelect processing in add modes. It also occurs after a ScrollSelect or related function is executed.or related function is executed.

3030

RowSelect EventRowSelect Event

3131

RowSelect EventRowSelect Event

We are selecting the record whoseemployee number = 10020

3232

RowSelect EventRowSelect Event

Record has been displayed

3333

RowSelect EventRowSelect Event

This code discard the rows whose department ID = DEPT1004and the rows are not placed in the buffer

3434

RowSelect EventRowSelect Event

Trying to discard the row whose department Id is DEPT1004 .

Here the Employee Number 10020 is associated with DEPT1004.

3535

RowSelect EventRowSelect Event

Since the row is not placed in the buffer the details regarding the employee ID = 10020 are not displayed

3636

MENU

SearchInit

SearchSave

RowSelect

PreBuild

FieldDefault

FieldFormula

RowInit

PostBuild

Activate

Other Actions

FieldEdit

FieldChange

Popup Menu

NOPrePopup

ItemSelected

YES

RowInsert RowDelete

SaveEdit

SavePrechange

WorkFlow

SavePostChange

Page Displayed andWaits for User

Action

Row Actions?

Insert Delete

Save Action

PeopleCode Event - PreBuild EventPeopleCode Event - PreBuild Event

3737

PeopleCode EventPeopleCode Event

PreBuild EventPreBuild Event

This event is often used to hide or unhide This event is often used to hide or unhide pages. It’s also used to set component pages. It’s also used to set component variables variables

3838

PeopleCode EventPeopleCode Event

PreBuild EventPreBuild Event

When is it fired?When is it fired?

The PreBuild event fires before the rest The PreBuild event fires before the rest of the component build events of the component build events

3939

PeopleCode EventPeopleCode Event

PreBuild EventPreBuild Event

Where is it used?Where is it used?

PreBuild PeopleCode is only associated PreBuild PeopleCode is only associated with components. with components.

4040

PeopleCode EventPeopleCode Event

PreBuild EventPreBuild Event

What is it used for?What is it used for?

The PreBuild event is also used to The PreBuild event is also used to validate data entered in the search validate data entered in the search dialog, after a prompt list is displayed dialog, after a prompt list is displayed

It is used to hide or unhide pages.It is used to hide or unhide pages.

4141

PreBuild EventPreBuild Event

Note that the DeptPage tab is visible which allow the user to navigate to that page

4242

PreBuild EventPreBuild Event

This code hides the department page to the user = VP1

4343

PreBuild EventPreBuild Event

Selecting a record to view the data

4444

PreBuild EventPreBuild Event

The DeptPage Tab is not visible.The Deptpage cannot be viewed by the user whose userid= VP1

4545

MENU

SearchInit

SearchSave

RowSelect

PreBuild

FieldDefault

FieldFormula

RowInit

PostBuild

Activate

Other Actions

FieldEdit

FieldChange

Popup Menu

NOPrePopup

ItemSelected

YES

RowInsert RowDelete

SaveEdit

SavePrechange

WorkFlow

SavePostChange

Page Displayed andWaits for User

Action

Row Actions?

Insert Delete

Save Action

PeopleCode Event - FieldDefault PeopleCode Event - FieldDefault EventEvent

4646

PeopleCode EventsPeopleCode Events

FieldDefault Event FieldDefault Event

The FieldDefault PeopleCode event enables The FieldDefault PeopleCode event enables you to programmatically set default values to you to programmatically set default values to the fields when they are initially displayed.the fields when they are initially displayed.

FieldDefault PeopleCode normally sets fields FieldDefault PeopleCode normally sets fields to default when new data is being added to the to default when new data is being added to the component; that is, in Add mode and when a component; that is, in Add mode and when a new row is inserted into a scroll.new row is inserted into a scroll.

4747

PeopleCode EventsPeopleCode Events

FieldDefaultFieldDefault

When is it fired?When is it fired? This event is fired on all page fields as part of many This event is fired on all page fields as part of many

different processes; however it triggers PeopleCode different processes; however it triggers PeopleCode programs only when the following conditions are all true:programs only when the following conditions are all true:

1. The page field is still blank after applying any 1. The page field is still blank after applying any default specified in the record field properties. (This will default specified in the record field properties. (This will be true if there is no default specified, if a null value is be true if there is no default specified, if a null value is specified, or if a 0 is specified for a numeric field.)specified, or if a 0 is specified for a numeric field.)

2. The field has a FieldDefault PeopleCode program.2. The field has a FieldDefault PeopleCode program.

4848

PeopleCode EventsPeopleCode Events

FieldDefaultFieldDefault

Where is it used?Where is it used?

FieldDefault PeopleCode normally sets fields by default FieldDefault PeopleCode normally sets fields by default when new data is being added to the component; that is, in when new data is being added to the component; that is, in Add mode and when a new row is inserted into a scroll.Add mode and when a new row is inserted into a scroll.

4949

PeopleCode EventsPeopleCode Events

FieldDefaultFieldDefault

What is it used for?What is it used for?

If a field value is changed, whether through PeopleCode or If a field value is changed, whether through PeopleCode or by an end-user, the by an end-user, the IsChangedIsChanged property for the row is set property for the row is set to True. The exception to this is when a change is done in to True. The exception to this is when a change is done in the FieldDefault or FieldFormula events, that is, if a value is the FieldDefault or FieldFormula events, that is, if a value is set in FieldDefault or FieldFormula, the row is not marked set in FieldDefault or FieldFormula, the row is not marked as changedas changed

5050

PeopleCode EventsPeopleCode Events

Advantages of field default:Advantages of field default: Data Entry becomes easy.Data Entry becomes easy. Contains meaningful values in the field rather Contains meaningful values in the field rather

than just leaving the field blankthan just leaving the field blank..

5151

PeopleCode EventsPeopleCode Events

FieldDefaultFieldDefault

RestrictionsRestrictions

An Error or Warning issued from FieldDefault An Error or Warning issued from FieldDefault

PeopleCode will cause a runtimePeopleCode will cause a runtime error and force error and force cancellation of the component.cancellation of the component.

5252

FieldDefault EventFieldDefault Event

This code sets the default value of employee salary field to 25000

5353

FieldDefault EventFieldDefault Event

The default value of employee salary is set to 25000

5454

MENU

SearchInit

SearchSave

RowSelect

PreBuild

FieldDefault

FieldFormula

RowInit

PostBuild

Activate

Other Actions

FieldEdit

FieldChange

Popup Menu

NOPrePopup

ItemSelected

YES

RowInsert RowDelete

SaveEdit

SavePrechange

WorkFlow

SavePostChange

Page Displayed andWaits for User

Action

Row Actions?

Insert Delete

Save Action

PeopleCode Event - FieldFormula PeopleCode Event - FieldFormula EventEvent

5555

PeopleCodePeopleCode EventsEvents

FieldFormula EventFieldFormula Event The FieldFormula event is a vestige of much The FieldFormula event is a vestige of much earlier versions of PeopleTools, and is not used in earlier versions of PeopleTools, and is not used in recent applications, the RowInit and FieldChange recent applications, the RowInit and FieldChange events are used rather than FieldFormula.events are used rather than FieldFormula.

FieldFormula is generally used for any type of FieldFormula is generally used for any type of

CalculationsCalculations. .

5656

PeopleCode EventsPeopleCode Events

FieldFormulaFieldFormula

When is it fired?When is it fired? FieldFormula PeopleCode fires in many different FieldFormula PeopleCode fires in many different

contexts and triggers PeopleCode on every field contexts and triggers PeopleCode on every field on every row in the component buffer, it can on every row in the component buffer, it can seriously degrade the performance of your seriously degrade the performance of your application. application.

5757

PeopleCode EventsPeopleCode Events

FieldFormulaFieldFormula

Where is it used?Where is it used?

As a matter of convention, FieldFormula is now As a matter of convention, FieldFormula is now often used in FUNCLIB_ (function library) record often used in FUNCLIB_ (function library) record definitions to store shared functions.definitions to store shared functions.

5858

PeopleCode EventsPeopleCode Events

FieldFormulaFieldFormula

What is it use for?What is it use for?

FieldFormula is used for basic calculations.FieldFormula is used for basic calculations.

5959

PeopleCode EventsPeopleCode Events

FieldFormulaFieldFormula

RestrictionsRestrictions

Do not use FieldFormula PeopleCode in your Do not use FieldFormula PeopleCode in your components. components.

Use it only to store external PeopleCode functions in Use it only to store external PeopleCode functions in FUNLIB_ record definitions.FUNLIB_ record definitions.

6060

FieldFormula EventFieldFormula Event

Initializing the default value to 25000 in FieldDefault event

When user enters a value less than 25000 it displays an error message

6161

FieldFormula Event FieldFormula Event

Default value is 25000

6262

FieldFormula EventFieldFormula Event

When user tries to enter employee salary less than 25000,An error message is displayed.

6363

MENU

SearchInit

SearchSave

RowSelect

PreBuild

FieldDefault

FieldFormula

RowInit

PostBuild

Activate

Other Actions

FieldEdit

FieldChange

Popup Menu

NOPrePopup

ItemSelected

YES

RowInsert RowDelete

SaveEdit

SavePrechange

WorkFlow

SavePostChange

Page Displayed andWaits for User

Action

Row Actions?

Insert Delete

Save Action

PeopleCode Event - RowInit EventPeopleCode Event - RowInit Event

6464

PeopleCode EventsPeopleCode Events

RowInitRowInit

When it is fired?When it is fired?

The RowInit event fires the first time the The RowInit event fires the first time the component Processor encounters a row of data.component Processor encounters a row of data.

6565

PeopleCode EventsPeopleCode Events

RowInitRowInit

Where is it used?Where is it used? It is used for setting the initial state of Component Controls.It is used for setting the initial state of Component Controls.

RowInit is not field-specific, it triggers on all fields and on all RowInit is not field-specific, it triggers on all fields and on all rows in the component buffer.rows in the component buffer.

This occurs during component build processing and row This occurs during component build processing and row insert processing.insert processing.

It also occurs after a It also occurs after a Select Select or or SelectAll SelectAll Rowset method, Rowset method, or a or a ScrollSelect ScrollSelect or related function is executed.or related function is executed.

6666

PeopleCode EventsPeopleCode Events

RowInitRowInit

What is it used for ?What is it used for ?

The RowInit is used for setting the initial state of The RowInit is used for setting the initial state of component controls.component controls.

The purpose of RowInit PeopleCode is to complete The purpose of RowInit PeopleCode is to complete initialization of data on the row after it has been read initialization of data on the row after it has been read from the database.from the database.

RowInit not getting triggered isn’t considered to be an RowInit not getting triggered isn’t considered to be an errorerror

6767

PeopleCode EventsPeopleCode Events

RowInitRowInitRestrictionsRestrictions

Do not use “ERROR” or “WARNING” statement in RowInit Do not use “ERROR” or “WARNING” statement in RowInit PeopleCode, this causes a runtime error and forces the PeopleCode, this causes a runtime error and forces the end-user to cancel the component.end-user to cancel the component.

Code in FieldChange event would not be executed if Code in FieldChange event would not be executed if The Record is at level 0.The Record is at level 0. Every record field that is present in the data buffer is Every record field that is present in the data buffer is

also present in the keys for the component.also present in the keys for the component. Every record field that is present in the data buffers Every record field that is present in the data buffers

is display only.is display only. RowInit is often paired with FieldChange PeopleCode .RowInit is often paired with FieldChange PeopleCode .

The component processor runs RowInit PeopleCode The component processor runs RowInit PeopleCode when it loads record from the database. However, in when it loads record from the database. However, in some cases, the record can be initialized entirely from some cases, the record can be initialized entirely from the keys for the component. when this happens, RowInit the keys for the component. when this happens, RowInit PeopleCode isn’t executed.PeopleCode isn’t executed.

6868

PeopleCode EventsPeopleCode Events

RowInitRowInit

ExampleExample Suppose you have a field called PRODUCT.Suppose you have a field called PRODUCT. The value of PRODUCT is field A * field B.The value of PRODUCT is field A * field B. When component is initialized or new row is inserted, we When component is initialized or new row is inserted, we

use RowInit PeopleCode to initialize PRODUCT equal to use RowInit PeopleCode to initialize PRODUCT equal to A*B .A*B .

We could then attach FieldChange PeopleCode programs We could then attach FieldChange PeopleCode programs to both A and B which also set PRODUCT equal to A*B.to both A and B which also set PRODUCT equal to A*B.

Whenever end user changes the value of either A or Whenever end user changes the value of either A or B,PRODUCT would be recalculatedB,PRODUCT would be recalculated

6969

RowInit EventRowInit Event

This code is used to generate employee number automatically once the add button is clicked

7070

RowInit EventRowInit Event

The user need not enter the Employee number.It is automatically generated and has been made “display only” , the user cannot change the value.

7171

MENU

SearchInit

SearchSave

RowSelect

PreBuild

FieldDefault

FieldFormula

RowInit

PostBuild

Activate

Other Actions

FieldEdit

FieldChange

Popup Menu

NOPrePopup

ItemSelected

YES

RowInsert RowDelete

SaveEdit

SavePrechange

WorkFlow

SavePostChange

Page Displayed andWaits for User

Action

Row Actions?

Insert Delete

Save Action

PeopleCode Event – PostBuild PeopleCode Event – PostBuild EventEvent

7272

PeopleCode EventsPeopleCode Events

PostBuild EventPostBuild Event The PostBuild event fires only after all the The PostBuild event fires only after all the other other

component build events have been firedcomponent build events have been fired

This event is often used to hide or unhide This event is often used to hide or unhide pages.pages.

It’s also used to set component variablesIt’s also used to set component variables..

7373

PeopleCode EventsPeopleCode Events

PostBuildPostBuild

When is it fired?When is it fired?

The PostBuild event fires after all the other The PostBuild event fires after all the other component build events have fired.component build events have fired.

7474

PeopleCode EventsPeopleCode Events

PostBuildPostBuild

Where is it used?Where is it used?

This event is often used to hide or unhide pages.This event is often used to hide or unhide pages.

7575

PeopleCode EventsPeopleCode Events

PostBuildPostBuild

What is it used for?What is it used for?

It’s also used to set component variables.It’s also used to set component variables.

PostBuild PeopleCode is only associated with components.PostBuild PeopleCode is only associated with components.

7676

PostBuild EventPostBuild Event

This code is for collecting the information of a record – who created the record and when ?

7777

PostBuild EventPostBuild Event

Now we are adding a recordSaving it. After saving the record the required details are captured.

7878

PostBuild EventPostBuild Event

These are the details regarding the record

7979

MENU

SearchInit

SearchSave

RowSelect

PreBuild

FieldDefault

FieldFormula

RowInit

PostBuild

Activate

Other Actions

FieldEdit

FieldChange

Popup Menu

NOPrePopup

ItemSelected

YES

RowInsert RowDelete

SaveEdit

SavePrechange

WorkFlow

SavePostChange

Page Displayed andWaits for User

Action

Row Actions?

Insert Delete

Save Action

PeopleCode Event – Activate PeopleCode Event – Activate EventEvent

8080

PeopleCode EventPeopleCode Event

Activate EventActivate Event

Activate event is to segregate the PeopleCode Activate event is to segregate the PeopleCode that is related to a specific page from the rest that is related to a specific page from the rest of the application’s PeopleCode. of the application’s PeopleCode.

Each page has its own Activate eventEach page has its own Activate event. .

8181

PeopleCode EventPeopleCode Event

Activate EventActivate Event

When it is fired?When it is fired?

The Activate event is fired each time the page The Activate event is fired each time the page gets activated.gets activated.

8282

PeopleCode EventPeopleCode Event

Activate EventActivate Event

Where is it used?Where is it used?

Activate PeopleCode can only be associated Activate PeopleCode can only be associated with pages.with pages.

The Activate event triggers any Activate The Activate event triggers any Activate PeopleCode associated with the page PeopleCode associated with the page processing. processing.

8383

PeopleCode EventPeopleCode Event

Activate EventActivate Event

What is it used for?What is it used for?

The event used for security validation: such as, The event used for security validation: such as, enabling a field or hiding a scroll , enabling enabling a field or hiding a scroll , enabling user to programmatically control the display of user to programmatically control the display of that page controls. that page controls.

This event is used for component Build This event is used for component Build Processing – Add Mode and Update ModeProcessing – Add Mode and Update Mode

8484

PeopleCode EventPeopleCode Event

Activate EventActivate Event

RestrictionRestriction

This event is valid only for pages that are This event is valid only for pages that are defined as “Standard” or “Secondary”. This defined as “Standard” or “Secondary”. This event is not supported for “Subpages” event is not supported for “Subpages”

8585

Activate EventActivate Event

The user is allowed to see the Department page as Display Only

8686

Activate EventActivate Event

The fields are display only

8787

MENU

SearchInit

SearchSave

RowSelect

PreBuild

FieldDefault

FieldFormula

RowInit

PostBuild

Activate

Other Actions

FieldEdit

FieldChange

Popup Menu

NOPrePopup

ItemSelected

YES

RowInsert RowDelete

SaveEdit

SavePrechange

WorkFlow

SavePostChange

Page Displayed andWaits for User

Action

Row Actions?

Insert Delete

Save Action

PeopleCode Event – FieldEdit PeopleCode Event – FieldEdit EventEvent

8888

PeopleCode EventsPeopleCode Events

FieldEditFieldEdit

When is it fired?When is it fired?

The FieldEdit event fires on the specific field and The FieldEdit event fires on the specific field and row that has just changed.row that has just changed.

8989

PeopleCode EventsPeopleCode Events

FieldEditFieldEdit

Where it is used?Where it is used?

FieldEdit PeopleCode can be associated with FieldEdit PeopleCode can be associated with record fields and component record fieldsrecord fields and component record fields..

FieldEdit PeopleCode is used to validate the FieldEdit PeopleCode is used to validate the contents of a field, supplementing the standard contents of a field, supplementing the standard system editssystem edits..

9090

PeopleCode EventsPeopleCode Events

FieldEditFieldEdit

What is it used for?What is it used for?

If the data does not pass the validation, the If the data does not pass the validation, the PeopleCode program should display a message PeopleCode program should display a message using the using the ErrorError statement, which redisplays the statement, which redisplays the page, displaying an error message and turning the page, displaying an error message and turning the field red.field red.

If you want to execute the field edit, but just want If you want to execute the field edit, but just want to alert the end-user to possible problem, use a to alert the end-user to possible problem, use a warning warning statement instead of statement instead of ERRORERROR..

9191

PeopleCode EventsPeopleCode Events

FieldEditFieldEdit

Restrictions Restrictions

If the validation must check the contents of more If the validation must check the contents of more than one field, that is, if the validation is checking than one field, that is, if the validation is checking for consistency across page fields, then SaveEdit for consistency across page fields, then SaveEdit PeopleCode can be used instead of FieldEdit.PeopleCode can be used instead of FieldEdit.

9292

FieldEdit EventFieldEdit Event

This code is to check whether the Employee name is a valid one or not .The name should not contain numbers or any special characters Other than white space.

9393

FieldEdit EventFieldEdit Event

User is entering some special character in the Employee name field

When the user tries to select the Department ID, a win message will be displayed.

9494

FieldEdit EventFieldEdit Event

Message Box has been displayed

If the user clicks the “ok” button, the Emppage will be displayed, allowing the user to edit the name field.

9595

FieldEdit EventFieldEdit Event

This is peopleSoft generated warning , explaining that name field is not valid. Just click ok button to edit the name field.

9696

FieldEdit EventFieldEdit Event

Here the user is allowed to edit the name field.

9797

FieldEdit EventFieldEdit Event

Now the user is allowed to select the Department Id.

9898

MENU

SearchInit

SearchSave

RowSelect

PreBuild

FieldDefault

FieldFormula

RowInit

PostBuild

Activate

Other Actions

FieldEdit

FieldChange

Popup Menu

NOPrePopup

ItemSelected

YES

RowInsert RowDelete

SaveEdit

SavePrechange

WorkFlow

SavePostChange

Page Displayed andWaits for User

Action

Row Actions?

Insert Delete

Save Action

PeopleCode Event – FieldChange PeopleCode Event – FieldChange EventEvent

9999

PeopleCode EventsPeopleCode Events

FieldChangeFieldChange

When is it fired?When is it fired?

FieldChange PeopleCode can be associated with FieldChange PeopleCode can be associated with

record fields and component record fieldsrecord fields and component record fields The FieldChange event fires on the specific field The FieldChange event fires on the specific field

and row that has just changedand row that has just changed

100100

PeopleCode EventsPeopleCode Events

FieldChangeFieldChange

Where is it used?Where is it used?

FieldChange PeopleCode is used to FieldChange PeopleCode is used to Recalculate field values.Recalculate field values. To change the appearance of page To change the appearance of page

controls.controls. To Process the result from FieldChange To Process the result from FieldChange

other than the data validations.other than the data validations.

101101

PeopleCode EventsPeopleCode Events

FieldChangeFieldChange

What is it used for?What is it used for? FieldChange PeopleCode is often paired with FieldChange PeopleCode is often paired with

RowInit PeopleCode.RowInit PeopleCode. In RowInit / FieldChange, the RowInit PeopleCode In RowInit / FieldChange, the RowInit PeopleCode

check the values in the component and initializes check the values in the component and initializes the state or value of page controls accordingly.the state or value of page controls accordingly.

FieldChange PeopleCode then rechecks the FieldChange PeopleCode then rechecks the values in the component during execution and values in the component during execution and resets the state or value of the page controls0resets the state or value of the page controls0..

102102

PeopleCode EventsPeopleCode Events

FieldChangeFieldChange

RestrictionsRestrictions It is not recommended to have It is not recommended to have ErrorError or or WarningWarning

statement in FieldChange PeopleCode. It is statement in FieldChange PeopleCode. It is suggested that all data validation should be suggested that all data validation should be performed in FieldEdit performed in FieldEdit

103103

PeopleCode EventsPeopleCode Events

FieldChange eventFieldChange eventExampleExample

Suppose you have a field called PRODUCT.Suppose you have a field called PRODUCT. The value of PRODUCT is field A * field B.The value of PRODUCT is field A * field B. When component is initialized or new row is When component is initialized or new row is

inserted, user uses the RowInit PeopleCode to inserted, user uses the RowInit PeopleCode to initialize PRODUCT equal to A*B .initialize PRODUCT equal to A*B .

User could then attach FieldChange User could then attach FieldChange PeopleCode programs to both A and B which PeopleCode programs to both A and B which also set PRODUCT equal to A*B.also set PRODUCT equal to A*B.

When ever user changes the value of either A When ever user changes the value of either A or B, PRODUCT would be recalculated.or B, PRODUCT would be recalculated.

104104

FieldChange EventFieldChange Event

This code automatically places the Employee name once Employee number is selected.

105105

FieldChange EventFieldChange Event

Select the employee number

106106

FieldChange EventFieldChange Event

Employee name will be displayed automatically once the Employee number is selected.

107107

MENU

SearchInit

SearchSave

RowSelect

PreBuild

FieldDefault

FieldFormula

RowInit

PostBuild

Activate

Other Actions

FieldEdit

FieldChange

Popup Menu

NOPrePopup

ItemSelected

YES

RowInsert RowDelete

SaveEdit

SavePrechange

WorkFlow

SavePostChange

Page Displayed andWaits for User

Action

Row Actions?

Insert Delete

Save Action

PeopleCode Event – PrePopup PeopleCode Event – PrePopup EventEvent

108108

PeopleCode EventPeopleCode Event

PrePopup EventPrePopup Event

The PrePopup PeopleCode event enables The PrePopup PeopleCode event enables you to disable, check, or hide menu you to disable, check, or hide menu items in the pop-up.items in the pop-up.

109109

PeopleCode EventPeopleCode Event

PrePopup EventPrePopup Event

When is it fired?When is it fired?

The PrePopup event fires just before the The PrePopup event fires just before the display of a pop-up menu.display of a pop-up menu.

110110

PeopleCode EventPeopleCode Event

PrePopup EventPrePopup Event

Where is it used?Where is it used? PrePopup PeopleCode can be associated with PrePopup PeopleCode can be associated with

record fields and component record fields .record fields and component record fields .

PrePopup PeopleCode menu item operations PrePopup PeopleCode menu item operations (such as HideMenuItem, EnableMenuItem, and (such as HideMenuItem, EnableMenuItem, and so on) work with pop-up menus attached to a so on) work with pop-up menus attached to a grid, not a field in a gridgrid, not a field in a grid

111111

PeopleCode EventPeopleCode Event

PrePopup EventPrePopup Event

What is it used for?What is it used for?

The PrePopup PeopleCode is used to control The PrePopup PeopleCode is used to control the appearance of the Pop-up menu items.the appearance of the Pop-up menu items.

112112

PeopleCode EventPeopleCode Event

PrePopup EventPrePopup Event PrePopup ProcessingPrePopup Processing

113113

PrePopup EventPrePopup Event

Three Menu Item Displayed before the Event triggers.

114114

PrePopup EventPrePopup Event

This code is used to hide the menu item “SAL” at the Run-Time.

115115

PrePopup EventPrePopup Event

Pop-Up Menu Icon

116116

PrePopup EventPrePopup Event

Selected Menu-Item is hidden

117117

MENU

SearchInit

SearchSave

RowSelect

PreBuild

FieldDefault

FieldFormula

RowInit

PostBuild

Activate

Other Actions

FieldEdit

FieldChange

Popup Menu

NOPrePopup

ItemSelected

YES

RowInsert RowDelete

SaveEdit

SavePrechange

WorkFlow

SavePostChange

Page Displayed andWaits for User

Action

Row Actions?

Insert Delete

Save Action

PeopleCode Event – ItemSelected PeopleCode Event – ItemSelected EventEvent

118118

PeopleCode EventsPeopleCode Events

ItemSelect EventItemSelect Event The ItemSelected event fires whenever The ItemSelected event fires whenever the end-user selects a menu item from a the end-user selects a menu item from a pop-up menu.pop-up menu.

In pop-up menus ItemSelected In pop-up menus ItemSelected PeopleCode executes in the context of the PeopleCode executes in the context of the page field from where the pop-up menu is page field from where the pop-up menu is attached, which means that you can freely attached, which means that you can freely reference and change page fields, just as reference and change page fields, just as you could from a pushbutton.you could from a pushbutton.

119119

PeopleCodePeopleCode Events Events

ItemSelectItemSelect

When is it fired?When is it fired?

The ItemSelected event fires whenever the end-The ItemSelected event fires whenever the end-user selects a menu item from a pop-up menu.user selects a menu item from a pop-up menu.

120120

PeopleCode EventsPeopleCode Events

ItemSelectItemSelect

Where is it used?Where is it used?

In pop-up menus ItemSelected PeopleCode In pop-up menus ItemSelected PeopleCode executes in the context of the page field from executes in the context of the page field from where the pop-up menu is attached, which means where the pop-up menu is attached, which means that you can freely reference and change page that you can freely reference and change page fields, just as you could from a pushbutton.fields, just as you could from a pushbutton.

121121

PeopleCode EventsPeopleCode Events

ItemSelectItemSelect

What is it used for?What is it used for?

ItemSelected PeopleCode is only associated with ItemSelected PeopleCode is only associated with pop-up menu items.pop-up menu items.

122122

PeopleCode EventsPeopleCode Events

ItemSelectItemSelect

RestrictionsRestrictions

This event, and all it’s associated PeopleCode, This event, and all it’s associated PeopleCode, does not fire if run from a Component Interface.does not fire if run from a Component Interface.

123123

ItemSelected Processing ItemSelected Processing

ItemSelected processing occurs when a end-user selects a ItemSelected processing occurs when a end-user selects a menu item from a pop-up menu. This fires the ItemSelected menu item from a pop-up menu. This fires the ItemSelected

PeopleCode event, which is a menu PeopleCode event.PeopleCode event, which is a menu PeopleCode event.

124124

ItemSelect EventItemSelect Event

This code is used to transfer to a new page by selecting the Menu Item.

125125

ItemSelect EventItemSelect Event

Popup Menu Icon.

126126

ItemSelect EventItemSelect Event

Menu Items

127127

ItemSelect EventItemSelect Event

Transferred to Emppage from Empsal

128128

MENU

SearchInit

SearchSave

RowSelect

PreBuild

FieldDefault

FieldFormula

RowInit

PostBuild

Activate

Other Actions

FieldEdit

FieldChange

Popup Menu

NOPrePopup

ItemSelected

YES

RowInsert RowDelete

SaveEdit

SavePrechange

WorkFlow

SavePostChange

Page Displayed andWaits for User

Action

Row Actions?

Insert Delete

Save Action

PeopleCode Event – RowInsert PeopleCode Event – RowInsert EventEvent

129129

PeopleCode EventsPeopleCode Events

RowInsertRowInsert

When is it fired?When is it fired?

The RowInsert triggers PeopleCode on any field The RowInsert triggers PeopleCode on any field on the inserted row of data.on the inserted row of data.

130130

PeopleCode EventsPeopleCode Events

RowInsertRowInsert

Where is it used?Where is it used?

RowInsert PeopleCode can be associated with RowInsert PeopleCode can be associated with record fields and component records.record fields and component records.

RowInsert PeopleCode is used for processing RowInsert PeopleCode is used for processing newly inserted rows.newly inserted rows.

131131

PeopleCode EventsPeopleCode Events

RowInsertRowInsert

What is it used for?What is it used for?

By selecting the “No Row Insert” check box in By selecting the “No Row Insert” check box in the scroll bar’s “page field properties”, the the scroll bar’s “page field properties”, the user is prevented from inserting rows into a user is prevented from inserting rows into a scroll area.scroll area.

However user cannot be prevented However user cannot be prevented conditionally from inserting new rows.conditionally from inserting new rows.

132132

PeopleCode EventsPeopleCode Events

RowInsertRowInsert

RestrictionsRestrictions

Do not put PeopleCode in RowInsert that already Do not put PeopleCode in RowInsert that already exists in RowInit, because RowInit event always exists in RowInit, because RowInit event always fires after the RowInsert event, which will cause fires after the RowInsert event, which will cause your code to be run twice.your code to be run twice.

Do not use a warning or Error in RowInsert, this Do not use a warning or Error in RowInsert, this will cause a runtime error and force cancellation will cause a runtime error and force cancellation of the component.of the component.

133133

RowInsert EventRowInsert Event

This code auto generatesthe serial number when a New record is added.

134134

RowInsert EventRowInsert Event

The function defined in the previous slide is called here as a function call.

135135

RowInsert EventRowInsert Event

The serial number is generated

136136

MENU

SearchInit

SearchSave

RowSelect

PreBuild

FieldDefault

FieldFormula

RowInit

PostBuild

Activate

Other Actions

FieldEdit

FieldChange

Popup Menu

NOPrePopup

ItemSelected

YES

RowInsert RowDelete

SaveEdit

SavePrechange

WorkFlow

SavePostChange

Page Displayed andWaits for User

Action

Row Actions?

Insert Delete

Save Action

PeopleCode Event – RowDelete PeopleCode Event – RowDelete EventEvent

137137

PeopleCode EventPeopleCode Event

RowDelete EventRowDelete Event

The RowDelete event fires whenever an end-The RowDelete event fires whenever an end-user attempts to delete a row of data from a user attempts to delete a row of data from a page scrollpage scroll

The RowDelete event triggers PeopleCode on The RowDelete event triggers PeopleCode on any field on the row of data that is being any field on the row of data that is being

flagged as deletedflagged as deleted

138138

PeopleCode EventPeopleCode Event

RowDelete EventRowDelete Event

When is it fired?When is it fired?

Row Delete processing occurs when:Row Delete processing occurs when: The end-user requests a row delete in a scroll The end-user requests a row delete in a scroll

by pressing ALT+F 8 then pressing ENTER, by pressing ALT+F 8 then pressing ENTER, clicking the Delete Row button, or clicking the clicking the Delete Row button, or clicking the Delete button.Delete button.

A PeopleCode A PeopleCode RowDeleteRowDelete function or a function or a DeleteRow DeleteRow method requests a row delete.method requests a row delete.

139139

PeopleCode EventPeopleCode Event

RowDelete EventRowDelete Event

Where is it used?Where is it used?

RowDelete PeopleCode is used to prevent the RowDelete PeopleCode is used to prevent the deletion of a row (using an deletion of a row (using an ErrorError or or WarningWarning statement) or to perform any other processing statement) or to perform any other processing contingent on row deletion. contingent on row deletion.

140140

PeopleCode EventPeopleCode Event

RowDelete EventRowDelete Event

What is it used for?What is it used for?

When the RowDelete Event get triggered, the When the RowDelete Event get triggered, the PeopleCode in the event is get executed PeopleCode in the event is get executed

RowDelete PeopleCode enables you to check RowDelete PeopleCode enables you to check for conditions and control whether the end-for conditions and control whether the end-user can delete the rowuser can delete the row

141141

PeopleCode EventPeopleCode Event

Restrictions:Restrictions:

RowDelete does not trigger programs on RowDelete does not trigger programs on Derived/Work recordsDerived/Work records

142142

PeopleCode EventPeopleCode Event

RowDelete Event ProcessingRowDelete Event ProcessingThe Component Processor:The Component Processor: Fires the RowDelete PeopleCode event, which triggers Fires the RowDelete PeopleCode event, which triggers

RowDelete PeopleCode associated with the record field or RowDelete PeopleCode associated with the record field or the component record. This event processes fields on the the component record. This event processes fields on the deleted row and any dependent child scrolls. deleted row and any dependent child scrolls.

An An ErrorError statement displays a message and statement displays a message and prevents the end-user from deleting the row. prevents the end-user from deleting the row.

A A WarningWarning statement displays a message alerting statement displays a message alerting the end-user about possible consequences of the the end-user about possible consequences of the deletion, but permits deletion of the row. deletion, but permits deletion of the row.

143143

PeopleCode EventPeopleCode Event

RowDelete EventRowDelete EventLogic of row delete processingLogic of row delete processing

144144

PeopleCode EventPeopleCode Event

RowDelete EventRowDelete EventErrors and Warnings in RowDeleteErrors and Warnings in RowDelete

When you delete a row of data (F 8), the system When you delete a row of data (F 8), the system prompts you to confirm. If you do confirm, prompts you to confirm. If you do confirm, RowDelete PeopleCode takes place, Errors and RowDelete PeopleCode takes place, Errors and warnings in RowDelete display a message box. warnings in RowDelete display a message box.

A warning from RowDelete presents two A warning from RowDelete presents two choices–accept the RowDelete (the OK choices–accept the RowDelete (the OK pushbutton), or cancel the RowDelete (the pushbutton), or cancel the RowDelete (the Cancel pushbutton). Cancel pushbutton).

An error from RowDelete PeopleCode prevents An error from RowDelete PeopleCode prevents the Component Processor from removing that the Component Processor from removing that row of data from the page.row of data from the page.

145145

RowDelete EventRowDelete Event

The record with employee number 10050 has been stored with theSerial number 2

146146

RowDelete EventRowDelete Event

when a record is deleted ,this code automatically re-numbers the serial number of a remaining Records in sequence.

147147

RowDelete EventRowDelete Event

148148

RowDelete EventRowDelete Event

The delete action will occur when the transaction get saved

149149

RowDelete EventRowDelete Event

Now the records are renumbered in a sequence

150150

MENU

SearchInit

SearchSave

RowSelect

PreBuild

FieldDefault

FieldFormula

RowInit

PostBuild

Activate

Other Actions

FieldEdit

FieldChange

Popup Menu

NOPrePopup

ItemSelected

YES

RowInsert RowDelete

SaveEdit

SavePrechange

WorkFlow

SavePostChange

Page Displayed andWaits for User

Action

Row Actions?

Insert Delete

Save Action

PeopleCode Event – SaveEdit PeopleCode Event – SaveEdit EventEvent

151151

PeopleCode EventPeopleCode Event

SaveEdit EventSaveEdit Event

The SaveEdit event fires whenever the end-The SaveEdit event fires whenever the end-user attempts to save the component. user attempts to save the component.

SaveEdit is not field-specific: it triggers SaveEdit is not field-specific: it triggers associated PeopleCode on every row of data in associated PeopleCode on every row of data in the component buffers, except rows flagged as the component buffers, except rows flagged as deleted.deleted.

152152

PeopleCode EventPeopleCode Event

SaveEdit EventSaveEdit Event

When is it fired?When is it fired?SaveEdit Event gets Fired whenSaveEdit Event gets Fired when

The user directs the system to save a The user directs the system to save a component by clicking Save or by pressing component by clicking Save or by pressing ALT+F1, then ENTER. ALT+F1, then ENTER.

PeopleSoft also prompts the end-user to PeopleSoft also prompts the end-user to save a component when the Next or List save a component when the Next or List button is selected, or when a new action or button is selected, or when a new action or component is selected. component is selected.

153153

PeopleCode EventPeopleCode Event

SaveEdit EventSaveEdit Event

Where is it used?Where is it used?

You can use SaveEdit PeopleCode to validate You can use SaveEdit PeopleCode to validate the consistency of data in component fields.the consistency of data in component fields.

Whenever a validation involves more than one Whenever a validation involves more than one component field, you should use SaveEdit component field, you should use SaveEdit PeopleCode. PeopleCode.

154154

PeopleCode EventPeopleCode Event

SaveEdit EventSaveEdit Event

What is it used for?What is it used for?

When the SaveEdit Event gets fired, the When the SaveEdit Event gets fired, the PeopleCode in the event is get executed .PeopleCode in the event is get executed .

This enables you to cross-validate the page This enables you to cross-validate the page fields before saving, checking consistency fields before saving, checking consistency among the page field values.among the page field values.

155155

PeopleCode EventPeopleCode Event

SaveEdit Event ProcessingSaveEdit Event Processing

The Component ProcessorThe Component Processor

Fires the SaveEdit PeopleCode event, which Fires the SaveEdit PeopleCode event, which triggers any SaveEdit PeopleCode associated triggers any SaveEdit PeopleCode associated with a record field or a component record. with a record field or a component record.

An An ErrorError statement in SaveEdit PeopleCode displays a statement in SaveEdit PeopleCode displays a message and then redisplays the page, stopping the message and then redisplays the page, stopping the save. save.

A A WarningWarning statement enables the end-user to cancel statement enables the end-user to cancel save processing by clicking save processing by clicking CancelCancel, or continue with , or continue with save processing by clicking OK.save processing by clicking OK.

156156

PeopleCode EventPeopleCode Event

This code displays an error message when the user tries to add the record without entering the employee name.

157157

SaveEdit EventSaveEdit Event

This is how we can add a record.

158158

SaveEdit EventSaveEdit Event

User is trying to save the record without entering the employee name.

159159

MENU

SearchInit

SearchSave

RowSelect

PreBuild

FieldDefault

FieldFormula

RowInit

PostBuild

Activate

Other Actions

FieldEdit

FieldChange

Popup Menu

NOPrePopup

ItemSelected

YES

RowInsert RowDelete

SaveEdit

SavePrechange

WorkFlow

SavePostChange

Page Displayed andWaits for User

Action

Row Actions?

Insert Delete

Save Action

PeopleCode Event – SavePreChange PeopleCode Event – SavePreChange EventEvent

160160

PeopleCode EventPeopleCode Event

Save Prechange EventSave Prechange Event

SavePreChange PeopleCode provides one final SavePreChange PeopleCode provides one final opportunity to manipulate data before the opportunity to manipulate data before the system updates the database system updates the database

SavePreChange PeopleCode can be associated SavePreChange PeopleCode can be associated with record fields, components, and with record fields, components, and component records.component records.

161161

PeopleCode EventPeopleCode Event

SavePreChange EventSavePreChange Event

When is it fired?When is it fired?

The SavePreChange event fires after SaveEdit The SavePreChange event fires after SaveEdit completes without errors.completes without errors.

162162

PeopleCode EventPeopleCode Event

SavePreChange EventSavePreChange EventWhere is it used?Where is it used?

SavePreChange PeopleCode can be SavePreChange PeopleCode can be associated with record fields, associated with record fields, components, and component records.components, and component records.

SavePreChange PeopleCode is not field-SavePreChange PeopleCode is not field-specific: it triggers PeopleCode on all specific: it triggers PeopleCode on all fields and on all rows of data in the fields and on all rows of data in the component buffer.component buffer.

163163

PeopleCode EventPeopleCode Event

SavePreChange EventSavePreChange Event

What is it used for?What is it used for?

SavePreChange PeopleCode enables you to SavePreChange PeopleCode enables you to process data after validation and before the process data after validation and before the database is updated.database is updated.

164164

SavePreChange EventSavePreChange Event

SQL CommitSQL Commit

165165

SavePreChange EventSavePreChange Event

This code is to capture the details like who modified the record and when was it modified

166166

SavePreChange EventSavePreChange Event

This record has been modified.The required details can be obtained by Opening the secondary page

Push Button to open the Secondary page

167167

SavePreChange EventSavePreChange Event

The details like who and when the record was modified

168168

MENU

SearchInit

SearchSave

RowSelect

PreBuild

FieldDefault

FieldFormula

RowInit

PostBuild

Activate

Other Actions

FieldEdit

FieldChange

Popup Menu

NOPrePopup

ItemSelected

YES

RowInsert RowDelete

SaveEdit

SavePrechange

WorkFlow

SavePostChange

Page Displayed andWaits for User

Action

Row Actions?

Insert Delete

Save Action

PeopleCode Event – PostBuild PeopleCode Event – PostBuild EventEvent

169169

PeopleCode EventPeopleCode Event

Workflow EventWorkflow Event

The main purpose of the Workflow event is to The main purpose of the Workflow event is to segregate PeopleCode related to Workflow segregate PeopleCode related to Workflow from the rest of the application’s PeopleCodefrom the rest of the application’s PeopleCode

Workflow PeopleCode executes immediately Workflow PeopleCode executes immediately after SavePreChange and before the database after SavePreChange and before the database update that precedes SavePostChangeupdate that precedes SavePostChange

170170

PeopleCode EventPeopleCode Event

Workflow EventWorkflow Event

When is it fired?When is it fired?

Workflow PeopleCode executes immediately Workflow PeopleCode executes immediately after SavePreChange and before the after SavePreChange and before the database update that precedes database update that precedes SavePostChange. SavePostChange.

The program should deal with Workflow only The program should deal with Workflow only after any SavePreChange processing is after any SavePreChange processing is complete. complete.

171171

PeopleCode EventPeopleCode Event

Workflow EventWorkflow Event

Where is it used?Where is it used?

Workflow PeopleCode can be associated Workflow PeopleCode can be associated with record fields and components with record fields and components

Workflow PeopleCode is not field-specific: it Workflow PeopleCode is not field-specific: it triggers PeopleCode on all fields and on all triggers PeopleCode on all fields and on all rows of data in the component buffer.rows of data in the component buffer.

172172

PeopleCode EventPeopleCode Event

Workflow eventWorkflow event

What is it used for?What is it used for?

The Workflow event, triggers any Workflow The Workflow event, triggers any Workflow PeopleCode associated with a record field or a PeopleCode associated with a record field or a component. component.

Workflow PeopleCode should be used only for Workflow PeopleCode should be used only for workflow-related processing workflow-related processing

Updates the database with the changed component Updates the database with the changed component data, performing any necessary SQL Inserts, Updates, data, performing any necessary SQL Inserts, Updates, and Deletes.and Deletes.

173173

WorkFlow EventWorkFlow Event

This code is to trigger the particular event in the activity.This code is to trigger the particular event in the activity.This code is to trigger the particular event in the activity.

174174

Adding a New Department

Adding Department Name

Save it.

WorkFlow EventWorkFlow Event

175175

Click on the Worklist tab

WorkFlow EventWorkFlow Event

176176

The added department name has been displayed in the worklist

WorkFlow EventWorkFlow Event

177177

MENU

SearchInit

SearchSave

RowSelect

PreBuild

FieldDefault

FieldFormula

RowInit

PostBuild

Activate

Other Actions

FieldEdit

FieldChange

Popup Menu

NOPrePopup

ItemSelected

YES

RowInsert RowDelete

SaveEdit

SavePrechange

WorkFlow

SavePostChange

Page Displayed andWaits for User

Action

Row Actions?

Insert Delete

Save Action

PeopleCode Event – SavePostChange PeopleCode Event – SavePostChange EventEvent

178178

PeopleCode EventPeopleCode Event

SavePostChange EventSavePostChange Event

After the Component Processor updates the After the Component Processor updates the database, it fires the SavePostChange event database, it fires the SavePostChange event

The system issues a SQL Commit after The system issues a SQL Commit after SavePostChange PeopleCode completes SavePostChange PeopleCode completes successfully.successfully.

179179

PeopleCode EventPeopleCode Event

SavePostChange EventSavePostChange Event

When is it fired?When is it fired?

The SavePostChange Event is fired after the The SavePostChange Event is fired after the Workflow Event is executed successfully.Workflow Event is executed successfully.

SavePostChange PeopleCode is not field-SavePostChange PeopleCode is not field-specific: It triggers PeopleCode on all fields specific: It triggers PeopleCode on all fields and on all rows of data in the component and on all rows of data in the component bufferbuffer

180180

PeopleCode EventPeopleCode Event

SavePostChange EventSavePostChange Event

Where is it used?Where is it used?

SavePostChange PeopleCode can be SavePostChange PeopleCode can be associated with record fields, components, associated with record fields, components, and component records.and component records.

SavePostChange PeopleCode is used to SavePostChange PeopleCode is used to update tables which are not in user update tables which are not in user component with the help of SQLExec built-in component with the help of SQLExec built-in functions.functions.

181181

PeopleCode EventPeopleCode Event

SavePostChange EventSavePostChange Event

What is it used for?What is it used for?

The SavePostChange event, triggers any The SavePostChange event, triggers any Workflow PeopleCode associated with a record Workflow PeopleCode associated with a record field or a component.field or a component.

SavePostChange PeopleCode is for processing SavePostChange PeopleCode is for processing

that must occur after the database update, such that must occur after the database update, such as updates to other database tables not in the as updates to other database tables not in the component buffer.component buffer.

182182

PeopleCode EventPeopleCode Event

SavePostChange EventSavePostChange Event

RestrictionRestriction An An ErrorError or or WarningWarning in SavePostChange in SavePostChange

PeopleCode causes a runtime error, forcing the end-PeopleCode causes a runtime error, forcing the end-user to cancel the component without saving user to cancel the component without saving changes. Avoid changes. Avoid ErrorsErrors and and WarningsWarnings in this event. in this event.

Never issue a SQL Commit or a Rollback manually Never issue a SQL Commit or a Rollback manually from within a from within a SQLExecSQLExec function. Let the Component function. Let the Component Processor issue these SQL commands.Processor issue these SQL commands.

183183

SavePostChange EventSavePostChange Event

To see the value in the salary field before the Save Post change event fires.

184184

SavePostChange EventSavePostChange Event

Note that the value in employee salary is 15000.

185185

SavePostChange EventSavePostChange Event

PeopleCode to update the employee salary of a particular record.

186186

SavePostChange EventSavePostChange Event

Now note that the employee salary is updated to 10000 from 15000.