Test Class for Standard Controller in Salesforce
Check the below code for writing test class for standard controller apex class. Sample Code: Account a = new Account( Name = 'Test' ); Class_Name obj = new Class_Name( new ....
Check the below code for writing test class for standard controller apex class. Sample Code: Account a = new Account( Name = 'Test' ); Class_Name obj = new Class_Name( new ....
Following code can be used to call the Apex Scheduler Class instantly. Schedulable_Class obj = new Schedulable_Class(); obj.execute( null ); Sample Code to run Apex Schedule Class instantly: So, we ....
Formula Expression is required on the action attributes error occurs when pagereference('/apex/pageName') doesn't have backslash in front of apex keyword. Correct Code: pagereference('/apex/sample1'); Incorrect Code: pagereference('apex/sample1'); in incorrect code, backslash ('/') ....
Objects: Member, Interest, Equipment Parent : MemberMember's Child : InterestMember's Grandchild and Interest's Child : Equipment Visualforce page: <apex:page sidebar="false" Controller="Sample" showHeader="true"> <apex:form > <apex:pageBlock > <apex:pageBlockTable value="{!memberWrapperList}" var="W"> <apex:column value="{!W.member.Name}"/> <apex:column value="{!W.member.Age__c}"/> <apex:column ....
Sa1lesforce.com has set some limits on Apex Scheduler. Following are the limits in Apex Scheduler in Salesforce.com. 1. You can only have 100 scheduled Apex jobs at one time(Maximum number ....
Exception: System.ListException: Before Insert or Upsert list must not have two identically equal elements Resolution: This exception occurs when you are trying to insert or upsert a list which is ....
Note: Use apex:outputField to consider using User's locale(currency and date format). Sample Code: Visualforce page: <apex:page controller="Sample"> <apex:outputLabel value="The value is : "/> <apex:outputText value="{0, number, currency}"> <apex:param value="{!inte}"/> </apex:outputText> ....
To open the URL in a new Tab for PageReference, kindly use <apex:commandLink/>. Sample Code: Visualforce page: <apex:page controller="Sample"> <apex:form > <apex:pageblock > <apex:commandlink action="{!openSearch}" target="_blank" style="text-decoration:none;"> ....
Date() can be used to get the date from datetime field. Sample Code: Datetime LastModifiedDateTime = Datetime.now(); System.debug( 'LastModifiedDateTime is ' + LastModifiedDateTime ); Date ModifiedDate = LastModifiedDateTime.Date(); System.debug( 'ModifiedDate is ....
You can use the following trigger to count the number of Contact records associated with an account record. Note: For existing records, do a one time data load with the ....