July 12, 2009

PeopleSoft Technical: Hints/Tips

1. Make sure the system maintained check mark is checked OFF on the record field properties of AUDIT_ fields while creating AUDIT Record.

2. %DateDiff(from_date,to_date) gives date difference in days and %DateTimeDiff(from_datetime,to_datetime) gives date difference in minutes
Note: "abs(days(to_date) - days(from_date))" can also be used.
This also takes Leap Years into consideration.

3. How to unlock an User Profile from database ?

    UPDATE PSOPRDEFN SET ACCTLOCK = 0

4. The SetEditTable method works with the ExecuteEdits method. It is used to set the value of a field on a record that has it's prompt table defined as %PromptField value.
-%PromptField values are used to dynamically change the prompt record for a field.
-
Use SetEditTable to dynamically set the prompt table.

5.
SendMail(&FLAGS, &TO, &CC, &BCC, &SUBJECT, &TEXT, &FILES, &TITLES);
-&FLAGS = 0

6. PeopleCode can be commented using rem, remark, /*....*/, <*.....*>.

7.
Skip a Search Record prompt when you know the keys using PeopleCode function SetSearchDialogBehavior in SearchInit PeopleCode.
SetSearchDialogBehavior(0) -skip if possible
SetSearchDialogBehavior(1) -force display

8. Renaming a Tree
If you are adding or inserting nodes into a tree using the PeopleSoft Tree Manager, and you get an error that reads, "Unable to Insert (25,14), then you need to take one or both of the following steps:
1. If the tree contains branches, you may need to unbranch one or more branches. If you are trying to insert below the last node in the branch you are editing, you must unbranch the branch node that you are trying to insert below.
2. You may need to renumber the tree's internal node numbers by running the SQR named PTUGAPTR.SQR
  
9. Import data to Populate the Dept Sec Tree
Use Import Manager to import the data into the R_PER507 record delivered by PeopleSoft. Once you upload the external data into this table you can use the PS delivered SQRs (PER507, PER508, PER509, and PTUGAPTR) to load both the Department record and security tree.


10. Tree Mover Utility provides a facility for migrating trees from one database to another.Run the tmdownld.sqr to export the desired tree contents into a flat file. After you complete this task, you can import the flat file into version 8 using the tree mover utility.
Note: This can be done using different source and target versions of PeopleSoft. For example if you want to migrate tree data from 7.5 PS to 8.x PS, you can use this method.
 

11. Debug apps by Writing variables to a file
&MYFILE = GetFile("debug-file.txt", "W");
If &MYFILE.IsOpen Then
&MYFILE.WriteLine("Here is my First Variable");
&MYFILE.WriteLine(&MyVariable);
&MYFILE.WriteLine("Here is another Variable");
&MYFILE.WriteLine(&MySecondVariable);
&MYFILE.Close();
End-If;
Note:
PeopleSoft freaks out when you try to call a winmessage from FUNCLIB PeopleCode

12. Import/Export Security
PeopleTools provides a set of DataMover scripts to EXPORT and IMPORT your security. The provided scripts transfer User Profiles.
USEREXPORT.DMS : Exports User Profiles from source database and stores them in a dat file. The output file is named USEREXPORT.DAT
USERIMPORT.DMS : Reads the file created by USEREXPORT.DMS and copies theUser Profile data into the target database.
Note: To Export Permission Lists and Roles from source to target, useApplication Designer to copy Permission List and Roles objects from source to target database.
The EXPORT/IMPORT scripts export and import ALL security tables (all UserProfiles, Roles, and Permission Lists). The USEREXPORT/USERIMPORT scripts export and import ALL User Profiles. From Application Designer, you can only copy Roles and Permission Lists (not User Profiles). The scripts are for use in situations where you need to move all the security from one database to another. Use Application Designer if you just need to copy a few select Roles and/or Permission Lists between databases.
When migrating security between databases you may want to make sure that the SYMBOLIC ID, AccessID and Access Password in the source and target database are the same, this makes for little headaches. You can always change the AccessID password or create a new Symbolic ID in the target once the migration is done.

13. PeopleCode: Manipulate ActiveX controls in PeopleCode
In PeopleSoft 8, you can place an ActiveX component on a page, save it, and then manipulate the ActiveX control from within your PeopleCode events.There are two peoplcode events titled PSControlInit and PSLostFocus.
The PSControlInit event fires each time a page is redrawn.
The PSLostFocus event fires each time a user tabs off of the ActiveX control.



14. Special note on Effective Dated Panels
With a few minor exceptions such as Payroll Processing that are usually done as batch processes, effective dated records in PeopleSoft are designed to keep a record of when information changes. In most instances, if you insert a new row into an effective dated panel and attempt to save without changing any values, the new row will not be saved to the database. This is because the new effective date (and possibly other values) have defaulted in and default values do not cause a new row to be saved, even though the save button may have become highlighted.
This is not a bug; it is how the system was designed. Generally, there is no reason to store a new row if no data changes. In situations where there are business reasons for storing rows that are identical except for the effective date, the panels have been coded so that the values are assigned rather than defaulted, but these panels are a tiny minority of the effective dated panels.

15. Scheduling a Process in PeopleCodeHere is a great example of how to schedule a process and email the results from within PeopleCode. You can do this within an App Engine Program or even by placing a push button with FieldChange peoplecode.
--------------------------------------------
Local ProcessRequest &RQST;
Local string &Subject;
Local string &Text;
&Subject = "Subject of Email";
&Text = "This text will be displayed as the text of this email ";
&RQST = CreateProcessRequest();
&RQST.RunControlID = "MYRUNCONTROL_ID";
&RQST.ProcessName = "PROCESSNAME";
&RQST.RunLocation = "PSNT";
&RQST.ProcessType = "SQR";
&RQST.OutDestType = "Email";
&RQST.OutDestFormat = "PDF";
&RQST.OutDest = "User : PS,Role : PeopleSoft User";
&RQST.EmailSubject = &Subject;
&RQST.EmailText = &Text;
&RQST.EmailAttachLog = False;
&RQST.Schedule();
---------------------------------
-> For Left Padding in PeopleCode, try Rept('0','length').
-> "^" - shortcut for field reference.

No comments:

Post a Comment