I was constantly getting an error “This Apex class has batch or future jobs pending or in progress” whenever I was saving Apex class written for batch Apex. This was happening in the developer org where we develop a test managed package for the AppExchange product. There was no way I can throw out this org and start with a new one.
For debugging started with following steps:
Check Schedule Jobs – No schedule jobs (If any are running and related to your class somehow you can just delete the schedule job)
Check Apex jobs – No Apex is job is running or in Queued state. (If are running you could just click “Abort”)
Google – Found some known issue and checked workarounds which were of nouse.
As nothing worked logged a case through Salesforce Partner portal as job needed to be deleted from the backend. But case got categorized as a developer support case. Not having the premium support it Case got closed 😐
Then started research –
Tried deleting all running schedule jobs through Apex in case any is stuck in the background and not visible on UI.
No Luck!! 🙁
Making query on the AsyncApexJob object – SELECT Id, Status, JobItemsProcessed, TotalJobItems, ParentJobId, NumberOfErrors FROM AsyncApexJob Where Status = 'Queued' et voila!! returns the job stuck in Queued status which was not visible through UI. I thought my job is over I will just copy Id from the query result and execute “System.abortJob(jobid);” But that didn’t work. It needs a ParentJobId which was missing from this entry. – No Luck 🙁
Then came across a tiny line in the Salesforce Article. If you want to abort a job using Job Id use API version 32.0 or earlier. Login to workbench using v32.0 and from “Execute anonymous” execute System.abortjob(). This time it worked… Finally!!! 🙂
Businesshours is a system class provided by Salesforce for performing various operations on the DateTime values. It provides methods for checking if a date falls during business hours, whats the diff between two dates in business.
The in-built method does allow adding the specific days to the DateTime value but there is a catch, it needs to be in the Long format. More information could be found here.
The method has been specifically designed to add the number of hours in the millisecond format. And addition is done with respect to business hours. Let’s consider you want to add 1 day to the Date December 18th, 10 AM. And business hours are set for 8 AM to 8 PM for all days.
This calculation added complete 2 days as business hours are set 12 hours a day.
Alternative for avoiding such hour based calculation could be going in an iterative way.
This will also ensure that the initial time is preserved.
By default, Salesforce doesn’t allow admin to configure or restrict a user from adding a specific type of files. Admin may need that user should not be able to attach files of type exe, dll which can have the virus in them. Also, there is no virus check is done when a file is getting uploaded to the Salesforce.
But Salesforce does allow writing trigger on the Attachment Object by which you can implement such restrictions. Following is the snippet of the code which will restrict the user from adding the files with extension mentioned in the set list. You can also edit the code and do the reverse by checking if extension exists in the set then only allow attaching the file.
Once trigger code is up and running, whenever Salesforce tries to attach any file with extension exe or dll he will come across following error message.
To change the port that Remote Desktop listens on, follow these steps.
Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:
322756 How to back up and restore the registry in Windows
Start Registry Editor.
Locate and then click the following registry subkey: