Tuesday, 14 February 2017

How to delete all scheduler jobs at a time?

Hi All,

Below is the script to help you to delete all scheduler jobs at a time.

List<CronTrigger> scope = [select id from CronTrigger];
System.debug('Hi---'+scope );
for(CronTrigger cron:scope ){



Tuesday, 7 February 2017

How to tab Order for the fields in visualforce page?

We can use the attribute tabOrderHint of visualforce page to control tab order.

<apex:inputField value="{!Account.AnnualRevenue}" tabOrderHint="1"/>

<apex:inputField value="{! oppyContact.Contact_Street_Address__c}" tabOrderHint="1"/>
<apex:inputField value="{! oppyContact.Contact_Country__c}" tabOrderHint="3"/>
<apex:inputField value="{! oppyContact.Contact_State_Province__c}" tabOrderHint="2"/>
<apex:inputField value="{! oppyContact.Contact_Zip_PostalCode__c}" tabOrderHint="4"/>

How to use Field Set in Page and in Controller

Sometimes we  don't know which fields should be displayed in the page and which field should be added in the query. To solve this issue and make it salable SFDC has given cool features called Field set.

This post will share some code snippet about using field set in the page and in controller.

In the page
<apex:repeat value="{!$ObjectType.Lead.FieldSets.Update_Fields_FieldSET}" var="f">  
      <apex:inputField value="{!leadTemp [f]}"/><br/>
Public Lead leadTemp {get;set;}

In the apex class

String sQuerry = 'Select id,GEO__c,Is_Locked__c,';
       for(Schema.FieldSetMember f : SObjectType.Lead.FieldSets.Update_BDR_Activity_Fields.getFields()) {
                sQuerry = sQuerry+f.getFieldPath()+',';
       sQuerry = sQuerry.substring(0,sQuerry.length()-1);
sQuerry = sQuerry+' From Lead';
ldList = Database.query(sQuerry );


How to assign value entered from page to lead list

for(Schema.FieldSetMember f : SObjectType.Lead.FieldSets.Update_BDR_Activity_Fields.getFields()) {
if(leadTemp.get(f.getFieldPath()) != null){
System.debug('inside iffff');