New answers tagged

0

Ran into the same issue. Looks like SF does not like the last parameter. For example this works: '0 0 21 ? * 1-7' By the way: you can only see jobs (all jobs) with the [Manage] button, not change them.


2

Move your callout and parsing logic to the start method of your batchable class. This method has 12MB of heap available compared to synchronous code's 6MB of available heap.


0

There is no possibility that your test could succeed, because you are calling execute(): global void execute(Database.BatchableContext BC, List<sObject> scope) { //Not able to run this block of code with a null instead of the input this method requires: PR.execute(null); You've also provided the wrong number of parameters, so this method call is ...


0

There are a number of problems with this code that I don't think I can cover in a single answer, but I want to highlight a couple of specific points and then offer a general suggestion for what a good form of this code might look like. Key Points Your logic in this code does not match your stated objective. There are no N-year mechanics here, and the ...


0

As you are converting your SOQL in a string, you need to escape ' using \. Something like this: String query = SELECT id,Email,name,MailingCountry,active__C,ECP_Flag__c,Chrun_Indicator__c,Sales_Program_Type__c FROM contact where AccountId != null and Account.Active__c= \'yes\' and (Account.Type like \'Customer%\') and Active__c = \'Yes\' and Email != null ...


1

There is nothing dynamic in this query. SELECT id,Email,name,MailingCountry,active__C,ECP_Flag__c,Chrun_Indicator__c,Sales_Program_Type__c FROM contact WHERE AccountId!= null and account.Active__c='yes' and (Account.Type like 'Customer%') and Active__c='Yes'and Email!= null and (NOT Email like '%Equinix.com') However, you have a number of locations where ...


-1

Please find the solution I hope It will help You. public class CalculateTotalOppAmount implements Database.Batchable<sObject>, Database.Stateful { public Integer recordsProcessed = 0; public double TotalAmount = 0; public Database.QueryLocator start(Database.BatchableContext bc) { return Database.getQueryLocator( ...


2

Batch execution vs user updating an opportunity record are 2 different transactions, each executing within its own limits and boundaries. From a synchronous transaction, you are trying see how to signal recalculation/ adjudication need to an asynchronous transaction. AFAIK, this is not possible in apex (although you could come up with workaround solutions, ...


0

I was able to achieve 100% code coverage using the below code. @isTest private class closeAllDealsMonthAgoTest { static testmethod void testbatch() { Integer count = 200; Account acc = new Account(Name='Test Account'); insert acc; List<Opportunity> opps = new List<Opportunity>(); ...


2

You could actually just: public Iterable<Custom_Object__c> start(Database.BatchableContext bc) And if you don't want any execution to occur: return new Custom_Object__c[0]; This returns an empty list, so no execute call will happen, and you don't need a query. Note that you'll have to cast the QueryLocator to use this technique: return (Iterable<...


2

You should be using an IDE. As it would have suggested its not Limit its Limits, so Limits.getCpuTime(), also I the just ran the code for testSetup, and it hardly took 400 ms to run. So i believe your org might be having either PB, or WF or Triggers on Leads. Its better to use a Log Analysis window to debug which process is taking time. Generate your logs ...


6

There are lots of problems in this code. The proximate cause of the issue, however, appears to be in this section: list<ScArticle__c> mappedarticle=[select id,class__c,ExcludeFromLoyalty__c, LoyaltyPoints__c,LoyaltyRefundable__c,type__c,idext__c from ScArticle__c where id =:artid]; for( ...


Top 50 recent answers are included