Monday, 7 December 2015

Paste from ClipBoard into Grid - PeopleCode Friday #4

A number of times in my PeopleSoft career I have been asked by users if I can provide a paste from the Windows clipboard into a grid.  Typical use cases include pasting Excel data into a grid or bulk loading text.

I've seen some PeopleCode and Javascript developer friends of mine code some really neat solutions but here I'm not going to attempt anything fancy.  I offer this code fragment for what it is - ruthlessly simple.

PIA Page with paste window and results grid

App Designer Page

Local Rowset &rs = GetRowset(Scroll.GRS_TBL);
Local array of string &aRows;
Local array of string &aFields;

&aString = CreateArray("");
&aFields = CreateArray("");

&aRows = Split(GRS_WRK.HTMLAREA, Char(10));

For &i = 1 To &aRows.Len
   &aFields = Split(&aRows [&i], "|");
   &rs(&i).GRS_TBL.SELNUM.Value = &aFields [1];
   &rs(&i).GRS_TBL.DESCR.Value = &aFields [2];

Some observations:

  • You can obviously change the separator from | (pipe) to whatever works for you. Comma is useful when pasting from Excel.
  • You will want to add some structure checking code.  If you're expecting 2 fields but a user pastes 3 then you'll want to trap that.  
  • You may want to do some datatype validation to avoid generating PeopleCode or component processor errors.
  • You could get really smart and create a button which reads data directly from the clipboard.  Most browsers don't allow you to do this for security reasons but there are ways to configure browsers to trust the clipboard.  
  • I've been using this recently to repeatedly flush and reload data into tables on a new application I've been building.  I went as far as making the table name a parameter and setting GETFIELD(n).Value rather than an explicit field name as I had numerous tables to populate.
Any other ideas or suggestions then, as usual, just post comments below.

Thursday, 26 November 2015

UKOUG APPS 15 Conference

The annual UK Oracle User Group Applications conference is a great place to network with other PeopleSoft users, partners and of course members of the Oracle PeopleSoft team.

There are sessions covering many PeopleSoft topics including
  • Oracle PeopleSoft Applications and Technology strategy - Jeff Robbins, Oracle 
  • PeopleSoft and the "cloud" from various industry experts
  • PeopleSoft Fluid UI and mobile computing
  • PeopleSoft Payroll Update
  • PeopleSoft Talent Management and Taleo
  • PeopleSoft Portal
  • Upgrade stories
  • and more....  Two Day Agenda Here

Come and share your stories, bring your questions and be part of the community.

See you there.

Friday, 30 October 2015

Query Definitions in PeopleCode - PeopleCode Friday #3

Just recently I've been working on a project which required me to dynamically create and manipulate PeopleSoft Query Definitions in PeopleCode.

I've always known the Query API Class existed but i've never really used it.  PeopleBooks, of course, is always my first place to look for documentation on how to use anything so went looking for Query Class methods, collections and properties and also to look for worked examples.  Unfortunately, whilst the reference material was adequate I found the worked examples confusing and with a few errors.  So, next port of call in my search was a general search in Google for "PeopleSoft Query API PeopleCode" looking for some other PeopleSoft enthusiast who had posted some working code. Allas!  Nothing.

So, after a bit of tinkering around I got everything I needed to work and thought it might be useful to write up a simple example that works.

Here goes.

Everything you need to know about Query classes you can find here

Watch out for the listed code examples... some of them don't work.

There are 5 basic steps to creating a simple Query Definition using PeopleCode.  You can create both public and private queries using the Query API. My example here will create a private against one the delivered PeopleTools tables present in all PeopleSoft systems of any version - PSPRCSRQST, and then set 2 sets of criteria.

1) Security.  Make sure the user that is ececuting the PeopleCode has permissions to the source record used in the construction of your Query. Use Query Access Manager for this.

2) In PeopleCode you need to create a Query Object from the %SESSION object

/* Get a Query oject */
&apiQuery = %Session.getquery();

3) Name the query and use the Create method to create a new Query Definition.  NOTE: If the Query Definition already exists then it overwrites it when you save. The second parameter specifies False for a private Query or True for a Public one.

/* Set Query Name.  Cannot contain spaces*/
&qryName = "MY_QUERY";

/* 3. Create a new Query */
&apiQuery.Create(&qryName, False, %Query_Query, "My query description", "My query long description");

TIP: Major sections of much of my code has numbers embedded in the comment headers.  This is just to help me and others that might have to maintain my code see instantly the sequence of flow.  It can be useful in long blocks of code.

4. When you use Query Manager in PIA to create a Query the first thing you do is specify which record the Query is based on. No different here.  Use the AddQuerySelect and AddQueryRecord methods to do this.  Because a Query Definition may have multiple SELECT statements in say a UNION and each SELECT may have one or more RECORDS you need to set these structures up even though your Query only has one SELECT and one RECORD.

/* 4. Create Query Select object and add single record from source drop down 
&apiQuerySelect = &apiQuery.AddQuerySelect();
&apiQueryRec = &apiQuerySelect.AddQueryRecord("PSPRCSRQST");

5. What you do next may depend on your requirements but for this example I'm just going to iterate through the RECORD collection of FIELDS and add each FIELD object to the output list of my Query.  In PIA this is the same as ticking each field in the Fields TAB,  The key Query API method that adds the fields if AddQuerySelectedField. There are 4 parameters to this method - Record Name, Record Alias, Field Name and Field Label).

Setting the ColumnNumber sets the sequence of the field in the output list and I'm Ordering by the Field in ordinal position 1 in a Descending order. (NOTE: OrderByDirection property requires the ASCII code for D (descending).  If you want Ascending don't use CODE("A").  Instead just leave the OrderByDirection blank or CODE("") ).

/* 5. Add all fields from Source Record  to Query Output list 
&recSource = CreateRecord(Record.PSPRCSRQST);
For &i = 1 To &recSource.FieldCount
   &apiQueryField = &apiQuerySelect.AddQuerySelectedField(&, &apiQueryRec.recordalias, &recSource.GetField(&i).Name, &recSource.GetField(&i).Label);
   /*Make the field a display field */
   &apiQueryField.ColumnNumber = &i;
   &apiQueryField.HeadingType = %Query_HdgRftShort;
   /* Set order by value is specified*/
   &apiQueryField.OrderByNumber = 1; /* sort column 1 */
   &apiQueryField.OrderByDirection = Code("D"); /*descending*/

6. If you run the Query now it would work but of course may return a lot of rows.  So let's add some simple criteria by creating a QueryCriteria object and using the AddCriteria method.  The parameter of the AddCriteria method is a string label.  It has no meaning and is simply a useful reference for the developer.

Once you have a handle on a QueryCriteria object it's really straight forward to specify the left (6.a) and right hand (6.c) expressions and the logical operator (6.b).

My code below in section 6 creates the following criteria

             WHERE RUNSTATUS = '9' AND OPRID = 'VP1'

/* 6. Create Query Criteria  
      In this example we'll setup     RUNSTATUS = 9 AND OPRID = VP1

/* 6.a. LEFT expression is a field */
&apiQueryCriteria = &apiQuerySelect.AddCriteria("criteria_1");
&apiQueryCriteria.logical = %Query_CombAnd;
&apiQueryCriteria.Expr1Type = %Query_ExprField;
&apiQueryCriteria.AddExpr1Field("A", "RUNSTATUS");

/* 6.b. Set expression operator */
&apiQueryCriteria.Operator = %Query_CondEqual;

/* 6.c. RIGHT expression is a constant */
&apiQueryCriteria.Expr2Type = %Query_ExprConstant;
&apiQueryCriteria.Expr2Constant1 = "9";

/* Second criteria row 

/* 6.a. LEFT expression is a field */
&apiQueryCriteria = &apiQuerySelect.AddCriteria("criteria_2");
&apiQueryCriteria.logical = %Query_CombAnd;
&apiQueryCriteria.Expr1Type = %Query_ExprField;
&apiQueryCriteria.AddExpr1Field("A", "OPRID");

/* 6.b. Set expression operator */
&apiQueryCriteria.Operator = %Query_CondEqual;

/* 6.c. RIGHT expression is a constant */
&apiQueryCriteria.Expr2Type = %Query_ExprConstant;
&apiQueryCriteria.Expr2Constant1 = "VP1";

7. Saving the Query will perform all sorts of validation and generate a useful collection of error messages.  Just remember "garbage in - garbage out".  The PIA Query Manager prevents the user from creating most illogical combinations when designing a Query so you're going to have to handle all possible error conditions in your code.

/* 7. Save the Query and handle any error messages 
&res = &apiQuery.Save();
If &res <> 0 Then
   &colMessages = %Session.PSMessages;
   For &i = 1 To &colMessages.Count
      &errorObject = &colMessages.Item(&i);
      &messageText = &messageText | &errorObject.Text;
   Error ("An error has occurred saving the query: " | &messageText);

8. At this stage, assuming your Query has saved, you can open the Query in PIA Query Manager/Viewer and execute it.  But my example below includes the generation of a Query URL and a New Window execute by simply viewing the URL.

/* 8. Run PeopleSoft Query to new Window 
&isPublic = False;
&isNewWindow = True;

Local string &url = GenerateQueryContentURL(%Portal, %Node, &qryName, &isPublic, &isNewWindow);

ViewContentURL(&url, &isNewWindow);

Always happy to field questions, comments, observations, improvements or corrections.  Hope you found this a useful starter to creating Query Definitions in PeopleCode .

OpenWorld 2015 Thursday

Every year I find myself saying the same.... "The PeopleTools team keep on delivering".  Oracle is certainly not in maintenance mode with PeopleSoft.  There's a huge amount of investment going into making PeopleSoft better and better each year.  If you're running PeopleSoft then it's a safe place to be. In fact beyond being safe it's an exciting place to be.  The challenge, as always, will be to find the time and money to take advantage of all these new developments so that our organisations reap the benefit.

Today there were some great session for PeopleSoft customers.  Here's just a quick listing of some of my favourites,

1. PeopleSoft Selective Adoption Experiences from the Front Line.  This session was led by Cedar Consultant, Oracle ACE - The PeopleSoft Tipster - Duncan Davies and Mark Thomas (IT Director at Hays).  This was one of 9 other sessions across the week on Selective Adoption - a major theme of this OpenWorld Conference.  Practical insight into how Selective Adoption works and is bringing new efficiency to Hays' PeopleSoft software lifecycle.

2. Fluid UI Component Design and Development.  From Dave Bain (Product Manager, Oracle).  This was the other major theme of this years OpenWorld conference.  Dave is a great presenter and you may have heard him on the Selective Adoption Spotlight Videos.  He gave a run down of the important things to consider when build a new Fluid page or when converting a Classic page to Fluid.

3. Rolling Out PeopleSoft’s Suite of Lifecycle Management Tools.  Michael Krajicek, Vice President - Oracle PeopleSoft Application Architecture Development gave a great talk on what's coming in 8.55 from PUM and PTF.  I think one of the most exciting new features is that you will be able to load up into the PeopleSoft Image a project of your customisations and then when the Change Package is created it will flag up which Updates are going to affect your customisations.
Change Package showing a green flag in the 2nd column indicating a customisation impact for this Update - Nice!

4. PeopleSoft Technology: Executive Panel.  Always a popular and candid session featuring customers vs the PeopleTools senior strategy and product management team.  Here's a few of the questions and my interpretation and paraphrasing of the answers.

Q. What improvements are going to be made to Application Designer?  
A. We want to make the development tools as easy to use as possible. I can't share our plans in detail but you can expect new tools for developers similar to what you've seen at OpenWorld this week. (GS: My take on this is that we saw some very cool drag and drop web based forms builder in Fluid.  I wonder if we might one day see a web based page builder for Fluid? It's all just meta-data underneath.)

Q. When will PeopleTools 8.55 be released?
A. Sometime in the next 12 months.  (GS: but more likely sometime in the next few months).

Q. When will Elastic search be available?
A. Not with the GA of 8.55 but sometime in 2016.

Q. Will we be able to take advantage of Elastic search as a service?
A. Initial release to customers will be on installed on premise or in cloud like we do at the moment with SES but Elastic service offering will be looked at.

Q. What is the PeopleTools team doing to help customers secure PeopleSoft on the public internet.
A. (paraphrasing here) Not a great deal.  In the same as PeopleSoft does not provide you with Anti-Virus for your PC or network switches PeopleSoft does not provide the networking security components to secure client to PeopleSoft web server.

Q (to audience). Who is using Interaction Hub under the PeopleTools limited free license?
A. No one.  (I didn't see any hands go up).  Conclusion?  Consensus from people around me in the session hall was that most customers couldn't justify the cost of the separate PeopleSoft instance required for IH.

I'm sure to blog more over the coming months about specific things talked about at OpenWorld but I'd like to end this week with saying just how wonderful it is to be part of this community called PeopleSoft.  The people involved in developing and supporting PeopleSoft are all first-class technology professionals who are on the forefront of thinking in our rapidly changing and sometimes volatile IT industry.  And then there's the customers and partners who bring a wealth of ideas, questions, challenges and solutions. They all make this global PeopleSoft community such a pleasure to be a part of. Thank you!
Paco Aubrejuan - Senior VP, PeopleSoft Enterprise, Oracle

Oracle Appreciation Party

Jeff Robbins - PeopleTools Strategy, Oracle

Howard Street - normally full of traffic- this week, full of Oracle people

Thursday, 29 October 2015

OpenWorld 2015 Wednesday

Another packed day of great PeopleSoft news, tips and networking.  Just a few of my favourites from today

1.  PeopleSoft Cloud Deployment Architecture.  So, the PeopleSoft strategy guys have said that Oracle are not going to selling PeopleSoft SaaS.  However, the whole installation and deployment paradigm is changing with PeopleTools 8.55 and this will make it much easier to deploy to Oracle Public Cloud or any other public or private cloud or virtualisation platform.  New tools and processes will help customers provision and deploy new PeopleSoft instances automatically.

2.  Automated Configuration Manager (ACM).  Another exciting feature presented by Mark Hoernemann and Biju Narayanan from the Oracle Platforms team which is coming with PeopleTools 8.55 (which is "coming out very soon").
ACM will allow customers to automate the configuration and setup of parts of a PeopleSoft system once a new instance has been deployed.  All the components that administrators used to have to configure manually or with scripts such as Node Definitions, Integration Broker, Gateway Nodes, REN Server, Process Schedulers, URL objects, etc, will all now be orchestrated in meta data registered in your PeopleSoft system. Very powerful. Great time saver and will help customers improve quality and delivery time of new system instances.

3. PeopleSoft Update Manager Customisation Analysis.  Coming in 8.55 is a new feature which will take meta data about your customised objects, load it up into the PeopleSoft Image and then when you create a Change Package it will cross reference it with your customisation.  Now you can see immediatley the effect of the updates on your customisations without having to load the package project up into App Designer and run the compare reports.  Can't wait to see this in action.

So much more from today but after a fantastic musical treat from Sir Elton John at the Oracle Appereciation Party it's too late to type any more.

Wednesday, 28 October 2015

OpenWorld 2015 Tuesday

Today in the PeopleSoft stream of this massive Oracle OpenWorld conference the key messages have been

1. FLUID:  All applications being built going forward will be built using Fluid technology.  It is the primary UI.  It's not just a mobile technology.  It is the PeopleSoft UI now. Classic, of course will still be available and supported.

2. SEARCH:  In response to concerns over the future of Oracle SES the announcement today is that Elastic Search will be available to use sometime in 2016.

No PeopleSoft SaaS

3. CLOUD:  Oracle are NOT investing in a PeopleSoft SaaS offering.  However, tools and features are being added to PeopleSoft in order to make it much easier to manage in a private or public cloud environment.

Cloud "enable" PeopleSoft

4. PEOPLETOOLS 8.55+:  A whole ton of new features and improvements arriving in PeopleTools 8.55 and beyond including
  • Fluid Dashboards
  • Fluid Activity Guides with horizontal and vertical train-stops
  • User will see the Fluid Homepage when they login as default now.
  • Tile Wizard (like Pagelet Wizard)
  • Central Homepage administration with push mechanism to deploy to users
  • Tiles can now be resized by the user
  • Navbar will now remember your context when it's collapsed and works a lot faster 
  • Fluid Master/Detail pages

Fluid WorkCentres 

Fluid Simplified Analytics

Fluid Drag and Drop Forms Builder

Fluid Related Content

Fluid Cloud Attachments (wonder why Oracle Cloud Storage is not there?)

Fluid NavBar Improvements

Fluid User Preferences

Improved Fluid Approvals / Workflow

I ended the day with my Cedar Consulting colleague and friend Duncan Davies (aka The PeopleSoft Tipster) on the Penthouse roof terrace of The Battery for a UK Partner networking event and BBQ.

Tuesday, 27 October 2015

OpenWorld 2015 Monday

What a great privilege it is to be part of the annual Oracle OpenWorld conference and to meet Oracle staff and customers here in sunny San Francisco.

Larry Ellison's Opening Keynote can be found here.

Let me try and sum up my day.

Firstly, the theme of this years conference ?  Cloud .  Oracle are naturally talking about their cloud services - IaaS, PaaS, SaaS - HCM Cloud, ERP Cloud, Marketing Cloud etc.

Having attended a number of sessions today and presented one myself here are my 5 take-aways from today's conference.

1. "PeopleTools is going to brought into the Selective Adoption model" (Greg Parikh, Vice President of Oracle PeopleSoft Information Development)  Always thought this was going to be too difficult or expensive for PeopleSoft to do.  So, either I heard incorrectly or Greg meant something else.

Tips & Techniques from Jim Marion
2. Jim Marion's excellent "PeopleTools Tips & Techniques" session covered a number of "tips". My favourite was the new 8.54 Websockets feature.  Allows a browser client to open a presistant connection (websocket) with the PeopleSoft web server and receive push messages from the Web Server to the client.

Selective Adoption Panel
3. Selective Adoption Panel (Ataway, Deloitte MIPRO) and It appears there may still be some confusion around the basics of Selective Adoption and in using the PeopleSoft Update Manager.  If anyone needs any help then Selective Adoption experts, Cedar Consulting, would be more than happy to help - please contact them here. Selective Adoption at Cedar.  Hearing a lot of concerns about making sure your're on a PeopleTools release that is certified with the updates you're applying.  Firstly, this is nothing new.  PeopleSoft users have always needed to be on a certain PeopleTools release before applying some updates - the difference now is that because selective adoption is making it significantly easier to apply updates then the probability that a PeopleTools upgrade may also be required is high.  Secondly, don't get confused over the PeopleTools release that Change Assistant requires to run and the PeopleTools release of your target system.

4. I presented on PeopleSoft UI: Fluid, Classic or Both? A Decision for every customer.  If you missed it or need to download the slides you can get them here.  Thank you to those that came along, showed an interest and asked questions.

5. Great session featuring two PeopleSoft 9.2 customers Boeing and BDO USA talking about the positive experience with PeopleSoft WorkCenters.  They showed clear value in WorkCenters in terms of reduced clicks for common transactions, improved one-stop navigation, increase in user takeup and adoption of system.  They clearly showed that WorkCenters are more than just navigation aids but can be used for processing transaction without even leaving the WorkCenter.

Friday, 23 October 2015

Five more things not to miss at Oracle OpenWorld 2015

Five more things not to miss at Oracle OpenWorld 2015.

1. Keynote by Thomas Kurian (President, Product Development, Oracle). Oracle Software
Innovations. I think this is the keynote to watch. . If you like a little American glitz then queue up for a seat in the ridiculously big keynote Moscone North, Hall D or watch online from the comfort of your hotel or favourite coffee shop.

2. DEMOgrounds - Spending time between sessions at the DEMOGrounds is a great way to meet PeopleSoft experts from Oracle other customers too.  Seen something in a session and want to know more? Dig a bit deeper into new application functionality or some new PeopleTools feature.  Track down the right demo pod and don't be afraid to request a demo.  I highly recommend listening in on other people's conversations too.

3.  Mobile Central located in Moscone South exhibition hall.  Anything and everything about Oracle's Mobile strategy, products and technology.

4. General Session: PeopleSoft of Today and Tomorrow—Intuitive, Powerful, and Easy [GEN8298] session . Hear from Paco Aubrejuan, Senior Vice President, PeopleSoft Enterprise, and Marc Weintraub, Senior Director, PeopleSoft Product Strategy, Oracle.  Register  Register early as this session is always full to overflowing.

5. PeopleSoft Technology Update [CON8585] from Jeff Robbins, PeopleSoft Strategy, Oracle.  There's sure to be a useful reminder as to all the PeopleTools features packed into 8,54 and maybe a bit on what's coming in 8.55 and beyond.

Monday, 5 October 2015

Oracle OpenWorld 2015

5 things not to miss at this years Oracle OpenWorld conference.

1. What's coming in PeopleTools 8.55?  Lookout specifically for information on what the tools team has done to make PeopleTools more cloud ready and what this means in practical terms.   The PeopleTools development team never disappoint.   Checkout the following sessions for all the detail...

2. Top PeopleTools blogger and developer expert Jim Marion will be presenting his ever popular PeopleSoft Developer: Tips and Techniques [CON8596] on Monday @ 12.15pm Moscone West 3007.  Always amazed at how much Jim packs into these famous Tips & Techniques sessions and with the creative ideas he gives us.

3. Lookout for Jim's new book  PeopleSoft PeopleTools: Mobile Applications Development .  Order now from Amazon or pick one of at the Oracle bookstore.  I'm sure Jim, along with many other members of the PeopleSoft team, will be around on the DemoGrounds to answer questions and demo all the latest stuff.

4. The PeopleSoft Tipster and Cedar technical consultant, Duncan Davies, will be presenting on Selective Adoption with Mark Thomas from Hays Recruitment.  PeopleSoft Selective Adoption Experiences from the Front Line [CON7071] is sure to filled with front-line real world experiences, tips and ideas on how to make Selective Adoption work for you.  Thursday @ 9.30am Moscone West #3003.

5. If you're doing anything with Fluid UI then you might want to look in on my own session on PeopleSoft UI: Fluid, Classic, or Both? A Decision for Every Customer - [CON2848] on Monday @ 4.00pm in Moscone West #3016.  I'll try and unpack the many choices around designing a user interface that works best for your users and figure out what to do with Classic UI now that we have Fluid UI.

Members of the Cedar Consulting team are presenting twice on this packed PeopleSoft agenda stream.  We were so excited at this opportunity to share our knowledge and discuss we produced a video.....

Looking forward to meeting with this wonderful PeopleSoft community again.   See you at OpenWorld.

Friday, 2 October 2015

Rowset to Excel - PeopleCode Friday #2

We all know that PeopleSoft grids can be exported to Excel using the button on the grid status bar.

But what if the data you want to export to Excel is not in a grid?  What if you need to programatically export data using PeopleCode.

I'm sure there are many ways to do this but I recently came across this useful technique for exporting RowSet record data to Excel.   Here's a working code sample.

The magic is in the use of the FormatResultString method from the Query class.  This accepts a rowset as input and will produce a string of HTML which when opened in Excel does just nicely.

HTML produced by the FormatResultString method

HTML opened in Excel

I've repeated the code below if you want to copy it.

 Local string &strExcel, &fileName;  
 Local File &exportFile;  
 /*Create a rowset. This can be a standalone or buffer rowset */  
 Local Rowset &rs = CreateRowset(Record.PSPRCSRQST);  
 Local object &qryObject = %Session.GetQuery();  
 /* Create a file on the application server */  
 &fileName = "Output_" | %UserId | %Date | %Time | ".XLS";  
 &exportFile = GetFile(&fileName, "W");  
 If &exportFile.IsOpen Then  
   /*Use the FormatResultString method of the Query object to generate Excel string */  
   &strExcel = &qryObject.FormatResultString(&rs, %Query_XLS, 1, &rs.RowCount);  
 /* Add attachment and view */  
 &putFileName = "files/" | &fileName;  
 /* Pickup the app server file, attach and view */  
 /* CommitWork is required as ViewAttachment is a thinktime function.  
   Using an iScript to view the attachment is another option here.   
   See Jim Marion here  
 &res = PutAttachment("record://PSFILE_ATTDET", &fileName, &putFileName, "PS_SERVDIR");  
 &res = ViewAttachment("record://PSFILE_ATTDET", &fileName, &fileName);  

Please feel free to discuss other methods you know of in the comments below.

Friday, 28 August 2015

Checkbox with Error - PeopleCode Friday #1

This is the first in what I hope to be a regular Friday feature on PeopleCode.  I hope you find these useful.

Today's puzzle came from a friend of mine David Jubber at BMI Healthcare - thanks David !

QUESTION:  What happens if you tick ON a check box but during the FieldEdit event an ERROR is thrown?

OPTIONS:  Would you expect it to display the error message and...

   (A) leave the check box ticked ON, or
   (B) leave the check box unticked

Figure 1 shows the PeopleCode behind the check box and I'm simply throwing an Error if the user is gsmith.
Fig 1. Code to validate the change of CheckBox

Fig 2. Error Message after check box ticked ON

ANSWER:  The answer is OPTION (A).  The tick is left ON even though the Edit (validation) fails the Edit test.

Is this what you were expecting?  It might not behave quite as you wanted.  After all ... the edit failed.... so clearly I shouldn't be allowed to tick the check box on.  So, let's try and code around this behaviour and undo the tick action with what seems like some obvious PeopleCode.  See Fig 3.

Fig 3.  Code to revert the tick action
However, as you can see from Fig. 4 it's not possible to make change to the current field in FieldEdit.  (you can read more on processing sequence in PeopleBooks ).

Fig 4.  Illegal operation to set current field value during FieldEdit


One possible solution might be to move the code from FieldEdit to FieldChange, use a MessageBox function instead of ERROR and handle the "exit error" from the event manually.   FieldChange allows the setting of current field and can therefore reset the checkbox value to OFF.

Interestingly, Radio Buttons do not behave the same.  This next example uses the same field and the same code but the radio button change is reset to it's original value if the Edit fails.

Fig 5. Radio buttons behave as OPTION (B)
  • Which one do you prefer?  
  • I wonder why they behave differently?  
  • Can anyone suggest another solution to revert the check box on ERROR?
  • Why doesn't the checkbox get highlighted red?
NOTE: I'm not responsible for the label typo on field object PTCHKBX.  That's a delivered PeopleTools object.  :-)