Saturday, November 22, 2014

Collapse or Expand Group box on page using peoplecode


For Collapsing/Expanding group box on page using peoplecode you just need to reference the field associated with your group box to set the DataAreaCollapsed property to True or False.

To know the field associated with your group box check the property of your group box and in peoplecode you can have this syntax 

/*for collapsing group box*/
RecordName.FieldName.DataAreaCollapsed = True;/*for expanding group Box*/
RecordName.FieldName.DataAreaCollapsed = False;

generally this property is used when you have selected Collapse  in group box property and you want to expand the group box on some validation.This code is also useful when you need to collapse the group box when user fills all the fields values present in group box and clicks on save so your page wont look messy with so many fields.

Example of Collapsible Group Boxes:
Spain is expanded while the group boxes for France, Italy, and USA are collapsed:



This is what I learned today,I'll be sharing my learnings with my blog audience,Kindly let us know  your queries in comments  or you can mail us on csdoon@gmail.com

Saturday, August 30, 2014

How to embed videos in Peoplesoft

To embed videos on PeopleSoft there are two methods.First method is embedding a video from YouTube and second one is showing up a video from the server to user.

In first method you just need to write an iFrame Code for embedding YouTube video URL.create a HTML Based pagelet and use iFrame code to embed video.

Eg.
<iframe width="420" height="315"src="http://www.youtube.com/embed/XGSy3_Czz8k"></iframe>
For second method you have to use IScripts.This method helps when there is restriction on the access of internet,where you cannot use YouTube video link so for that you should have the video downloaded on the server and then using IScript you can view the video on peoplesoft system.

We will create a Weblib record with one "iscript" field and write the code on the fieldformula of that field.
This fieldformula code can be called by any fieldchange event.

Step 1 : Create the weblib record (just save the record with the prefix WEBLIB)
Here I have used Record : WEBLIB_VIDEOCODE  and Field : ISCRIPT1

Function ISCRIPT_VIDEO
%Response.WriteLine("<OBJECT id='playera' height=100% width=100% classid='clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95' codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=,1,52,701' standby='Loading Microsoft Windows Media Player components...'");
%Response.WriteLine("<PARAM NAME='AutoStart' VALUE='True'>");
%Response.WriteLine("<PARAM NAME='Balance' VALUE='False'>");
%Response.WriteLine("<PARAM NAME='DisplaySize' VALUE='True'>");
%Response.WriteLine("<PARAM NAME='Filename' VALUE='True'>");
%Response.WriteLine("<PARAM NAME='Mute' VALUE='False'>");
%Response.WriteLine("<PARAM NAME='SelectionStart' VALUE='False'>");
%Response.WriteLine("<PARAM NAME='SelectionEnd' VALUE='False'>");
%Response.WriteLine("<PARAM NAME='ShowControls' VALUE='True'>");
%Response.WriteLine("<PARAM NAME='ShowAudioControls' VALUE='True'>");
%Response.WriteLine("<PARAM NAME='ShowDisplay' VALUE='False'>");
%Response.WriteLine("<PARAM NAME='ShowPositionControls' VALUE='True'>");
%Response.WriteLine("<PARAM NAME='Volume' VALUE='1'>");
%Response.WriteLine("<PARAM NAME='AudioStream' VALUE='False'>");
%Response.WriteLine("<PARAM NAME='AutoSize' VALUE='True'> ");
%Response.WriteLine("<PARAM NAME='AnimationAtStart' VALUE='False'>");
%Response.WriteLine("<PARAM NAME='AllowScan' VALUE='False'>");
%Response.WriteLine("<PARAM NAME='AllowChangeDisplaySize' VALUE='True'>");
%Response.WriteLine("<PARAM NAME='AutoRewind' VALUE='True'>");
%Response.WriteLine("<PARAM NAME='BaseURL' VALUE=''>");
%Response.WriteLine("<PARAM NAME='BufferingTime' VALUE='5'>");
%Response.WriteLine("<PARAM NAME='CaptioningID' VALUE=''>");
%Response.WriteLine("<PARAM NAME='ClickToPlay' VALUE='True'>");
%Response.WriteLine("<PARAM NAME='CursorType' VALUE='True'>");
%Response.WriteLine("<PARAM NAME='CurrentPosition' VALUE='True'>");
%Response.WriteLine("<PARAM NAME='CurrentMarker' VALUE='True'> ");
%Response.WriteLine("<PARAM NAME='DefaultFrame' VALUE='mainframe'> ");
%Response.WriteLine(" <PARAM NAME='DisplayBackColor' VALUE='True'> ");
%Response.WriteLine(" <PARAM NAME='DisplayForeColor' VALUE='16777215'>");
%Response.WriteLine("<PARAM NAME='DisplayMode' VALUE='1'>");
%Response.WriteLine("<PARAM NAME='Enabled' VALUE='-1'>");
%Response.WriteLine("<PARAM NAME='EnableContextMenu' VALUE='True'>");
%Response.WriteLine("<PARAM NAME='EnablePositionControls' VALUE='True'>");
%Response.WriteLine("<PARAM NAME='EnableFullScreenControls' VALUE='True'>");
%Response.WriteLine("<PARAM NAME='EnableTracker' VALUE='True'>");
%Response.WriteLine("<PARAM NAME='InvokeURLs' VALUE='False'>");
%Response.WriteLine("<PARAM NAME='Language' VALUE='False'>");
%Response.WriteLine("<PARAM NAME='PlayCount' VALUE='1'>");
%Response.WriteLine("<PARAM NAME='PreviewMode' VALUE='False'>");
%Response.WriteLine("<PARAM NAME='ShowStatusBar' VALUE='True'> ");
%Response.WriteLine("<PARAM NAME='TransparentAtStart' VALUE='False'>");
%Response.WriteLine("</OBJECT>");
%Response.WriteLine("<SELECT name=selecta size=1 id=musica onchange=document.all.playera.Filename=document.all.musica.value;>");
%Response.WriteLine("<OPTION selected>::::::::: Choose Your Media Sample Here :::::::::</OPTION> ");
%Response.WriteLine("<OPTION value='C:\myvideo.mp4'>My Video File </OPTION> ");
%Response.WriteLine("<OPTION value='Stream URL or Full File Path Goes Here'>My Audio File</OPTION>");
%Response.WriteLine("<OPTION value='Stream URL or Full File Path Goes Here'>My Live Stream</OPTION> ");
%Response.WriteLine("</select>");
%Response.WriteLine("</body>");
%Response.WriteLine("</html>");

You Just need to change the line highlighted in yellow.replace the path with your videos path (server path should be used so video would be available for everyone using same PeopleSoft system)

Step 2 : Call this line of code on any button field change event and your video will be played in a new window.

Declare Function ISCRIPT_VIDEO PeopleCode WEBLIB_VIDEOCODE.ISCRIPT1 FieldFormula;
&URLString = GenerateScriptContentURL(%Portal, %Node, Record.WEBLIB_VIDEOCODE, Field.ISCRIPT1 , "FieldFormula", "ISCRIPT_VIDEO ");
ViewContentURL(&URLString);
Hope you liked this post.Kindly mention your Query and suggestion in comments.

Post Credits : Pawan Mundhra & Bijay Bhushan Singh