You need to sign in to do that
Don't have an account?
SFDC ROCK
How to set up batch apex logic with trigger logic
I have a trigger with below logic with that logic I want to create batch apex and schedule it daily.
Can we do it with below logic or need to write complete different code ?
public class handlerclass{
public static void methodname(List<sbject> newlist,Map<Id,sobject> oldmaplist){
set<Id> oppIds = new set<Id>();
Map<Id,osbject1> oppupdate = new Map<Id,osbject1 >();
for(sobject__c so: newlist){
if(so.sobject1Id__c!=null)
oppIds.add(so.sobect1Id__c);
}
if(!oppIds.isEmpty()){
for(sobeject1 oppty : [Select name,id,address__c from osbject1 where uid='frame']){
if(condition){
for(loop){
if(condition){
if(condition);
//assigment logic';
//update logic
break;
}
if(condition){
//assigment logic';
//update logic;
break;
}
if(condition){
//assigment logic';
//update logic;
}
}
}
}
Can we do it with below logic or need to write complete different code ?
public class handlerclass{
public static void methodname(List<sbject> newlist,Map<Id,sobject> oldmaplist){
set<Id> oppIds = new set<Id>();
Map<Id,osbject1> oppupdate = new Map<Id,osbject1 >();
for(sobject__c so: newlist){
if(so.sobject1Id__c!=null)
oppIds.add(so.sobect1Id__c);
}
if(!oppIds.isEmpty()){
for(sobeject1 oppty : [Select name,id,address__c from osbject1 where uid='frame']){
if(condition){
for(loop){
if(condition){
if(condition);
//assigment logic';
//update logic
break;
}
if(condition){
//assigment logic';
//update logic;
break;
}
if(condition){
//assigment logic';
//update logic;
}
}
}
}
Subodh,
You can implement your logic by using following code according to your requirement
Batch Class:
Schedule from Developer console: I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Ajay Dubedi
www.ajaydubedi.com