Tuesday, 18 February 2014
Salesforce: Salesforce - "System mode & User mode" and "With s...
Salesforce: Salesforce - "System mode & User mode" and "With s...: This topic has always been part of discussion where the answer is not satisfactory and convinced to others. Using this article, I wi...
Tuesday, 4 February 2014
SFDC 401 notes: Get Started for SFDC 401
SFDC 401 notes: Get Started for SFDC 401: 1) For a Contact object, All users should be able to see all the fields except User Y who should net be able to see Mobile No. Field. This ...
Monday, 3 February 2014
Batch Apex in salesforce
/* you need to create a class and to schedule that class write one more class
*/
global class batchAccountUpdate implements Database.Batchable <sObject>
{
global Database.QueryLocator start(Database.BatchableContext BC)
{
String query = 'SELECT Id,Name FROM Account';
return Database.getQueryLocator(query);
}
global void execute(Database.BatchableContext BC, List<Account> scope)
{
for(Account a : scope)
{
a.Name = a.Name + 'L';
update a;
}
}
global void finish(Database.BatchableContext BC)
{
}
}
*/
Class Name:- batchAccountUpdate
global class batchAccountUpdate implements Database.Batchable <sObject>
{
global Database.QueryLocator start(Database.BatchableContext BC)
{
String query = 'SELECT Id,Name FROM Account';
return Database.getQueryLocator(query);
}
global void execute(Database.BatchableContext BC, List<Account> scope)
{
for(Account a : scope)
{
a.Name = a.Name + 'L';
update a;
}
}
global void finish(Database.BatchableContext BC)
{
}
}
// to schedule class: - scheduleExpireNotify
global class scheduleExpireNotify implements Schedulable
{
global void execute(SchedulableContext sc)
{
batchAccountUpdate en = new batchAccountUpdate();
Database.executeBatch(en);
}
}
{
global void execute(SchedulableContext sc)
{
batchAccountUpdate en = new batchAccountUpdate();
Database.executeBatch(en);
}
}
Sunday, 2 February 2014
Inline Editing using Visualforce page
<apex:page standardController="Merchandise__c" recordSetVar="acts">
<apex:form >
<apex:pageBlock title="Merchandise">
<apex:pageblockTable value="{!acts}" var="a">
<apex:column value="{!a.name}"/>
</apex:pageblockTable>
// code for inline Editing
<apex:inlineEditSupport event="ondblclick" showOnEdit="saveButton, cancelButton" hideOnEdit="editButton"/>
</apex:pageBlock>
</apex:form>
</apex:page>
<apex:form >
<apex:pageBlock title="Merchandise">
<apex:pageblockTable value="{!acts}" var="a">
<apex:column value="{!a.name}"/>
</apex:pageblockTable>
// code for inline Editing
<apex:inlineEditSupport event="ondblclick" showOnEdit="saveButton, cancelButton" hideOnEdit="editButton"/>
</apex:pageBlock>
</apex:form>
</apex:page>
Subscribe to:
Posts (Atom)