Dec 30, 2012

PeopleSoft : Check whether user belongs to a role:


IsUserInRole(rolename1 [, rolename2]. . .)

Returns a Boolean value: True if the current user belongs to one or more of the roles in the user role array, False otherwise.

Example:
    
     &flag=IsUserInRole("Admin");

PeopleSoft : Passing values while transfer to another page:


&queryString = "&SOURCE=R";
            /* generate a url */
            &url = GenerateComponentRelativeURL(%Portal, %Node, MENUNAME.MenuName, MARKET.marketname,COMPONENT.componentname,PAGE.pagename,action);
           
            /* Append parameters */
            &url = &url | &queryString;
           
            ViewURL(&url, False);
Syntax:
  1. 1      GenerateComponentRelativeURL(PORTAL.portalname, NODE.nodename, MENUNAME.menuname, MARKET.marketname, COMPONENT.componentname, PAGE.pagename, action, [, keylist])
  2.    ViewURL(URL_str | URL.URL_ID [, NewWindow])
  3.    ViewContentURL(URL_str | URL.URL_ID)


Use the ViewContentURL function to launch a new browser window

Use the ViewURL function to launch the default browser

exmple:

&queryString = "&SOURCE=R";
&url=GenerateComponentRelativeURL(%Portal, %Node, MENUNAME.CH_MENU,"GBL",COMPONENT.CH_COMPONENT,PAGE.CH_PAGE,"U");
 &url = &url | &queryString;
           
 ViewURL(&url, False);

PeopleSoft : Check whether user belongs to a role through peoplecode:


IsUserInRole(rolename1 [, rolename2]. . .)

IsUserInRole() function is used to check whether current user has  the role in his profile or not.

This function returns  a Boolean value:
                                       True if the current user belongs to one or more of the roles in the user role array,
                                        False otherwise.


Example:
 local boolean &hasRole;
 &hasRole= IsUserInRole(CH_ROLE_EMPLOYEE);



&hasRole contains true if the currnet user has CH_ROLE_EMPLOYEE in his profile.

Nov 20, 2012

PeopleSoft : SQLEXEC () in RowInit PeopleCode

We cannot perform INSERT,UPDATE statement's through SQLEXEC( ) in Rowinit PeopleCode event.

Below is the alternative to perform insertion and updation in rowinit .

Creating a stroed procedure, that perform's the insertion or updation.
Execute the procedure using SQLEXEC( ) in rowinit.

Example:

1.Creating the stored procedures in Oracle

CREATE OR REPLACE PROCEDURE CH_SAMPLE_PROCEDURE
AS 
BEGIN
    UPDATE PS_CH_TEST_TBL
            SET  COUNT=100;
    COMMIT;
END CH_SAMPLE_PROCEDURE;

2.Execute the procedure
 
EXECUTE CH_SAMPLE_PROCEDURE;

Sample code in ROWINIT:

1.Create a sql object,that contains the sql for creating stored procedure.
    SQLEXEC(SQL.CH_TESTPROCEDURE_SQL);
   Here CH_TESTPROCEDURE_SQL contains a sql for creating stored procedure.
2.Execute procedure.
    SQLEXEC("EXECUTE CH_SAMPLE_PROCEDURE");

Note:
1. To create a stored procedure , you need to have permissions in database level.
2. If you want to check whether the stored procedure is created or not use the below sql.
SELECT * FROM ALL_PROCEDURES WHERE OBJECT_NAME='CH_SAMPLE_PROCEDURE'



Nov 12, 2012

PeopleSoft : Query to find the Menu Navigation



SELECT * FROM PSXLATITEM WHERE FIELDNAME = 'PROJECT_STATUS';SELECT DISTINCT RTRIM (REVERSE (SYS_CONNECT_BY_PATH (REVERSE (PORTAL_LABEL), ' > ')), ' > ') "PIA NAVIGATION"
  FROM PSPRSMDEFN
WHERE PORTAL_NAME = 'EMPLOYEE'
   AND PORTAL_PRNTOBJNAME = 'PORTAL_ROOT_OBJECT'
START WITH PORTAL_URI_SEG2 = 'RUN_PCPL1000'  à<Component Name>
CONNECT BY PRIOR PORTAL_PRNTOBJNAME = PORTAL_OBJNAME;