Search This Blog

How to write an efficient PeopleCode?

Reduce Server Trips

Accessing the sever in between the field navigations causes sever performance issues and it is imperative to manage these trips to make a better coded application.

What happens in a server trip? 
  • All the below activities are repeated for each server trip.
  • Checking security
  • Unpacking the buffers that store the data being processed
  • Processing the service request
  • Generating the HTML for the page to be redisplayed
  • Packing updated buffers
  • Storing the buffers on the web server
The below items brings in server trips
  • Entering data in fields with FieldEdit or FieldChange PeopleCode.
  • Entering data in fields that have prompt table edits.
  • Entering data in fields that have related displays.
  • Inserting a row in a grid or scroll area.
  • Deleting a row from a grid or scroll area.
  • Using grid or scroll area controls to move forward or back.
  • Accessing another page in the component.
  • Selecting an internal tab.
  • Expanding or collapsing a collapsible section.
  • Clicking a button or link.
Steps to identify and control server trips
  • Analyzing server trips: showcounters = 1
  • Using Deferred mode whenever possible
  • Avoid using FieldChange PeopleCode to hide, unhide, enable, or disable elements on the same page. Hiding or unhiding objects and enabling or disabling objects should, as a general rule, be coded in either page Activate PeopleCode or, for objects that are on another page in the component, in FieldChange PeopleCode.
  • Clicking the Refresh button forces a trip to the server
  • Make the calculations / totaling in the deferred mode
  • Use warning messages in Deferred mode with proper value tagging 
  • Use %PerfTime which helps you to determine how long a program takes to execute and adjust it accordingly

Other recommended methods includes
  • Run a SQLTrace and review the transaction for SQL statements that have a long processing time and tune it with the assitance from the DBA
  • A simple join optimizes SQL more effectively than issuing two related SQL statements separately. 
  • While working with the counter, use the GetNextNumberWithGaps PeopleCode function to avoid unwanted commits.
  • Minimize the events to be triggered and consolidate the PeopleCode under less number of events for better managing and performance.
  • Messages sent online should always be coded in the SavePostChange event. Safer that the message will not send until the commit happens
  • Use metadata and Rowset Cache
  • Increasing MaxCacheMemory. Keeping a low memory space can degrade the performance when a significant cache is created and lower the performance
  • Declare all variables upfront and specifically by the type and do not leave the program to do the auto declaration
  • Create application packages for repeated and re-usable code fragments
If you have your suggestions, please comment it below and I  will incorporate in this post.

How To Create a Database Level Audit (Trigger)?

Someone asked about Auditing yesterday and I thought I will share some info regrading the same.

You can do Field, Record and Database Audits in PeopleSoft. Record Level Audit gives the load on the App Server and can impact the performance. So the DB level Audit is something that is recommended always.

You already know the basic procedure for Field and Record level auditing - To create an audit record by copying the main record and deleting all the non-key fields and adding the 3 Audit fields and making them the key fields.

Here is how you can create a database level audit or trigger.

First you create the audit record for the main record. That step remains the same. Once you have this, go to PeopleTools > Utilities > Audits > Update Database Level Auditing

Go into the page and provide the details as below and click on the Generate Code.


Either you can copy the code and run it in the SQL Developer or use the below process to run it, if you do no have the database access.

Run the process and once it is gone to success, navigate to the log files and track the trgcode1.sql


Run the SQL in the database and you will get the below error. Solution below:


Navigate to the PSHOME Scripts folder and find out the getpsporid.sql and run it in the DB.


Then run the previous trgcode.sql script again. The trigger will be created.


Use the below SQL to search and track the trigger in the DB


And DONE!

Response on: AUDIT_RECNAME
Adding AUDIT_RECNAME is not complicated. It is an extra key field in addition to the 3 AUDIT fields. The Screenshot below shows how AUDIT_RECNAME tracks the data.


Oracle SES Search Result Hyperlink Not Working

Oracle SES search was working perfect. It was returning the desired results. However if the user tries to click on the link and navigate, nothing will happen. The hyperlink behaves like a normal text.


When right clicked on the page and analyzed the links, there was slashes missing in the base URL's and the server address in the links were not proper. Went to the SES settings and all the ping utilities fired successfully.

Further long analysis led to the non-existence of Portal / Content URI on the local node being the issue. 

If you face the same, these are the steps to resolve:
1. Go to the default node of the instance and provide the Portal / Content URI and Save
2. Go to PeopleTools > Search Framework > Administration > Deploy/Delete Object


Click on Select All and Undeploy. Once all are undeployed,  Select All once again and click Deploy.

This will resolve the Hyperlink issue.

Main Security Tables Cheat Sheet

ACCESS PROFILES
PSACCESSPRFL

USERS
PSOPRDEFN
PSOPRDEFN_LANG
PSOPRALIAS
PSROLEUSER
PSUSERATTR
PSUSEREMAIL
PSUSERPRSNLOPTN
PS_ROLEXLATOPR
PS_RTE_CNTL_RUSER

ROLES
PSROLEDEFN
PSROLEDEFNLANG
PSROLECANGRANT
PSROLECLASS

PERMISSION LISTS
PSCLASSDEFN
PSCLASSDEFN_LNG
PSAUTHSIGNON
PSAUTHITEM
PSAUTHPRCS
PSAUTHCUBE
PSAUTHMP
PSAUTHBUSCOMP
PSAUTHQUEUEMON
PSPRCSPRFL
PS_SCRTY_QUERY
PS_SCRTY_ACC_GRP
PS_SCRTY_ADS_AGRP
PSAUTHOPTN
PSAUTHWS
PS_SCRTY_ADS
PS_SCRTY_SRCHGRP
PS_MC_OPR_SECURITY
PS_MC_OPRID

DEFINITION SECURITY
PSPTDEFSEC_GRPS
PSPTDEFSEC_GRP
PSPTDEFSECINRL
PS_APP_DES_OBJ_CST
PSOPROBJ

PERSONALIZATIONS
PSUSEROPTNDEFN
PSUSEROPTNLANG
PSOPTNCATGRPLNG
PSOPTNCATGRPTBL
PSOPTNCATTBL
PSOPTNCATLANG

SECURITY OPTIONS
PSSECOPTIONS

SECURITY LINKS
PSUSEROTHER
PSUSEROTHER_L
PSUSERSELFOTHER
PSUSERSELFOTH_L
PSROLEOTHER
PSROLEOTHER_LNG
PSPERMLISTOTHER
PSPERMLISTOTH_L

USER ID TYPES
PSOPRALIASTYPE
PSOPRALIASFIELD

USER BYPASS TABLE
PS_BYPASS_TABLE

FORGOT EMAIL TEXT
PSPSWDEMAIL
PSPSWDEMAILLANG

PASSWORD HINTS
PSPSWDHINT
PSPSWDHINT_LANG

SIGNON PEOPLECODE
PSSIGNONPPC

DIRECTORY
PSDSDIR
PSDSSRVR
DSCONNECTID
PSDSEXT_INSTALL
PSDSSECMAPMAIN
PSDSSECMAPSRVR
DSUSRPRFLMAP
PSDSUSERPRFL
PSDSSECROLERULE
DSSRCH_SBR
DSSRCHATTR
DSSECFILTER
PT_WF_NOT_DSCFG