When a customer adds a gift to a Gift Entry Batch through the UI, we run Dry Mode on it and set the Statusc field to “Dry Run - Validated.” When the Process Batch button is clicked, we change the Statusc field value for those Data Import records to “Processing” and we display a message on the Gift Entry Batch which says “Processing Batch... This can take a while. Check back in a bit!” This will poll until there are no longer any Data Import records with a Status__c field value of “Processing”.
If the batch is aborted (either manually by the customer in Setup—> Apex Jobs or because there was an internal Salesforce error) or if one or more batch executions failed, some records may be left with a Status__c of “Processing”. Customers are then unable to get past the “processing” message on the batch record and see what’s in their batch or how to resolve the issue.
Root Cause
We display the Processing Batch… message in geGiftEntryFormApp if isBatchProcessing is true. That will be true if the number of records with a value of Processing is > 0. But if a batch or batch execution does not complete, the Status__c field does not get updated to a different status and this will remain “stuck.” This issue gets even trickier if the job is more than 7 days old. At that point, it no longer shows in Setup --> Apex Jobs or in queries to the AsyncApexJob object.
Workaround:
Do this only if the batch has been aborted and/or the BDI_DataImport_BATCH shows failures in Setup —> Apex Jobs.
Find all Data Import records where the npsp_Data_Import_Batchc = the id of the batch that’s stuck. (You can get this from the URL when you go to the batch record). Clear out the npspStatus__c field for those records and save. (This can be done via a data loading tool or via Execute Anonymous in the Dev Console).
Or alternatively, switch to Classic and go to the NPSP Data Import Batch record. Click the Process Batch button from there.
Steps to Repeat
Setup:
Create scratch org and enable BDI Advanced Mapping and Gift Entry.
Create a Template and a Batch. Get Batch Id and paste in the snowfakery file attached to the Work Item.
Use cci to load the snowfakery data so that there are 5000 records associated with the batch. We’ll manually set the Status__c field to “Dry Run - Validated” to simulate what would have happened if we had entered the data via the Gift Entry UI.
Wait for Snowfakery to finish loading the data.
Scenario 1: Aborted Job
Open the Batch record in Gift Entry. Click the Process Batch button.
Go to Setup —> Apex Jobs and click the Abort link next to the BDI_DataImport_BATCH entry once it's in a state of Processing. Go back to your batch and confirm that it keeps showing that it’s processing, despite the batch job being aborted.
Scenario 2: Batch Failures (Example: CPU Timeout in 1 or more executions):
Switch to Classic and go to the batch record.
Update the Batch_Process_Size__c from 50 to 999 on the batch record.
Click the Process Batch button.
Go to Setup —> Apex Jobs. You should be seeing CPU timeouts in the Status Detail next to the BDI_DataImport_BATCH entry…
Once all batch executions have processed for that job in Setup —>Apex Jobs, Switch back to Lightning.
Go to Gift Entry and open your batch. It will still say it’s processing even though the batch job finished/failed.
Summary
When a customer adds a gift to a Gift Entry Batch through the UI, we run Dry Mode on it and set the Statusc field to “Dry Run - Validated.” When the Process Batch button is clicked, we change the Statusc field value for those Data Import records to “Processing” and we display a message on the Gift Entry Batch which says “Processing Batch... This can take a while. Check back in a bit!” This will poll until there are no longer any Data Import records with a Status__c field value of “Processing”.
If the batch is aborted (either manually by the customer in Setup—> Apex Jobs or because there was an internal Salesforce error) or if one or more batch executions failed, some records may be left with a Status__c of “Processing”. Customers are then unable to get past the “processing” message on the batch record and see what’s in their batch or how to resolve the issue.
Root Cause
We display the Processing Batch… message in geGiftEntryFormApp if isBatchProcessing is true. That will be true if the number of records with a value of Processing is > 0. But if a batch or batch execution does not complete, the Status__c field does not get updated to a different status and this will remain “stuck.” This issue gets even trickier if the job is more than 7 days old. At that point, it no longer shows in Setup --> Apex Jobs or in queries to the AsyncApexJob object.
Workaround:
Do this only if the batch has been aborted and/or the BDI_DataImport_BATCH shows failures in Setup —> Apex Jobs.
Steps to Repeat
Setup:
Scenario 1: Aborted Job
Scenario 2: Batch Failures (Example: CPU Timeout in 1 or more executions):