How to create JSON String using Apex in Salesforce?
JSON.serialize() method can be used to create JSON String using Apex in Salesforce. Check the following code for reference Sample Code: Account objAccount = [ SELECT Id, Name, Phone, Website, ....
JSON.serialize() method can be used to create JSON String using Apex in Salesforce. Check the following code for reference Sample Code: Account objAccount = [ SELECT Id, Name, Phone, Website, ....
Date.daysInMonth() can be used to find the number of days for a month using Apex in Salesforce. Sample Code: Integer numberDays = Date.daysInMonth( 2014, 2 ); System.debug( 'No of days ....
Currency format in Salesforce Visualforce Page can be done using apex:outputText and apex:outputField. Example: <apex:outputText value="${0, number, ###,###,###,##0.00}"> <apex:param value="{!a}" /> </apex:outputText> <apex:outputText value="{0, number, currency}"> <apex:param value="{!inte}"/> </apex:outputText> Note: ....
Test.startTest() and Test.stopTest() are very useful when your test class hits Salesforce Governor Limits. The code inside Test.startTest() and Test.stopTest() have new set of Salesforce Governor Limits. As a good practice, make ....
Sample Code: Visualforce page1: <apex:page controller="Sample"> <apex:form > <apex:pageBlock > <apex:pageBlockButtons > <apex:commandButton value="Next Page" onclick="show();"/> </apex:pageBlockButtons> </apex:pageBlock> </apex:form> </apex:page> Apex class: public class Sample { public Sample() { } ....
Visualforce page: <apex:page controller="PDFController"> <apex:pageBlock > <apex:pageBlockTable value="{!listEmployees}" var="e"> <apex:column value="{!e.Name}"/> <apex:column value="{!e.Age__c}"/> </apex:pageBlockTable> </apex:pageBlock> </apex:page> Apex Controller: public class PDFController { public List<Employee__c> listEmployees {get;set;} public PDFController() { listEmployees ....
Clone: If a list is cloned, it duplicates it and has reference. Primitive data types are supported. Sample Code: Account Account1= new Account(Name='Test1'); Account Account2= new Account(Name='Test2'); List<Account> AccountList = ....
"ALL ROWS" keyword is used to fetch records form recycle bin in Salesforce. Sample SOQL: SELECT Id, AccountId FROM Contact WHERE IsDeleted = true ALL ROWS Execute the below code in ....
Sample Code: DateTime: DateTime myDate = datetime.now(); DateTime dueDate = DateTime.newInstance( 2008, 1, 30 ); //return true if myDate and dueDate are same else return false Boolean dueNow = myDate.isSameDay( ....
Similar to String data type, we have Id data type in Salesforce Apex. So, using Id data type, we can convert the 15 digit Id to 18 digit Id using ....