Posts

Showing posts from February, 2013

FieldSets in Tables

One small tip, but very useful. This is common requirement but I didn't find any post anywhere, so I thought of putting it together. FieldSet is a magical concept which lets the admins take control on visibility of fields on Visualforce. "It doesn't take a developer to add/ remove the fields on visualforce pages" Step 1: Create a fieldset, Select your fields in pagelayout Editor. I grabbed Account name, Site, Description into my set " testfieldset ". Step 2: Create a visualforce page with following code and understand . <apex:page id="pg" standardcontroller="Account" recordSetVar="accts"> <apex:form id="frm1">     <apex:pageBlock mode="maindetail" title="Account List" id="pb1"> <!--         <apex:pageBlockButtons >             <apex:commandButton value="Save" action="{!quicksave}"/>               </apex:pageBloc

Standard Page Buttons To Run Apex Class (not a webservice class)

How do you solve the following requirement, there are lot of ways to do it but we feel this is best for our case. The Requirement : When user clicks on "Close All Cases" custom button on Account Detail Page, It should update status of all the child case records. Fortunately we already have a class that updates the case status to "Closed". all we need to so is call that class. Our Solution : Have a custom field, a small trigger to call that class. Step1: Create a custom checkbox "closecases". Step 2:  Create a custom detail page button "Close All The Cases" and show it on the page layout  with the following code: ================================================ {!REQUIRESCRIPT("/soap/ajax/19.0/connection.js")}   var a = new sforce.SObject("Account"); a.id = "{!Account.Id}"; a.closecases__c=true; var result = sforce.connection.update([a]); // alert(result); window.location.reload(); ==============