How to clear list memory using apex in Salesforce?
List<account> objList = new List<account>(); objList.add(new Account(name = 'Test Account'); objList.clear(); //Clear the account list
List<account> objList = new List<account>(); objList.add(new Account(name = 'Test Account'); objList.clear(); //Clear the account list
String strMail = 'testmail@gmail.com'; if(!Pattern.matches('[a-zA-Z0-9._-]+@[a-zA-Z]+.[a-zA-Z]{2,4}', strMail)) { //Your error message }
Here in below example, there is a custom field Active__c
in Contact object. On a button click want to update Active__c
field status to true.
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/29.0/apex.js")} if(confirm("Do you want to active this Contact?") == true) { var objC = new sforce.SObject("Contact"); objC.Id = '{!Contact.Id}'; objC.Active__c = true; var result = sforce.connection.update([objC]); window.location.reload(); }
You can render any page as a PDF by adding the renderAs
attribute to the component, and specifying pdf as the rendering service.
For example:
<apex:page renderas="pdf"> </apex:page>
Note: Visualforce pages rendered as PDFs will either display in the browser or download as a PDF file, depending on your browser settings.
The below code is used to open a new page “NextPage” from current page.
public PageReference Next() { PageReference objPR = new PageReference('/apex/NextPage'); objPR.setRedirect(true); return objPR; }