Friday, January 16, 2015

PeopleSoft: Avoiding the "Class Rowset method InsertRow changes current program context" Error When Inserting and Deleting Rows Using Your Own Icons

One of the bugs (as of Tools 8.53) with specifying other than the default icons for inserting or deleting rows from a grid or scroll area is that with each successive row, the icons shift further and further to the right. In trying to fix this in the past, I've always encountered the pesky "Class Rowset method InsertRow [or DeleteRow] changes current program context" error.

In this article, I'll describe how you fix that.


I don't really like the default + and - icons that come delivered with PeopleSoft.  Illustrated below are those blah icons placed next to a much more attractive trash can (delete) icon that I created.



I've now made my trash can icon take the functional place of the - icon, but it was a bit tricky figuring out how to do it.

In the past, when trying to incorporate my own icons, I used to create a push button that contained the image that I wanted and then associated it with component record PeopleCode that did something like this:


But, if you place your icon inside the grid scroll area (on the page Order tab), so that it shows up on every row, invoking it using PeopleCode causes this error:


Here's the solution.  Instead of attempting to use PeopleCode to insert or delete rows from your rowset, use a ScrollAction, as shown below.


In the second green circle above, you'll notice an Action Type of "Row Delete" and a Related Control of "48 |".  What does "48 |" represent?  It represents the number (on the page Order tab--see screen shot below) of the scroll area or grid that you want to apply the Scroll Action to.


Hopefully this explanation saves you a lot of time and headache.  Let me know (in the comments below) if this solution works for you, or if you need a more detailed explanation.

Now I just need to go back and apply this fix to several pages that are already in production.  J

7 comments:

Eric said...

I'm not trying to brown-nose or anything, but thanks for sharing.

Frank Staheli said...

Give that man a raise!!! ;-)

Shubham said...

Thanks mate..!! This is useful..!!

Unknown said...

Hi,

I am trying to use this on a grid. It works when I have the "no row insert" and "no row delete" options unchecked for the grid properties. But when I check both in order to hide the default add/delete buttons, this function no longer works.

Does anyone have a solution to this?

Selva said...

In grid i have delete button and getting the same error..please help.

DJDanno said...

Thanks so much, this solved a very frustrating problem.

Anonymous said...

Must say, this helped me tremendously to get over a frustrating problem. Thank you so much for posting.