Add row rerender on a list with input fields looses data

Having a list in your controller that is displayed as input fields either through pageblock or repeat and you need to add another row to the list via a button.  Chances are when you enter data on any input field on any row and you hit Add Row button that has a rerender attribute that makes the ajax call, the previous entered data will be lost as per code sample below.

public class MyController {
public list<myOject__c> objList {get;set;}
public MyController() {
objList = new List<myObject__c>();
public void addRow(){
myObject__c newObj = new myObject__c();
<apex:pageblock id=”myList”>
<apex:pageblockSection value=”{!objList}” var=”obj”>
<apex:inputField value=”{!obj.Name” />
<apex:commandButton value=”Add Row” action=”{!addRow}” rerender=”myList”/>
The simple solution is to add the attribute immediate=”false” to the commandButton tag. This forces the data to be retained.

Preparing for the Advanced Developer Exam

I just wanted to share that I took the Advanced Developer exam and passed the first part of the test which is the multiple choice 69 question exam. The exam test your knowledge on advanced topics covering triggers, execution context, visual force pages, standard and custom controllers, running unit test, development lifecycle, data migration tools among others.

You really need to know these topics in detail and the amount of materials to study is quite a lot too. I suggest about 1-2 months to prepare for the exam.

Below are the links to the docs and guides you need read from start to finish.
1. Get the Study Guide to know the full coverage of topics for the exam
2. Download and do the tutorial for Apex Workbook to start
3. Next go over the tutorial Visualforce workbook
4. The two tutorials above should get you started. Next is download the detailed document guide Apex Code Developer’s Guide and the Visualforce Developer’s guide. Its kinda long and requires patience to finish.
5. Also covered is using the Migration Tool
6. Development Lifecycle
7. Metadata API Guide
8. Apex CheatSheet
9. And another valuable resource Study Notes
10. And ofcourse use flashcards go to

That was the resource I used to pass the first part of the exam. I’m just waiting for the programming assignment.

Getting the Google Data Authentication for working

Just sharing some information which I hope some would find useful.

I’ve been tinkering around with the Google API Toolkit for

For starters, these are basically client libraries built on Apex for that connect to Google API like Google Docs API, Blogger API, Google Calendar API among others.

The method for authentication on the toolkit is built around the AuthSub authentication which as I found out is already deprecated, it is advised to use OAuth 2.0 for authentication & authorization. What this authentication models do is that you authorize your Google Account/Data to be accessed by an external service using a token. The token can be used as is which expires after 24 hours or you can exchange the token for a multisession token which does not expire. Please read up more on this topic from the links above.

I have a related post on how to get the Google Toolkit API installed on your Mac.

Back to the Google API Toolkit, it has a visualforce page with a controller that when accessed, will make token request to Google with a callback URL. However there are some issues when I tried them. I get the following errors.

The site “” has not been registered.

Solution here is I had to hardcode the return URL to be capital on the visualforce page.

Got that to work but the next issue it seems is that there seems to be new kind of restriction for putting Google Data on an iframe. I got the following error.

Refused to display document because display forbidden by X-Frame-Options.

What I had to do is, let the called page load on its own instead of putting it in an iframe. I did this by window.location then the return url.


Solving Error: SObject row was retrieved via SOQL without querying the requested field:

Got this tricky bug with my simple setup. I have a Visualforce page displaying one custom field(Percent) form to set a new value. I’m using a StandardController on the Quote object with an extension for other custom logic. Once value is passed a new visualforce page displays the new data.

It works fine like validation if value is non numeric or below 0 or higher then 100, but further testing such as adding two blanks spaces then an integer like 1 causes the error.

It would throw the SObject Exception error:

SObject row was retrieved via SOQL without querying the requested field: Quote.Name

Turns out to be a common problem as reference to and

As for the fix simply adding the error field being reference, in my case the I added {!} in my Visualforce page solved the problem.