You need to sign in to do that
Don't have an account?
Problem with apex and visual force
This is my visual force page
<apex:page standardController="Employee_Info__c" showHeader="false">
<apex:pageBlock title="Hello {!$User.LastName}!">
<style>
.activeTab {background-color: #236FBD; color:white;
background-image:none}
.inactiveTab { background-color: lightgrey; color:black;
background-image:none}
</style>
<apex:tabPanel switchType="client" selectedTab="EmployeeInfoTabDetails" id="EmployeeInfoTabPanel" tabClass="activeTab" inactiveTabClass="inactiveTab">
<apex:tab label="Employee Information" name="EmployeeInfoDetails" id="EmployeeInfoTabDetails">
<apex:detail relatedList="false" title="true"/>
</apex:tab>
<apex:tab label="Personal Information" name="PersoanlInfoDetails" id="PersoanlInfoTabDetails">
<apex:detail relatedList="false" title="true"/>
</apex:tab>
<apex:tab label="Leaves Information" name="LeavesInfoDetails" id="LeavesInfoTabDetails">
<apex:relatedList list="Apply_New_Leave__r"/>
</apex:tab>
</apex:tabPanel>
<apex:form >
<apex:inputField label="Name" value="{!Employee_Info__c.Name}"/>
<apex:commandButton action="{!save}" value="Save New Employee Name"/>
</apex:form>
</apex:pageBlock>
</apex:page>
This is my controller
/**
* An apex page controller that exposes the site login functionality
*/
global with sharing class SiteLoginController {
global String username {get; set;}
global String password {get; set;}
global PageReference login() {
System.debug('Sukumar:::::::::::::::::');
String startUrl = '/apex/EmployeeInfoTest?id=a0C9000000BaAh8';
System.debug(startUrl);
return Site.login(username, password, startUrl);
}
global SiteLoginController () {}
@IsTest(SeeAllData=true) global static void testSiteLoginController () {
// Instantiate a new controller with all parameters in the page
SiteLoginController controller = new SiteLoginController ();
controller.username = 'test@salesforce.com';
controller.password = '123456';
System.assertEquals(controller.login(),null);
}
}
This is my debug log
27.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO 03:01:22.028 (28412000)|EXECUTION_STARTED 03:01:22.028 (28460000)|CODE_UNIT_STARTED|[EXTERNAL]|06690000002Xyjp|VF: /apex/EmployeeInfoTest 03:01:22.525 (67358000)|CUMULATIVE_LIMIT_USAGE 03:01:22.525|CUMULATIVE_LIMIT_USAGE_END 03:01:22.067 (67394000)|CODE_UNIT_FINISHED|VF: /apex/EmployeeInfoTest 03:01:22.067 (67403000)|EXECUTION_FINISHED I have Some issues
1)In my debug log it is not showing any System.debug() statements.
2)Is there any problem with CUMULATIVE_LIMIT_USAGE. What is cumulative usage.
3)When I click login button in my login page it is showing me error"Error while loading visual force page".
If i remove
<apex:tab label="Leaves Information" name="LeavesInfoDetails" id="LeavesInfoTabDetails">
<apex:relatedList list="Apply_New_Leave__r"/>
</apex:tab>
in my visualforce page. Employee Test visual force page is displayed correctly.
Can anyone help me with the above issues. If you need more information I will provide.
All Answers
,
I cannot see login button in your VF page
I cant see a extrension in your page
Thanks for your reply.
Thanks & Regards,
Sukumar Reddy | Software Programmer
Sukumar.mandem@pbsystems.com
C: +91-9493757230
PB Systems - Results. Delivered?.
If anyone has answer......Please let me know
Go to field detail and check the child relation ship name
should be "Apply_New_Leaves__r"
Thanks for your answer.
The visual force page is loading when I try to open with url https://c.ap1.visual.force.com/apex/EmployeeInfoTest?id=a0C9000000BaAh8.
But When I use apex/EmployeeInfoTest?id=a0C9000000BaAh8 in my apex class , I am getting error.
https://suku-developer-edition.ap1.force.com/EmployerLeave
Ok.. you are not generating correct url. It should be relative to your site
it should be something like
I think you miss '/' in front of the apex.
You can use ' /apex/EmployeeInfoTest?id=a0C9000000BaAh8 ' in apex class.
But the same url working for me when I remove <apex:tab > tag related to leave information
Ok, tell me one thing : Is the site login user have the access to the "Apply_New_Leave__c" object ?
I tried like this also but I am getting same error. I am attaching my new debug log , I have doubt in pagereference in my debug log. Please have look at page reference in debug log. If you know the solution please help me
Issue got solved. Great answer.
I have given access to the user to this Apply_New_Leave__C object.
Thank you so much for your help.
@puja, Thanks for your answer.
Great answer. Issue got solved.