You need to sign in to do that
Don't have an account?
symantecAP
Help with Batch Apex that is scheduled every 15 mins.
Hi All
Here is my requirement. I have an Object called Big Machines Quotes and there is a field which is look up to opportunity . Whenever the Status fields on Big Machine Quote is changed to "Approve" then the stage field on Opportunity is changes to "Closed Won".
The challenge for me is I want to acheive this by Scheduling by Batch Apex. By batch apex should run every 15 mins and update the corresponding field.
Kindly help.
Here is my code so far since morning
Please review
Hi,
You need to right a schedular class which runs on every 15 mins.In schedular you have execute method, in this method you need to write your logic for updating fields.
Let me know if any problems.
Regards,
Insane
I have written a schedulable class. but isnt the logic correct to update field
List <Opportunity> oppList = new List<Opportunity>() ;
for(sObject s : scope){
BigMachines__Quote__c quote = (BigMachines__Quote__c)s;
System.debug('Adil'+quote);
if(quote.BigMachines__Status__c.contains ('unison') ){
Opportunity opp = [select id, StageName from Opportunity where id=:quote.id];
opp.stageName = 'Closed Won' ;
}
update oppList;
Thanks
Adil
and also i am getting the following error once i Scheduled it
First error: Argument 1 cannot be null
Hi ,
Send me your schdule class and how your invoking this schduler class.
Here is my scheduled class
Thanks
What is the problem here?
I get this
First error: Argument 1 cannot be null
in my apex jobs
Where is the value for "query" in your batch class. are you passing from scheduler or directly hard coding in Batch class. I dont see the value for query field in ur code. This is causing error.
Regards,
Insane
where do i put the query in my batch class and what query do i put for my condition?
do i put inside the start method or above the start method as
Query = 'SELECT id,BigMachines__Status__c from BigMachines__Quote__c where BigMachines__Status__c = '*unison*';
In Batch class ,
global String query = 'Write ur query here ';
Hi I have added the query
the job says completed but batch processed is just one and also plz look in to my logic in execute.
Thanks
Adil