Search This Blog

Thursday, April 28, 2011

SignOn PeopleCode

Consider there is a requirement to warn the users while they login and before they land on the peoplesoft home page. How can we achieve this?

When this question came to me I was not able to understand how we can recognize the user who logs in through the login page. The user can be an employee, he can be a guest. But before landing the homepage how is it possible to check the role attached to the user? That was a challenge indeed at first.

SOPC - Sign on People code was one way for implementing the same. This people code will get fired upon the login to any PIA environment.

How to relate the people code we write to the login session. This can be achieved through: PeopleTools >> Security >> Security Objects >> Sign on people code

You can provide the record name, the field and the event on which the people code is written. Then use the checkbox to control when the code need to be fired.

Now consider, you need to show the user a page based on how he is verified. For this, you have to use the page under: Web profile >> Web profile configuration >> Look & Feel

Use the Password section to cater the above requirement. In the password warning page you can provide your own HTML page which you have created with the necessary warning for the user.

And use the SetAuthenticationResult function to do the rest of the work.

Wednesday, April 27, 2011

SetAuthenticationResult

This is one function I stumbled upon last week. I gave a search in people books and tried to understand how and in which context it works the best.

Came to know that it works with the PeopleSoft Sign on related area and provided the developer with robust ways of administering the security perspective beyond what’s delivered with the product
Syantax for the function is given below:

SetAuthenticationResult(AuthResult [, UserId] [,ResultDocument] [,PasswordExpired] [DaysLeftBeforeExpire])

When PasswordExpired is True, it indicates the password is expired, the passwordexpired.html page is displayed during login when signon PeopleCode is enabled.

When DaysLeftBeforeExpire is greater than 0, and PasswordExpired is False, indicating that the password will expire in x days, the passwordwarning.html page is displayed during login when signon PeopleCode is enabled.

Using Find function

The requirement was to remove the # field embedded at the first position of the Course ID Field which comes from the legacy and use the rest of the numbers into the peoplesoft system. The code is given below:

&Char_Pos=Find("#",&CourseID);
If &Char_Pos > 0 then
&Course_ID=Upper(Substring(&CourseID,1,&Char_Pos-1));
End-If;


Arvind

Thursday, April 14, 2011

Using GUID

One instance of GUID usage I noticed is while implementing parallel processing in Application engine. You require to use unique run control ID's in this case. This can be achieved using creating unique GUID's

The unlucky part is that the peoplebooks doesn't have any documentation for the same. But my colleague pointed out a function for the GUID creation.

&nbr_GUID = UuidGen();

This can be assigned as the runcontrol parameters.

While gave a search on google to know more about the same, I stubled upon Jim's blog which gave more light on the same.

Local string &guid;
SQLExec("SELECT RAWTOHEX(SYS_GUID()) FROM PS_INSTALLATION", &guid);
MessageBox(0, "", 0, 0, "GUID from DB: " | &guid);

and GetJavaClass("java.util.UUID").randomUUID().toString();

Delaying Execution using PeopleCode

If you want to delay the execution through PeopleCode, try using this function. One example was when there was a requirement to delay the row insert interval. Another one, if to delay the process execution until the group parallel process need to be finished.

GetJavaClass("java.lang.Thread").sleep(&sleepSeconds * 1000);