New answers tagged

1

Sure, just add a constructor: global class BatchOpportunityOwnerAssignmentScheduler implements Schedulable { String variableHere; global BatchOpportunityOwnerAssignmentScheduler(String variableHere) { this.variableHere = variableHere; } global void execute(SchedulableContext context) { Database.executeBatch(new BatchOpportunityOwnerAssignment(...


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 ...


2

If you want to schedule apex within Salesforce, you need to implement Schedulable - even if it is just to run daily. Then, you can write a cron expression to schedule it how you'd like or use the UI to schedule it as well. There's also now Scheduled Flows which presents another option although I believe it's limited to 250,000 flow interviews a day so you ...


0

I can clearly see that in CronTrigger object. Fire the SOQL on CronJobDetail and get the Id of the job. SELECT Id, JobType, Name FROM CronJobDetail Then use that ID on SOQL on CronTrigger and fetch fields StartTime and EndTime SELECT EndTime, StartTime FROM CronTrigger WHERE CronJobDetailId = '08a7F00002BLgJ2QAL'


2

It can. It depends on what exactly your Apex code is doing and how long each callout takes. Assuming each function makes exactly one callout, the primary governor limit to be concerned about is probably Maximum timeout for all callouts (HTTP requests or Web services calls) in a transaction: 120 seconds If you are not changing the default timeout of 10 ...


2

So basically you need 30 jobs to run in that time frame. You can schedule 30 jobs each running only once in 24 hours and each with a interval of 2 minutes. DailyLeadProcessor objDailyLeadProcessor = new DailyLeadProcessor(); for (Integer i = 0; i < 30; i++) { Integer intTime = i * 2; String cronExpr = '0 '+intTime+' 15 ? * * *'; System....


1

Your interviewer may have been trying to trick you as the best answer is to use a Validation Rule on Account Name: IsInvalidCreationMonth Expression: MONTH(DATEVALUE(CreatedDate)) = 12 Error: Accounts can not be created in December


1

For starters, you should make sure you understand trigger frameworks in Salesforce and how your org can benefit from them. There are quite a few resources that already discuss these. Some good examples can be found in the answers to this question: Generic Apex Trigger To answer your question, you could create a utility class/method that could accept a ...


Top 50 recent answers are included