For those who have heard about iScript and wondering what it is, I could give a basic understanding on the iScripts. iScript is a method by which Peoplesoft offers control to the developer in overriding the people tools frame work. In simple words using iScript, developer will be able to get complete control on the browser. You can create pages which looks like other websites (eg: facebook, amazon etc) still within the Peoplesoft system.
iScript have two main classes, Request and Response. Those who have experience with web development could easily relate these words. For others I could explain it in simple words.
Request class will get the parameters passed from the browser. For eg: in google if you search for “Peoplesoft”, then the browser will send a request to the server with parameter q and parameter value “PeopleSoft”. So in our iScript we can get the parameter value “PeopleSoft” using the request class and send out appropriate result (response).
As you have thought, Response class is the class responsible to give result to a query. In the above example once we receive the search word “Peoplesoft” and performed the search, we need to display the search result in the browser. For this we will formulate the result html and prints it on the user browser using the Write() or WriteLine() method of the response class.
Writing iScript Programs
1. You should write iscript programs in record field event of any record starting with WEBLIB_ .
2. The iScript program will be written like a normal function except that the function name starts with IScript_
For example I want to display a hello world page to the users. The basic steps are as follows.
First I choose a record, say WEBLIB_HELLOWORLD and on the record field (say HTML) Field Formula and write a function IScript_HelloWorld.
Now I create a HTML object with the html code to be printed.
HTML object name is HELLOWORLD.
Now my code looks as below.
Local string &sHTML;
rem Get the text to be printed from the HTML object;
&sHTML = GetHTMLText(HTML.HELLOWORLD);
rem Print the html to the client browser;
3. Now I need to give permission to the iScript. It is like normal activity, go to permission list open web libraries section and give necessary permission to the iScript (you need to choose iScript by drilling down from the underlying record).
4.Now you can access your iScript page by going to the below navigation
If you are already logged in, you will be taken to the hello world page. Otherwise peoplesoft sign in page will appear and from there you will be directly taken to the iscript page on successful login.
Now if you come to real applications, instead of printing hello world, if you want to print a value from data base. In the place of string “Hello world” in the HTML definition replace it with %bind(:1).
Now in the code where you get the html text, use the below.
rem I print “iscript example” as the text;
&sHTML = GetHTMLText(HTML.HELLOWORLD,”iscript example);
The hard coded string can be replaced with a variable with has fetched the value from the database. Thus making your program more interactive. To add on more functionality you could use post functionality in the HTML and obtain the parameters using the Request class and printing sensitive data.
rem Getting parameter passed by the browser.
&sParm = %Request.GetParameter(“search”);
Now you can do processing based on the obtained string and print the output method.
iScripts are interesting method in peoplesoft to un-cuff the restrictions put by peoplesoft application designer. You can create content rich pages, implement ajax/json services, create mobile pages, redefine portels that has visibility in larger crowds, create mobile applications etc using the peoplesoft iscript.
While using iscript, you should take care of the below 3 points
1. Browser compatibility of the HTML rendered
2. Translation of the text printed on the browser
3. Multi-lingual, multi-market and multi-currency situations should be taken care.
You can start with the hello world example and unwind yourself. I’m sure it will be fun experience.
For more details on iScript, visit : http://docs.oracle.com/cd/E25688_01/pt852pbr0/eng/psbooks/tpcr/htm/tpcr23.htm#g037ee99c9453fb39_ef90c_10c791ddc07__185c