Edit for clarification: There is a detail button with a link to the VF Page. It is to my understanding (but I could be reversed in concept -- that would definitely changed things...) that a line such as
<apex:inputField value="{!siteContactItem.FirstName}">
Will look to the controller for siteContactItem.FirstName and fill it as such. Because of this, in the controller, I'm looking to assign the default value as something to give to the VF page.
In this specific VF Page, I want the auto-filled information to be that of the Account on which the button was clicked. The button is "Renew Contract", and I want it to automatically fill with the current account/contract/contact... info, and allow the user to edit if necessary before saving.
I thought this might pull the current record, and I was confused when it was pulling only some info, not finding other info, and the info displayed was incorrect. According to the info it did pull, I identified that it is in fact getting the current user signed in.
My purposes of my apex class is to bring up a builder with the current account, related contracts, contacts, etc. already filled in, and I can't seem to figure out how to pull that. Suggestions?
I tried replacing 'id' with 'account', but I got Index Out of Bounds which suggests that the query using it...
ID currentRecordId = ApexPages.CurrentPage().getparameters().get('account');
List<Account> accountItems = [SELECT Id, Phone, BillingState, BillingCity, BillingCountry, BillingStreet,
Fax, Website, Name from Account
where Id = :currentRecordId limit 1];
... didn't pull anything successfully.
account=
should be a value starting with001
of length 15/18 characters\apex\myVfPage?account=someAcctId
getId()
method. If the VF page is standalone, then the ID has to come from the URL. Rather than continue this in comment thread, post more context by using edit - like the VF page, how it is invoked, and rest of the controller