You need to sign in to do that
Don't have an account?
Visualforce Page
Hi,
I created a VisualForce Page which i attached to a custom tab. Now under the visualforce page i wrong a custom controller, the section of the code pasted below.
public string getInstallBase()
{
string x= ApexPages.currentPage().getParameters().get('id');
return x + 'Hi Dear';
}
Now when i am displaying the the value x, in the page, it is showing NULL. I tried using other two commands instead of ApexPages.CurrentPage...... (used s.getRecord().id & system.currentPageReference().getParameters()..... where 's' is the standard controller) but found the value x as NULL), can somebody help, wht is the problem or how to derive the id.
Pls find the Visualforce Page CODE below:
<apex:page Controller="<ControllerName>'
<p>{!Installbase}</p> // this should print the id value.....
yes it is a public method, and in the page out HI DEAR is coming preceded by null. I tried checking the value of x in the method itself and put a logic if x is null then initialise it with 'TEST FAILED'.
in the output i got TEST FAILED HI DEAR.
You won't be able to access the record from the standard controller using the page as described, as you have a custom controller that isn't an extension controller.
When you click on the tab to go to this page, what is the URL that the browser goes to? If the URL doesn't have the following string '?id=' followed by an id, then the result retrieved from the current page parameters will indeed be null.
thnx bob u r write, the URL doesn;t displays / contains the id, it only gives me the name of the tab. but what is the solution for my issue.
i basically wanted to created a custom controller, where from i want to pick up values (using methods) from different objects based on the user who logins in ( i don;t mean profile, basically like if a transaction is related to an account, i want to pick those related data to display)
You can find out the SalesForce ID of the currently logged in user in your controller as follows:
UserInfo.getUserID();
Once you have this, you can look up whatever you are interested in via SOQL.