1. Difference between Field Edit and
Field Default?
Field
Change peoplecode is for recalculating field values based on changes
made to other fields
Case1: suppose u have 2 fields one is rate and other is
quantity and there is another field which shows the total
cost so whenever a value is changed in any of the
above 2 field (rate and quantity) the total cost will also change so on field change event of these 2 fields u can
write code to calculate the total cost
Field edit event is used for validating field
values if the field doesn’t pass the validation an error message is displayed
and the page is displayed with the field marked in
red
Case
2: the quantity should not
exceed 1000 if it does the system should display an
error
so u can write a peoplecode for that which will
check the quantity if it is greater than 1000 error message will be
displayed
2. Difference b/w Save Prechange and Save
Postchange
In theory, SavePreChange is triggered
just before the component buffer data is updated to database, so this is the
last event in which you can manipulate component buffer data inorder to get
updated in database.
The SavePreChange event is initiated after
SaveEdit completes without errors.
·
SavePreChange PeopleCode provides one final
opportunity to manipulate data before the system updates the database; for
instance, you could use SavePreChange PeopleCode to set sequential high-level
keys
·
If SavePreChange runs successfully, a
Workflow event is generated, and then the Component Processor issues
appropriate Insert, Update, or Delete SQL statements.
·
An Error statement in SaveEdit PeopleCode
displays a message and redisplays the component without saving data. A Warning
statement enables the user to click OK and save the data, or to click Cancel
and return to the component without saving.
·
Used to change display characteristics and
validations
·
SavePreChange PeopleCode can be associated
with record fields, components, and component records.
After the Component Processor updates the
database, it initiates the SavePostChange event. You can use SavePostChange
PeopleCode to update tables not in your component using the SQLExec built-in
function.
·
Performs after SavePreChange and Workflow
have completed successfully. SavePostChange is not executed if workflow fails
or component is not saved due to any error.
·
Do not use Error and Warnings in this event
·
The system issues a SQL Commit statement
after SavePostChange PeopleCode completes successfully.
·
Other than updating tables that are not in
your component, it is also used to send an email, say for approval.
·
SavePostChange PeopleCode can be associated
with record fields, components, and component records.
Let’s take Personal Data component in HR
as an example, when you add a new person Person ID would be NEW, so before the
data is updated to database we want the Person ID to be generated and assigned
to EMPLID field. So this is done in SavePreChange.
Now once the data is updated to database we want this data to be sent to other PeopleSoft applications like CRM, ELM etc., for this we need to trigger the Asynchronous service operation. Since this need to be triggered only after the component data is updated to database (after all validations) we would use SavePostChange to trigger it.
Now once the data is updated to database we want this data to be sent to other PeopleSoft applications like CRM, ELM etc., for this we need to trigger the Asynchronous service operation. Since this need to be triggered only after the component data is updated to database (after all validations) we would use SavePostChange to trigger it.
Case2
The difference is more into functional
than technical. You can write sql to
update other tables in both SAVE PRE change & POST change it will work. But
if you write to update other table in pre change depends on status of
current component, you may get wrong data.
Because the component can fail at any time after pre change.
For example you want to update location of employee to other table each
time a transfer happened, for this if you write sql in save pre change, the
new location will be updated in other table first, then an
error happened in post change so system will roll back the changes
in original component
and will have the old location only But your table saving location already
got updated & will have new location. But if you write in save post change
it will update only when original component saved successfully.
update other tables in both SAVE PRE change & POST change it will work. But
if you write to update other table in pre change depends on status of
current component, you may get wrong data.
Because the component can fail at any time after pre change.
For example you want to update location of employee to other table each
time a transfer happened, for this if you write sql in save pre change, the
new location will be updated in other table first, then an
error happened in post change so system will roll back the changes
in original component
and will have the old location only But your table saving location already
got updated & will have new location. But if you write in save post change
it will update only when original component saved successfully.
No comments:
Post a Comment