Salesforce
Wednesday, 6 January 2016
diff b/w validate and deploy changeset in salesforce
Validate Changeset: This step will validate your Changeset component and will also check for the Test coverage (75%). After validation you can deploy the changeset or you can keep it without deployment.
Deploy Changeset is superset of Validate Changeset beacuse if you directly click on Deploy Changeset, it will first perform Validation and on successful validation of Changeset component it will deploy those component.
Thursday, 6 August 2015
Schedule Apex
global class Scheduleclass implements schedulable{
//String cronExp = '0 5 * * * ?';
//Scheduleclass s = new Scheduleclass();
//String jobID = system.schedule('Scheduleclass JOB', cronExp, s);
global void execute(schedulableContext sc){
Batchclass b = new Batchclass();
DataBase.executeBatch(b, 100);
system.debug('b----' +b);
}
}
Execution:-
------------
system.schedule('Scheduleclass JOB', '0 8 * * * ?', new Scheduleclass());
* This Schedule job will execute every one hour by default.(Suppose today at 06h:08Mins it's executed next schedule will be 07h:08mins... like this it will be schedule)
//String cronExp = '0 5 * * * ?';
//Scheduleclass s = new Scheduleclass();
//String jobID = system.schedule('Scheduleclass JOB', cronExp, s);
global void execute(schedulableContext sc){
Batchclass b = new Batchclass();
DataBase.executeBatch(b, 100);
system.debug('b----' +b);
}
}
Execution:-
------------
system.schedule('Scheduleclass JOB', '0 8 * * * ?', new Scheduleclass());
* This Schedule job will execute every one hour by default.(Suppose today at 06h:08Mins it's executed next schedule will be 07h:08mins... like this it will be schedule)
Wednesday, 5 August 2015
Batch class
Global class Batchclass implements Database.Batchable<Account>, Database.Stateful{
Integer i ;
public List<Account> listofunits = new List<Account>();
global Iterable<Account> start(Database.BatchableContext bc){
listofunits = [ SELECT Id, Name FROM Account ];
i=10;
return listofunits;
}
global void execute(Database.BatchableContext bc, List<Account> scope){
// List<Account> a = [Select Id From Account where Id =: ];
for(Account acc : scope ){
if(acc.Name == 'Reddy'){
acc.Type = 'Customer - Channel';
}
i = i+1;
system.debug('i.......' +i);
}
// update scope;
system.debug('acc - '+Scope);
system.debug('Scope - ' +scope.size());
}
global void finish(Database.BatchableContext bc){
// system.debug('a..........' +a);
}
}
Integer i ;
public List<Account> listofunits = new List<Account>();
global Iterable<Account> start(Database.BatchableContext bc){
listofunits = [ SELECT Id, Name FROM Account ];
i=10;
return listofunits;
}
global void execute(Database.BatchableContext bc, List<Account> scope){
// List<Account> a = [Select Id From Account where Id =: ];
for(Account acc : scope ){
if(acc.Name == 'Reddy'){
acc.Type = 'Customer - Channel';
}
i = i+1;
system.debug('i.......' +i);
}
// update scope;
system.debug('acc - '+Scope);
system.debug('Scope - ' +scope.size());
}
global void finish(Database.BatchableContext bc){
// system.debug('a..........' +a);
}
}
Tuesday, 21 April 2015
Difference between SOAP and REST APIs
SOAP API:-
-------------
-------------
1)Supports data in the form of XML only
2)Requires WSDL for the integration
3)Use SOAP API in any language that supports Web services.
2)Requires WSDL for the integration
3)Use SOAP API in any language that supports Web services.
REST API :-
-------------
-------------
1)Supports both XML and JSON format 2)Preferred for mobile and web apps since JSON being Lighter the app runs smoother and faster
You can also use Apex SOAP and REST Web services to expose data from platform or allow an external application to invoke Apex methods.
SOAP API
|
REST API
|
Simple Object Access Protocol
|
Representational State Transfer
|
It is based on standard XML format
|
It is based on URI
|
It works with WSDL
|
It works with GET, POST, PUT, DELETE
|
Works over with HTTP, HTTPS, SMTP, XMPP
|
Works over with HTTP and HTTPS
|
Thursday, 26 February 2015
What is the Difference Between Trigger.newMap and Trigger.oldMap?
Ans:
Trigger.newMap: A map of IDs to the new versions of the sObject record.This map is only available in before update, after insert and after update triggers.
Trigger.oldMap: A map of IDs to the old versions of the sObject records. This map is only available in update and delete triggers.
What is the Difference B/w With Sharing and Without Sharing Classes in Apex?
Ans:
With Sharing: If you declare a class as with sharing, Sharing rules given to the current user will be taken in to the consideration and user can access and perform the operations based on the permissions given to him on objects to fields.
Without Sharing: If you declare a class as without sharing, then this apex class runs in system mode which means apex code has access to all the objects and fields irrespective of current user sharing rules, field level security and Object permissions.
Subscribe to:
Posts (Atom)
1. If you use change set all the old deployments will be tracked.
2. Change set can be cloned.
So Change set will be better option :)