Showing posts with label PeopleCode. Show all posts
Showing posts with label PeopleCode. Show all posts

Thursday, August 21, 2014

Application Designer Page not responding

When you have a complex page with a Level 1 scroll area and lot of group boxes on a single page and try to move a field using arrow key, page becomes un responsive and CPU goes to 100% usage for one particular core. The control comes back after a minute. If you want to align lot of fields it becomes cumbersome. This is observed with PeopleTools 8.53.12 on a custom page with HRMS 9.1 on multiple windows 7 64 bit laptops (Dual Core with 8 GB RAM). Clearing the cache or rebooting the machine does not help.

Workaround : What we found is that changing the fields under a scroll area to a subpage (All fields must be level 0 in a subpage) and using that subpage resolves the issue. I have not seen this before in older PeopleTools releases (8.50 and earlier) and so it seems to me a new issue.

Oracle Support was able to replicate this issue and opened a new Bug 19492406 - APP DESIGNER GOES INTO NOT RESPONDING STATE WHEN MOVING A PAGE FIELD .

There is also a BUG 18773369 and 19565638  related to this issue.

This issue is fixed in 8.55 and 8.54.03. Currently there is no fix for 8.53, but the below workaround also works in addition to moving fields to sub pages. The fix may be included in 8.53.18.

Click on Application Designer Menu item Layout->Grid Settings..., set the Show Grid to No. This can minimize the refresh, but this is not a permanent setting. Every-time a page is opened, click Layout->Grid Settings..., set the Show Grid to No must be done.

If you are on lower 8.53 patch level you can request a POC fix which provides updates to psped.dll and pspnlrtwin.dll to resolve the issue.

Patch name : 19531601 and POC is POC-913314-02.

Monday, March 21, 2011

Changing the Userid when triggering the subscription peoplecode.

You can use the following IntBroker Class method : SwitchAsyncEventUserContext to change the context of the peoplecode run inside subscription peoplecode. This is to be used by IB only (there are checks to make sure that is the case) and can only be used for IB events that are fired asynchronously (OnRoute, OnSend, OnNotification, etc..). One use case is if you are submitting a process request from a self service user id and you do not want to give access to query security to each user who is triggering the message. This method is added in PT 8.50 and not available for lower tools release.

For more info use : E-IB: User Security required on target db for async messages in 8.48.0x [ID 654592.1]

PeopleBook definition of this method is as follows.

SwitchAsyncEventUserContext


Syntax
SwitchAsyncEventUserContext(UserID, LanguageCode)
Description
Use the SwitchAsyncEventUserContext method to switch the user context within an Integration Broker asynchronous event.
Parameters
UserID
Specify the user ID, as a string, to which you want to switch the context.
LanguageCode
Specify the language code, as a string, for the user ID.
Returns
A Boolean value: true if the switch user was successful, false otherwise.
Example
&returnValue = %IntBroker.SwitchAsyncEventUserContext("VP1", "ENG");

Thursday, December 09, 2010

SQLExec : Return: 8015 - Bind value is too long

You get this error in an online page or while running a Application engine program. This error happens when you try to insert more than 254 characters in a long field using sqlexec and do not use %TextIn meta sql.

Resolution

Use %TextIn meta-sql for the bind variable that is used for inserting into a long field. For e.g. %TextIn(:1)

%TextIn is documented in peoplebooks and is mandatory for all insertions/update of LongChar fields using sqlexec for all database platforms.

Here are some resolutions that discusses this issue in Metalink – Oracle support site.

E-AE Application Engine PeopleCode Step with SQLExec Receives Error; return code 8015 "Bind value is too long" [ID 889806.1]

E-PC:"Bind value is too long" Error When Using SQLExec to Insert into Long Char Field [ID 620874.1]

Thursday, January 15, 2009

Validate Userid and password against LDAP directories Using PeopleCode

Following peoplecode is tested in 8.48.16 and assuming that you are using Oracle Wallet and LDAP libraries for connecting to ldap server. (Tested on HP*UX 11.11 server). It also assumes you have LDAP Port, Server name, Default Connect DN defined in PeopleTools -> Security -> Directory ->  Directory Configuration. LDAPS Port is optional but highly recommended. This can be used in following scenarios.

You are logged in PeopleSoft with generic id and you need to validate user's password against ldap directory. Or you want to see  programmatically if the user exist in LDAP with a valid password.

 

Create this as Class to Application Package: XX_UTILS

class LDAP
method ValidatePassword(&userid As string, &pwd As string, &directory_id As string) Returns boolean;
end-class;

method ValidatePassword
/+ &userid as String, +/
/+ &pwd as String, +/
/+ &directory_id as String +/
/+ Returns Boolean +/
Local string &defaultDN, &dn, &outDN, &server, &SSL;
Local integer &port, &nonsslport, &sslport, &EXECRSLT, &start, &num_chars, &ret;
Local Interlink &LDAP_BIND;
Local BIDocs &rootInDoc, &rootOutDoc;

SQLExec("select a.DSCNCTDN, b.DSSRVR, b.LDAPPORT, b.ldapsport from PSDSDIR a, PSDSSRVR b where a.DSDIRID = :1 and a.DSDIRID = b.DSDIRID", &directory_id, &defaultDN, &server, &nonsslport, &sslport);
If All(&sslport) Then
&SSL = "YES";
&port = &sslport;
Else
&SSL = "NO";
&port = &nonsslport;
End-If;

If All(&server, &port, &defaultDN) Then

&LDAP_BIND = GetInterlink(Interlink.LDAP_BIND);
&LDAP_BIND.UserID_Attribute_Name = "uid";
&LDAP_BIND.URL = "file://psio_dir.dll";
&LDAP_BIND.BIDocValidating = "Off";
&LDAP_BIND.SSL = &SSL;
REM &LDAP_BIND.SSL_DB = "e:\certs\cert7.db";
&start = 5;
&num_chars = Find(",", &defaultDN) - &start;
&dn = Replace(&defaultDN, &start, &num_chars, &userid);
&rootInDoc = &LDAP_BIND.GetInputDocs("");
&ret = &rootInDoc.AddValue("Server", &server);
&ret = &rootInDoc.AddValue("Port", &port);
&ret = &rootInDoc.AddValue("Distinguished_Name", &dn);
&ret = &rootInDoc.AddValue("User_Password", &pwd);
&ret = &rootInDoc.AddValue("Encrypted", "NO");

&EXECRSLT = &LDAP_BIND.Execute();
If (&EXECRSLT = 1) Then
&rootOutDoc = &LDAP_BIND.GetOutputDocs("");
&ret = &rootOutDoc.GetValue("Distinguished_Name", &outDN);
If &outDN = &dn Then
Return True;
End-If;
End-If;
End-If;

Return False;
end-method;

Sample
code to call the function.

import XX_UTILS:LDAP;

Local XX_UTILS:LDAP &ldap = create XX_UTILS:LDAP();
Local boolean &return;

&userid
= "userid"
&pwd = "xxxx";
&directory_id
= "LDAP";
&return = &ldap.ValidatePassword(&userid, &pswd, &directory_id);
If &return Then
/* success */
else
/* failure */
end-if;

Thursday, April 03, 2008

Retrieve milliseconds from Oracle database and display it on a page.

You can use the following SQL to get milliseconds from Oracle 9i and higher and assign it to a Field of Type Time in PeopleSoft page. May Place this code in FieldDefault event.

SQLExec("select TO_CHAR(SYSTIMESTAMP,'HH24:MI:SS.FF') from dual", XX_TEST_DERIVED.XX_TIME);

Set the Time Formatting to HH:MI:SS:999999 in Field properties.

For Date Time Field, use the following SQL.

SQLExec("select TO_CHAR(SYSTIMESTAMP,'YYYY-MM-DD-HH24:MI:SS.FF') from dual", XX_TEST_DERIVED.XX_DATETIME);

Set the Time Formatting to HH:MI:SS:999999 in Field properties. Select Display Century and Display Time Zone in Page Field Properties to display complete date and time.

You will see this on page as follows:`

image

Friday, December 07, 2007

ORA-00022: invalid session ID; access denied

If you are getting this error, here is a quick fix.

Set the following value in psappsrv.cfg (appserver) and psprcs.cfg (batch server) for all the configured appservers and batch servers. You may have to reconfigure the appserver and batch servers and restart them.

DbFlags=8

Default value is DbFlags=0 which means use Persistent Secondary DB Connection.

Setting DbFlags=4 is not recommended by PeopleSoft, which completely disables the secondary database connection.

Setting it to 8 disables Persistent Secondary DB Connection, but it still uses on demand Secondary DB Connection for each request. This is required for using GetNextNumberWithGapsCommit (GNNWGC) function, which is internally used by PeopleSoft for workflow transactions to generate APPR_INSTANCE

If you do not do this, you may get row inserted in PS_APPR_INST_LOG with

APPR_INSTANCE = 0

which may cause, some undesired workflow routings.

The easiest solution I have found is

delete from ps_appr_inst_log where APPR_INSTANCE = 0

Please make sure that you backup the data and test it.

Here is some more information on GetNextNumberWithGapsCommit (GNNWGC) function from peoplebooks.

Use this function instead of the GetNextNumberWithGaps function. The GetNextNumberWithGaps function is very restrictive in its usage. The GetNextNumberWithGapsCommit function can be used in any event. The sequence number (record.field ) is incremented right away and it doesn't hold any database internal row lock beyond the execution of this function.

Note. A secondary database connection is used to increment and retrieve record.field. The default behavior is to keep the secondary database connection persistent in order to improve performance for the next GetNextNumberWithGapsCommit usage. If the database administrator finds the persistent connection too high an overhead for the production environment (which should not be the case since PeopleSoft uses application server to mulitplex the database connection), the database administrator can change the default behavior to use an on-demand connection method. The persistent second connection is disabled using DbFlags bit eight in the application server and process scheduler configuration files. The second connection can be completely disabled using DbFlags bit four in the application server and process scheduler configuration files

This issue may be happening in Tools 8.45 and higher (8.46, 8.47, 8.48, 8.49 etc.), as secondary connection is introduced in 8.45.

See Peoplesoft Customer connection Resolutions for  more information.

Resolution : 201049233 - E-ORACLE:10g Master Performance Solution for Oracle 10g 

In this resolution, PeopleSoft generally recommends to Set DbFlags=8. I hope thay deliver this value by default in future peopletools releases.

Resolution : 201049902 - E-PC: Sporadic ORA-00022 Errors in AE w/ GetNextNumberWithGapsCommit PCode

Resolution : 201022463 - E-NV nVision reports that are run on Client Machine fail - Error message Invalid Cursor Number

Resolution : 201015931 - E-SEC: SQL looking for inactive roles causes slow logins for users

Resolution : 201023068 - E-WF:Deadlocks whenever a high load of transactions create worklists 

Resolution : 201024183 - E-NV Running nVision via Define Report Book gives 8055 cursor entry error

Resolution : 200987809 - E-NV: nVision reports are queued when running in Windows 3 tier mode

Note : All the discussion is surrounding oracle database only. I found that it is disabled automatically for informix. For all other databases you may need to test the functionality your self.

Tuesday, November 27, 2007

Alternative to SendMail Function : PT_MCF_MAIL

You can use Application package PT_MCF_MAIL (PeopleTools 8.46 or higher only) to generate emails instead of using SendMail peoplecode function.

Go to the PeopleBooks to get the complete description.

Home > PeopleBooks > Enterprise PeopleTools 8.48 PeopleBook: PeopleCode API Reference > Mail Classes

Go to Mail Classed Example section to see How to use these classes. Following examples are provided.

  • Creating Text Email
  • Creating Email and Overriding SMTP Settings
  • Creating HTML Email
  • Creating Multi-Part Email With Both Text and HTML Parts
  • Creating HTML Email with Images
  • Creating Email with Attachments
  • Creating Email Attachments Specifying a URL
  • Creating Multiple Emails
  • Authenticating Email While Sending

Advantages

  • Structured Code
  • Can generate HTML Email
  • Can override Default SMTP Parameters
  • Better Error Handling
  • Send emails  return receipt request (email reception notification)
  • Ability to set Message priority

 

Reference

 

Issues

  •   You might not be able to use GetHTMLText in Application Engine program run using process scheduler or in 2 tier mode, as this function does not support bind variables in 2 tier mode. PeopleBooks list the following constraints for this function.

    Restrictions on Use
  • Use this function with the PeopleSoft Pure Internet Architecture. If run from a 2 tier environment, the parameter substitution does not take place.

Wednesday, January 04, 2006

How To Skip Search Dialog Box

Sometimes you want to suppress Search dialog box during the Page display. You must understand the default search dialog box processing and then determine what can you do to alter it programmatically.

  1. At Component Definition Level under Use Tab after Add Search record, there is a checkbox Force Search Processing. The Default is cleared which means do not display the search dialog box, if following conditions are true.
    a> All required keys have been provided (either by system defaults or by PeopleCode)
    b> If this an Add dialog box, then no "duplicate key error" results from the provided keys; if this error occurs, the processing resets to the default behavior.
    c> If this is a Search dialog box, then at least one row is returned based on the provided keys.

  2. If you select the Checkbox Force Search processing, then even if the above conditions are true, system will always display the search dialog box.

  3. To alter the search dialog box behaviour programmatically, irrespective of Component Definition Force Search Processing checkbox, You need to use SetSearchDialogBehavior(force_or_skip if possible) function in SearchInit event of the SearchRecord-> SearchField or at component level Search Record. for skip if possible use value 0 and for force display use value 1

  4. Another way of skipping the search dialog box is to use a search record which do not have any search keys defined for e.g Derived/Work record. It can be any record as long as it does not contain any fields with search key attribute selected in record field property.




Note: The above methods to skip search dialog box (except records with no search key) only works, if you meet the condition specified in 1 i.e. all the key items has values and it returns at least one row and no errors occur. You can use SetSearchDialogBehavior to override component level setting in searchinit event. Also see this Post for more info. SetSearchDialogBehavior


Tip: (8.4x tools rel only) To directly navigate to a page with portal navigation

Link: http://server/servlet_name/SiteName/PortalName/
NodeName/content_type/content_id?content_parm

For components content parameters are : Page=pagename&action=action_value&key_id=key_value

If you do not specify the Page then it goes to the first page in component.

Action = A - Add, U - Update/Display, L - Update/Display All, C - Correction

KeyIDs are actual Field Name of the Search record that has search key attribute set.

To display a page and navigate to that page for e.g URL Maintenance Page the URL will be

https://servername/psp/ps/EMPLOYEE/EMPL/c/
UTILITIES.URL_TABLE.GBL?Page=URL_TABLE&Action=U&URL_ID=CMDOCDB

where psp - Portal servlet, use psc - content servlet to go to page without portal navigation

Sitename = ps, Portal Name = Employee, Node Name = EMPL and Content Type = C for Component,

Content ID = <menu>.<component>.<market>

Menu = UTILITIES, Component = URL_TABLE, Market = GBL

Key ID: URL_ID

Key Value: CMDOCDB

This link will open directly the URL Maintenance page with URL Definition of CMDOCDB.