How to Send Email Using PeopleCode

How to Send Email Using PeopleCode
In this Article we can find how to send email using peoplecode
Function SendMAilfromSetupMailInfo (&ReceiverName As string, &MAIL_TO As string) Returns boolean
Local PT_MCF_MAIL: MCFOutboundEmail &ObjectEmail = create PT_MCF_MAIL: MCFOutboundEmail();

/*-- Initialize the usual fields of an email --*/

&ObjectEmail.From = "email@abc.com";
&ObjectEmail.ReplyTo = "email@abc.com ";
&ObjectEmail.Recipients = &MAIL_TO;
&ObjectEmail.Subject = MsgGetText (20050, 142, "");
&ObjectEmail.Text = MsgGetExplainText (20050, 141, "", &PersonName, &MAIL_TO);
&ObjectEmail.AddHeader("Errors-To", "email@abc.com");


Local integer &resp = &ObjectEmail.Send();
Local boolean &done;

Evaluate &resp
When %ObEmail_Delivered
/* every thing ok */
&done = True;
Break;

When %ObEmail_NotDelivered
/*-- Check &email.InvalidAddresses, &email.ValidSentAddresses
and &email.ValidUnsentAddresses */
&done = False;
Break;

When %ObEmail_PartiallyDelivered
/* Check &email.InvalidAddresses, &email.ValidSentAddresses
and &email.ValidUnsentAddresses; */
&done = True;
Break;

When %ObEmail_FailedBeforeSending
/* Get the Message Set Number, message number;
Or just get the formatted messages from &email.ErrorDescription,
&email.ErrorDetails;*/

&done = False;
Break;
End-Evaluate;

Return &done;
End-Function;



How to Scheduling and Running SQR from Peoplecode

How to Scheduling and Running SQR from Peoplecode
Description
Peoplecode provides functions like CreateProcessRequest that allows us to create a ProcessRequest object.  Once this object is created, we can assign values to its properties and then use the Schedule method to submit the process request for scheduling.The CreateProccessRequest function takes 2 arguments. The Process Type and the Process Name.
/*Variable declaration*/
Local ProcessRequest &MYPrcsRqst; 
Local String &MySQR;

&MySQR = "InsTmpTbl"

/* Creating Process Request Object*/
&MYPrcsRqst = CreateProcessRequest("SQR Process", &MySQR);

/*Specifying the runcontrol id*/
&MYPrcsRqst.RunControlID = "BATCH"

/*Specifying the output option*/
&MYPrcsRqst.SetOutputOption("Web", "PDF", "", &MySQR); 

/* Use the Schedule() method to Schedule the SQR.*/

&MYPrcsRqst.Schedule();
If &MYPrcsRqst.Status = 0 then
/* Schedule succeeded. */
Else
/* Process (job) not scheduled, do error processing */
End-If;

How to Populate Drop down list at Runtime using PeopleCode

How to Populate Drop down list at Runtime using PeopleCode
The solution is simple, using peopleCode. In that page where you need to show all the 5 translate values, you assign that field and you don̢۪t need to worry for that page. Now, for the other page, where you need to show only 3 values, you need write peoplecode in record rowinit event. First, Store the following code given below in a function library. Then, create a SQL object which will return the required 3 field values and their descriptions from PSXLATITEM. Then pass the SQL object name, Record object name and field object name as string to the below provided source code from the rowinit event. The rowinit peoplecode will look like this:
&Rcd = "Chinnu_raavi"; /* Record name */ 
&Fld = "Chinnu_raavi"; /*field name */ 
&SQL = "Chinnu_raavi_SQL"; /* SQL object name */ 
PopulateDropDown(&Rcd, &Fld, &SQL); 

Function PopulateDropDown(&RcdName As string, &Fldname As string, &SQL_name As string)
    
   Local Field &Fld;
   Local SQL &SQL;
   Local string &CodeIn, &DescIn;
   
   &Fld = GetRecord(@("Record." | &RcdName)).GetField(@("Field." | &Fldname));
   
   &Fld.ClearDropDownList();
   &SQL = GetSQL("SQL." | &SQL_name);
   
   While &SQL.Fetch(&CodeIn, &DescIn)
      &Fld.AddDropDownItem(&CodeIn, &DescIn);
   End-While;
   
 End-Function;

Identifying modified peoplecode and PeopleSoft objects based upon OPRID and Date modified

Identifying modified peoplecode and PeopleSoft objects based upon OPRID and Date modified
SELECT DISTINCT OBJECTVALUE1, OBJECTVALUE2, OBJECTVALUE3  FROM PSPCMPROG
WHERE LASTUPDDTTM = SYSDATE 
AND (OBJECTVALUE1, OBJECTVALUE2, OBJECTVALUE3)  -- Specify PeopleSoft objects name
NOT IN 
(SELECT OBJECTVALUE1, OBJECTVALUE2, OBJECTVALUE3
FROM PSPROJECTITEM WHERE PROJECTNAME LIKE '%SS')  AND LASTUPDOPRID !='OPRID';


SELECT * FROM PSRECDEFN WHERE LASTUPDDTTM >'01-JAN-2008' AND LASTUPDOPRID NOT LIKE 'PPLSOFT';

Write in the record from the external file using File layout

Write in the record from the external file using File layout
We can get the solution for able problem using the file layout in the peoplesoft . To read in the CSV file we use the following PeopleCode using the following steps:

(1) It reads the file into a temporary record.

(2) Each line of the file is read into a string.

(3) The string is split into an array, with the value of each field in the array becoming an element in the array.

(4)The value of each field in the record is assigned a value from the array.

After additional processing (for example, converting strings into dates or numbers, verifying data, and so on) the record can be inserted into the database.
To insert the final data into the database, this code must be associated with a PeopleCode event that allows database updates, that is, SavePreChange, WorkFlow, SavePostChange, and so on. This code could also be used as part of an Application Engine program.

Local File &MYFILE;
Local Record &REC;
Local array of string &ARRAY;

&MYFILE = GetFile("c:\temp\chinnuraavi.txt", "R", %FilePath_Absolute);
&REC = CreateRecord(RECORD.ABS_HIST_TEST);
&ARRAY = CreateArrayRept("", 0);

If &MYFILE.IsOpen Then
   If &MYFILE.SetFileLayout(FILELAYOUT.ABS_HIST) Then
      While &MYFILE.ReadLine(&STRING);
         &ARRAY = Split(&STRING, ",");
         For &I = 1 To &REC.FieldCount
            &REC.GetField(&I).Value = &ARRAY[&I];
         End-For;
      /* do additional processing here for converting values */
         &REC.Insert();
      End-While;
   Else
      /* do error processing - filelayout not correct */
   End-If;
Else
   /* do error processing - file not open */
End-If;

&MYFILE.Close();

How to Call SQR program using peoplecode

How to Call SQR program using peoplecode

&Rec = CreateRecord(Record.process_table);
      &Rec.OPRID.Value = %UserId;
      &Rec.RUN_CNTL_ID.Value = &ProcessName;
      
      If (&Rec.SelectByKey()) Then
         &Rec.field1.Value = table1.field1;
         &Rec.field2.Value = table1.field2;
         &Rec.field3.Value = table1.field3;
         &Rec.field4.Value =table1.field4;
         &Rec.Update();
      Else
         &Rec.SetDefault();
         &Rec.OPRID.Value = %UserId;
         &Rec.RUN_CNTL_ID.Value = &ProcessName;
         &Rec.field1.Value = table1.field1;
         &Rec.field2.Value = table1.field2;
         &Rec.field3.Value = table1.field3;
         &Rec.field4.Value =table1.field4;
      End-If;
/*specify your desired output format and destination*/
&ProcessType = "SQR Report";
      &OutDestFormat = "PDF";
      &OutDestType = "Web";
&MYRQST = CreateProcessRequest();
      &MYRQST.RunControlID = &ProcessName;
      &MYRQST.ProcessName = &ProcessName;
      &MYRQST.ProcessType = &ProcessType;
      &MYRQST.OutDestFormat = &OutDestFormat;
      &MYRQST.OutDestType = &OutDestType;
      &MYRQST.RunDateTime = %Datetime;
      &RETURN = &MYRQST.Schedule();



People code Tutorial

People code Tutorial
People code is a language like other languages with  it’s own DataTypes , Statements.

Every People Code program is associated with an Application Designer component and with an event.

Peoplecode Locations: Record Fields ,  Menus ,  Components  Pages ,  Business Components , Application Messages ,  Application Engine.

Data Types    

NUMBER,STRING,DATE,TIME,DATETIME,ANY

Scope :

                Local Variables
                Global Variables
                Component Variables

Other Variables :

                System Variables

                Derived/Work Fields



Syntax for declaration:

   <scope> <type> &<variable_name>



Local Variables :


Temporary memory location that holds the value.

Global Variables :

 Exist for the complete session and are used to transfer values between panel groups.
Session means signin to signout is called session

Component Variables :

Exist for the duration of the current PS component.
Used to transfer values between programs on the same component


System Variables :

Internally maintained  and can be referred by the people code any time.
Begins with %.
     Ex : %Date ,%Time ,%Page ,%Menu,%Component,%DBName,%Mode etc...

Derived/Work Fields :

Used when we need to pass values from one program  to another  without the  field values being stored in the    database.
Existence limited to the current component.
They are usually display only fields on a page  or have them as invisible fields on the page



User Defined Variables:


Variables which are defined by developers starts with &.

Operators:

Mathematical  :  + ,- ,* ,/ ,** , |

Comparison : = ,!= ,<> ,>= ,<= ,< ,>

Logical       :  NOT ,AND ,OR



Functions:

User defined functions
Built-in Functions


User defined function:

Internal Peoplecode

Functions that are called directly from the same program where the function was defined without the declare function statement.

External PeopleCode

Stored as Function Libraries( derived/work records named
with prefix “FUNCLIB_”
convention is define these functions in the FieldFormula Event.


Syntax for defining or writing a function
Function <function_name> (<param1,<param2>....)
           stmt1;
           stmt2;
           return <expression>;
End-Function;


Syntax for Declaring a Function
Declare Function <function_name> PeopleCode   <Record_name.FieldName>.FieldFormula.


Built-in Functions:

Component Buffer
Used to modify,update,hide fields in the buffer area.

ActiveRowCount,AddKeyListItem,CompareLikeFields,ClearKeyList,
ComponentChanged,CopyFields,CopyRow,CurrentLevelNumber.


Conversion
Char,Code,Codeb,ConvertChar,String,Value


Current Date and Time
%CurrentDateIn,%CurrentDateOut,%CurrentDateTimeIn,
%CurrentDateTimeOut,%CurrentTimeIn,%CurrentTimeOut



Database and platform
%DbName,%DbType

Data Buffer Access
CreateRecord,CreateRowset,FlushBulkInserts ,GetField,GetLevel0 ,
GetRecord ,GetRow,GetRowset

Date and Time


Used to calculate and manipulate dates

AddToDate,AddToDateTime,AddToTime, Date,DateValue
Day,Days,Days360,Days365


String  Functions

Used to manipulate character Strings.

Number Functions

Used to manipulate numeric values

Security Functions

Used for security purpose.



Data Buffer access Classes


Field ,Record ,Row ,Rowset

Field Class

       Attributes             : Name,Enabled,Type
       Methods              :  GetLongLabel,SearchClear,SetCursorPos
       Built-In Functions: GetField.


Record Class
       Attributes            : Name ,IsChanged ,FieldCount                                          
       Methods             :  CompareFields,CopyChangedFieldsTo,CopyFieldsTo
       Built-In Functions: GetRecord
Row Class
       Attributes               : Visible ,IsChanged
       Methods                : CopyTo ,GetNexteffRow.
       Built-in Functions  : GetRow
RowSet Class
       Attributes               : ActiveRowCount
       Methods                : CopyTo ,DeleteRow ,Fill
       Built-in Functions  : CreateRowSet,GetLevel0,GetRowSet



Statements in PeopleCode


Branching Statements
if Statement:  

   syntax:  if <condition>
                        stmt1;                                                        
                             else 
                       stmt2;
                            end-if;  


Evaluate Statement


Evaluate <field or variable>
when = <value1>
                stmt1; break;
when = <value2>
                stmt2; break;
when-other
                stmt3;break;
End-Evaluate;

For Loop


  For <&variable> = <start-value> to <end-value>                            
                        [Step stepvalue>]
                                   stmt1;  stmt2;
                            End-for;


                                                                                            
                                                                              

How to Skip a Search Record Prompt When You Know the keys

How to Skip a Search Record Prompt When You Know the keys

You have two settings to choose from: skip if possible (0) and force display (1).

If you use the skip if possible setting, then you need to have the keys. Assume your
keys are EMPLID, EMPL_RCD, and EFFDT. Here is what the SearchInit PeopleCode
would look like:

SetSearchDialogBehavior(0);
EMPLID = %EmployeeID;
EMPL_RCD = 0;
EFFDT = &DateVariable;

How to Access a field in level 2 grid in a page using people code

How to Access a field in level 2 grid in a page using people code
If you have a page which has level 0 record and a level 1 scroll area .The level 1 scroll area has level 1 and level 2 grids in it, to access a field in the level 2 grid, you need to access the level 1 grid first and then only the level 2 grid field can be accessed, since the level 2 grid cannot be accessed directly . It cannot be accessed even through the scroll area since the whole scroll act as a row and for a level 0 parent row, there can be any number of scroll level data.
/*level 1 scroll : SCROLL_1 (Page field name)

level 1 record : REC_LEVEL1

level 2 record : REC_LEVEL2
*/

local rowset &Rs1, &Rs2;

&Rs1 = GetLevel0()(1).GetRowset(Scroll.REC_LEVEL1);

For &i = 1 To &Rs1.ActiveRowCount
   &Rs2 = &Rs1.GetRow(&i).GetRowset(Scroll.REC_LEVEL2);
   For &j = 1 To &Rs2.ActiveRowCount
    
         &Rs2(&j).ANY_RECORD_IN_LEVEL2.CORRESPONDING_FIELD.Value = *****

****************************
/*DO THE REQUIRED PROCESSING */
****************************

    End-For;
End-For;

How Sheduling SQR using Peoplecode

How Sheduling SQR using Peoplecode
Description
Structured Query Report (SQR) can be executed with the help of peoplecode without taking the user to Process request page. The best way to do it is to create a process request and schedule it.
The Steps Include 1)Declare a ProcessRequest object 2)Declare name of the sqr to be processed 3)Create a Process Request Object; 4)Set Properties of the Process Request Object 5)Schedule the SQR 6)If the Process (job) not scheduled, do error processing Problem this asset addresses In order to execute a Structured Query Report (SQR) , one has to go to the corresponding Process Request Page and run the SQR manually.This manual work is cumbersome and the user has to wait to execute the SQR at predefined time intervals
 
/* Declare a ProcessRequest object */
Local ProcessRequest &PRCSRQST; 

/* Declare name of the sqr FEB_PRCS to be processed */
Local String &SQR_TO_PROCESS; 

&SQR_TO_PROCESS = "FEB_PRCS"
/* Create a Process Request Object; */
&PRCSRQST = CreateProcessRequest("SQR Process", &SQR_TO_PROCESS);

/* Set Properties of the Process Request Object; */
REM CreateProccessRequest function takes these 2 arguments - Process Type and the Process Name;

&PRCSRQST.RunControlID = "FEB07";
&PRCSRQST.SetOutputOption("Web", "PDF", "", &SQR_TO_PROCESS); 

/* Schedule the SQR */
&PRCSRQST.Schedule();
If &PRCSRQST.Status = 0 then
/* Schedule successful. */
Else
/* Process (job) not scheduled, do error processing */

End-If;

How to pass Dynamic Drop Down Value using peoplecode

How to pass Dynamic Drop Down Value using peoplecode
PeopleSoft provides the functions ClearDropDownList & AddDropDownItem to solve the problem defined above. Certain points to be noted:

1. The variable type (here &fld_TypeField_l) should be Field .

2. If the drop down box has been cleared using ClearDropDownList and subsequently NO AddDropDownItem function call has been used, all the default translate value descriptions will be displayed .

3. The format of AddDropDownItem is &Field_Variabe.AddDropDownItem('A', 'Approved'). Always note that the codes used in AddDropDownItem (here 'A')should be the same codes used in the translate .

/*** VARIABLE DECLARATIONS ****/
Local Field &fld_TypeField_l;

/*** GET THE FIELD ***/
&fld_TypeField_l = GetField(IMF_PAY_MSG_MST.ACTION_TYPE);

/*** CLERING THE DROP DOWN VALUE ****/
&fld_TypeField_l.ClearDropDownList();

/*** ADDING THE VALUES IN DROP DOWN ****/
&fld_TypeField_l.AddDropDownItem('A', 'Approved'); 
&fld_TypeField_l.AddDropDownItem('C', 'Cancelled'); 
&fld_TypeField_l.AddDropDownItem('P', 'Pending'); 
&fld_TypeField_l.AddDropDownItem('O', 'On-Hold'); 
&fld_TypeField_l.AddDropDownItem('R', 'Rejected');



App Designer Tutorial

What is an application designer? Application Designer is an integrated development environment that enables you to work with the numerous objects of a business application in a single work area.

Features in App Designer
Multiple Document interface Drag and Drop Pop - up Menus Property sheets Dynamic tool bars and Menus    Application designer Components


Steps to Designing an Application. 1)Design the Application 2)Define new Fields 3)Create the Record Definition 4)Build the Record 5)Create Page Definition 6)Define the Component 7)Create the Menu Definition 8)Enable Security 9)Test the Application. Important Points to Remember in App Designer.Field Individual pieces of data—such as an employee ID—that can be entered by the user and stored in the database or a column on a table or in a view. Field is column in a table or Record. What is Record?
All the data that resides in PeopleSoft applications is stored in tables, or records, as part of a relational database system. Each record definition describes the properties of an underlying SQL table.
Record is a collection of Fields
What is Page?
Pages provide a way to enter, view, and edit data online
Collection of records.
What is Component?
Represents a logical business transaction or a set of logically related pages that are processed together. collection of pages
What is Menu?
Enables access to the components you build, along with the pages contained in the components
Collection of Components What is Project? A user-defined collection of related object definitions created for the purpose of developing, customizing, or upgrading a PeopleSoft application.
SQL Can be entire SQL programs, or just fragments of SQL statements that you want to re-use.
Style Sheet
A collection of styles that can be used by Internet Architecture application pages.
Activity
A map showing the individual steps, events, and routings that comprise a complete activity within a business process.
Application Engine
A program comprising SQL statements and PeopleCode programs to be run in batch mode, as an alternative to using COBOL
File Layout Definition (or mapping) of a file to be processed. It identifies where in a file data fields are located. Component Interface Externalizes access to a component, so it can be used by a third party or an application message
Start the Development by:
1.Create a new project(Optional). File>New>Project
2. Set Project Options(Optional). Tools>Options
3. Name and save the Project(Optional). File>Save Project As

Hiding Group Boxes on Peoplesoft Pages

Hiding Group Boxes on Peoplesoft Pages
however if the requirement is to selectively display group box in case a particular condition is true or in case for a particular employee or role, you can display the group box by the below code:

if ASGN_VW.EMPLID = "101" Then

DERIVED_HR.AB_PLAN_GRPBOX.Visible = False;

Else

DERIVED_HR.AB_PLAN_GRPBOX.Visible = True;

End-If;

What is the Difference between Display control field and Relational Display control field?

 What is the Difference between Display control field and Relational Display control field?
        A related display field is for display purposes only - it always references a row that's
       not being updated from the current page. The display control when you select
       Related Display field, you need to relate it to the appropriate control. A list of all the
       controls on the page marked as display control fields in the Related control field box.
       Select the control field to which this particular related display is related

what is the Difference between Prompt Table and Translate Table?

what is the Difference between Prompt Table and Translate Table?
         Prompt Table

                If you want to provide prompt support for a field based on the data
               stored in a separate table, enter the name of the table you want to use as the
                Prompt Table at: Record field properties - Edits - Prompt table.
                This will enable users to position their cursor on the field and press F4 to
                 prompt for a list of values stored on the table.

          Translate Table

                     The translate table is a table that stores values for fields that
                       need   to be validated but don't need individual tables of their own.  


What is the difference between DiscardRow() and StopFetching()?

What is the difference between DiscardRow() and StopFetching()?

A DiscardRow function in RowSelect PeopleCode causes the component processor to skip the current row of data and continue to process other rows.

A StopFetching statement causes the component processor to accept the current row of data and stop reading additional rows.

If  both statements are executed, the program skips the current row of data, then stops reading additional rows.

How is the difference between SaveEdit and FieldEdit?

How is the difference between  SaveEdit and FieldEdit?
SaveEdit and FieldEdit are both used for validation, but each one is performed at a different time.
 SaveEdit is performed when the operator saves.
FieldEdit is performed when the operator changes a field. 
SaveEdit is also performed on every row of data, unlike FieldEdit that is only performed on one row of data. When an error is received in FieldEdit, the field is turned red, in SaveEdit fields are not turned red

How to Skip a Search Record Prompt When You Know the keys

How to Skip a Search Record Prompt When You Know the keys
You have two settings to choose from: skip if possible (0) and force display (1).

If you use the skip if possible setting, then you need to have the keys. Assume your
keys are EMPLID, EMPL_RCD, and EFFDT. Here is what the SearchInit PeopleCode
would look like:

SetSearchDialogBehavior(0);
EMPLID = %EmployeeID;
EMPL_RCD = 0;
EFFDT = &DateVariable;

Creating a new instance in Component Interface

Creating a new instance in Component Interface
The first job is to get a Component interface(CI) ,using GetCompIntfcfunction. This CI definition has already been created in the application designer.
Then the "Create Keys" are set,these are values which uniquely identifies each row of data.If any duplicate set of create key values occur,a runtime error occurs. After keying in the key values,the create method is used to populate the CI with the key values.This creates an instance of data.
Next the remaining fields of the row are entered.
Once all the values have been entered the new instance of data is saved.

Local ApiObject &MYSESSION;
Local ApiObject &CR;

&MYSESSION= %Session;
&CR=&MYSESSION.GetCompIntfc(CompIntfc.CR_EMP_CI);
&CR.CR_EMP_ID = "101";

&CR.Create();
&CR.CR_FIRSTNAME="Chinnu";
&CR.CR_LASTNAME="Raavi";
&CR.CR_MARITAL_STATUS = "M";
&CR.CR_PHONE_NO = "1234567890";

&CR.save();

How to implement Record Level Audit in PeopleSoft

How to implement Record Level Audit in PeopleSoft
How to implement Record Level Audit in PeopleSoft .

Following are the steps for record level auditing .

1) Clone the record you wish to edit.

2) Add the audit fields: (Key Fields).
AUDIT_OPRID
AUDIT_STAMP
AUDIT_ACTN
Check off the "system maintained" check mark on the record field properties.

3) Delete fields that won'™t be audited.

4) Remove all key structures.

5) Save and build the record.

6) Link the base record to the audit record.


How to Implement Component Interface in peoplesoft

How to Implement Component Interface in peoplesoft
General points to implement Component Interface and understand the component/page structure.

1) create the component interface.

2) always accept the default loading fields structure.

3) remove the unwanted fields from CI.

4) provide necessary access to CI – permissionlist.

5) test your CI, if any update/insert you do CI returns 1 if it success and ˜0 for failed.

6) arrange the fields as per the page design/ tab order.

7) set get history items to true.

8) Set interactive mode to true. Note this setting affect the performance. It should be used only for testing purpose.

9) pass the key field values.

10) Check the prompts if dynamic prompts are being used on the page. if yes make sure to check the values against these tables.

11) check if any prompts are being used on the page.

12) Put a validation for prompts before passing to CI. Most of the cases we may receive invalid values in prompt.

13) log into error tables if any invalid prompt values found.

14) at child level > set the collection properties insertitem/item.

15) If collection item count is more than one then set to insertitem else item. for first row always property as item .

16) Insert item > just like clicking on + button.

17) enable the save and cancel methods.

18) Do not use save/cancel methods inside the loop. It may lead failure of your program.

19) Always use rowset/arrays for looping the rows, avoid using createsql̢۪s .

20) Always set ignore property (if any error found it will skip that row and process the next row).

21) Set Commit at the end of the step and inside the save method.

22) make sure your CI session is active.

23) finally test your CI thru App Designer.


Folder Creation from SQR

Folder Creation from SQR
If a folder has to be created from a SQR then we can use call system to accomplish this. Let us say if MyFolder is what needs to be created in 'C' drive.

Then follow the code snippet below:

Let $folder = 'C:\MyFolder'
Let $cmd = 'mkdir ' $folder
call system using $cmd #status

Call Sections through PeopleCode in Application Engine

Call Sections through PeopleCode in Application Engine
Syntax for calling Sections through PeopleCode in Application Engine

/*This code is used to call different section in Application Engine based on conditions*/


If (RecordName.FieldName= " ") And
      (RecordName.FieldName = 0) Then
   RecordName.AE_SECTION = "Something";
End-If;

If (RecordName.FieldName <> " ") And
      (RecordName.FieldName = 0) Then
   RecordName.AE_SECTION = "Something";
End-If;

If (RecordName.FieldName = " ") And
      (RecordName.FieldName <> 0) Then
   
   RecordName.AE_SECTION = "Something";
End-If;
If (RecordName.FieldName <> " ") And
      (RecordName.FieldName<> 0) Then
   RecordName.AE_SECTION = "Something";
End-If;

How To release Temp table locks in Peoplesoft

How To release Temp table locks in Peoplesoft
The instacnce need to be deleted from PS_AERUNCONTROL , PS_AETEMPTBLMGR, AERUNCONTROLPC.
PS_AETEMPTBLMGR controls the temp table locks. Also peoplesoft delivered Application engine AECLEANUP can also be used.

DELETE FROM PS_AETEMPTBLMGR WHERE PROCESS_INSTANCE = :1;
DELETE FROM PS_AERUNCONTROL WHERE PROCESS_INSTANCE = :1;
DELETE FROM PS_AERUNCONTROLPC WHERE PROCESS_INSTANCE = :1;

How to Hide Group Boxes on Peoplesoft Pages

How to Hide Group Boxes on Peoplesoft Pages

If the requirement is to selectively display group box in case a particular condition is true or in case for a particular employee or role, you can display the group box by the below code:

if ASGN_VW.EMPLID = "101" Then 
DERIVED_HR.AB_PLAN_GRPBOX.Visible = False; 
Else 
DERIVED_HR.AB_PLAN_GRPBOX.Visible = True; 
End-If; 

Integration Broker Interview Questions:

Integration Broker Interview  Questions:
  1. What are the features of Integration Broker?

Ans. It works in synchronous and asynchronous modes, it works in Hub and spoke model.


 2.What is the significance of Gateway?
Ans. Gateway is the pipeline using which messages will be transferred.

3.What is node?
Ans. Node is the point of integration, after it is defined gateway and connectors have to be added to it

4.What is a message?
Ans. Message is the structure designed with records and fields.

5.What is the significance of message channel?
Ans. Message channel is used to route messages with in the message channel in sequential manner and is used for partitioning.

6.Message Channel security needed to send messages?

Ans. No,   It is given only for display in Message Monitor

7.Where can you check the connectivity of databases, message status, domain status?
Ans. Message Monitor

8.What is meant by Listening connector and Target connector?
Ans. Listening connectors listens to the requests and passes through the gateway to Target connectors, this inturn sends messages to the third party application

Enabling and understanding SQL trace in PeopleSoft

Enabling and understanding SQL trace in PeopleSoft
Enabling SQL Trace

One of the most powerful trouble-shooting tools provided in all versions of PeopleSoft (PS) applications is SQL trace. This tool provides a programmer with a file containing all of the SQL statements executed by the application during an individual user's PS session. The file can be used to trouble-shoot unique constraint violations, buffer errors, missing prompt table entries, and other common PS issues. The trace file is also frequently requested by the PeopleSoft help desk when you log cases with them, so you definitely want to know how to create and use this file.

To enable SQL trace in versions 8.0 and higher, the user simply needs to click on the "To set trace flags, click here" link, which leads to a sign in page that includes the SQL trace settings. An alternate way to enable trace if the link is not provided is to add "&trace=y" to the sign in URL. To enable trace in earlier versions of PS, the user needs to navigate to the configuration manager (navigation: Edit-Preferences-Configuration from an applications panel) and click on the "Trace" tab. There are numerous trace settings that appear as checkbox items; the two that I find most useful are "SQL statements" and "SQL statement variables". In versions 8.0 and above, checking these two boxes and then logging in as usual enables trace. In earlier versions of PS, there are a couple of additional steps. First, the name of the trace file must be entered in the "Online Trace File" box at the bottom of the "Trace" panel. Second, after the trace settings have been entered, the user must then logout and log back in for them to take effect. Please note: in any version of PS, using SQL trace significantly retards application performance for the individual user, so it should be used only when other trouble-shooting methods have failed.

Finding the trace file

OK, now that the user is logged in with trace enabled, what needs to happen next? The user should navigate to the component or page that is causing the problem, but should not yet replicate the error. Why? Because the trace file can be rather voluminous at this point, so it is best to delete it and get rid of all the unnecessary SQL executed to that point and make your trouble-shooting task a little easier. Where do you go to delete the trace? In versions prior to 8.0, you know where the file is because you've entered the path for it (usually something like c:\temp\sqltrace.log, which can be on the client machine or the server, depending upon whether you're logged on in two- or three-tier mode). In versions 8.0 or higher, the trace file is created on the application server in the {PS_HOME}\appserv\{DBNAME}\LOGS directory. The name is normally a combination of the operator ID used to log in to the session followed by the machine name or IPAddress and ".tracesql" (e.g., JSMITH_PSSERV.tracesql).

Once the file has been deleted, the user should replicate the error and then stop, sign out, and sign back in without trace enabled and continue doing his or her normal work. You can then pull the file off the server and begin your trouble-shooting activities. If you're lucky, you'll be able to scroll to the bottom of the file and the last statement executed will be the one that you need to solve the problem. In some cases, though, you may have to enter a number of the statements into a SQL tool (e.g., Query Analyzer, SQL Plus, TOAD) before you can diagnose and solve the problem.

Understanding the file

Here's a sample line from a SQL trace file that I created while inquiring on my vendor processing authority preferences in the "User Preferences" component of a PS financials instance:

PSAPPSRV.1088 1-344 14.38.04 0.000 Cur#1.A84XXXX RC=0 Dur=0.000 COM
Stmt=SELECT OPRID, AUTH_VNDR_UNCERTFY, AUTH_VNDR_CERTFY, AUTH_VNDR_INACT_ST FROM
PS_OPR_DEF_TBL_VND WHERE OPRID=:1 ORDER BY OPRID
PSAPPSRV.1088 1-345 14.38.04 0.000 Cur#1.A84XXXX RC=0 Dur=0.000 Bind-1
type=2 length=4 value=ROBR

The "1-344" is a sequential line counter for the process that you're currently executing. The next column contains "14.38.04", which is a time stamp from the machine on which PeopleSoft is running. The third column, "0.000", is the amount of time that has elapsed since the previous line was written to the trace file. The "Cur#1" indicates the number of the cursor for the statement and the fifth column ("A84XXXX") indicates the name of the instance in which the statement was executed, which is followed by the return code (RC=0) and duration (Dur=0.000) of the statement. Finally, the last column displays the SQL statement and any bind variables; the values of the binds can be found in the next line of the trace file (value =ROBR for bind variable :1).


Common uses for the SQL Trace file


What kinds of problems can you solve with the trace file? One common issue is the "matching buffer not found error", in which an orphan record can be preventing a page from building successfully. Another common use for the trace file is to solve problems with search records not returning values that the user expects to see, such as voucher IDs, employee numbers, expense reports to be approved, or other items. These can normally be found by navigating to the component, determining the search record and querying the search record, but there are numerous cases where the search record is named dynamically via PeopleCode and the trace file saves you a lot of time reading through that PeopleCode to determine the name of the table. You can also solve dreaded unique constraint violations using the trace file, because you'll have the exact insert statement that the system was executing at the time that the error occurred. The trace file is also great for SQL tuning purposes because it provides the timing for each statement. In any case, now that you've got the trace file you can run the relevant statements in a SQL tool and solve the problem that the user is experiencing.

Ref:http://it.toolbox.com/blogs/robs-peoplesoft-blog/enabling-and-understanding-sql-trace-in-peoplesoft-11093