This document outlines the functionality of the BatchPullFileRequestStatus batch process in Secure File Transport, which is responsible for capturing the Current Status of the File Requests.
🛠️ Batch Job: BatchPullFileRequestStatus
-
Captures scheduled payments for transactions that were previously authorized and are due to be processed today.
🔍 How It Works
-
Fetch Records
QueriesGetStatusQueryrecords that meet all the following conditions:-
cm_datatransfer__Request_Id__c!= null -
cm_datatransfer__Request_Status__cIN ('Sent', ‘Sending’)
-
-
Capture Attempt
-
Make an API call to get the recent status
-
-
Success Handling
If the capture is successful:-
✅
Request Status→ Updated to Completed -
✅
Media Files Records gets Updated-
Pull Requests
-
Media File Status is updated to Downloaded
-
Files downloaded Gets linked to the Media File Object (One for each file)
-
-
Push Requests
-
Media File Status is updated to Uploaded
-
-
-
-
Failure Handling
If the capture fails:-
❌
Request Status→ Updated to Failed -
❌
Integration Status(or error message field) → Populated with the Error Description
-
🧠 Automation
-
This batch can be scheduled to run daily to automatically process all the Pending File Requests Status
💻 Execution Script
👉 Run batch without filter (uses default query):
Database.executeBatch(new BatchPullFileRequestStatus(), 1);
👉 Run batch with a custom SOQL query:
String sQuery = 'SELECT Id, cm_finance__Payment_Status__c, cm_finance__Payment_Mode__c, cm_finance__Transaction_Id__c, cm_finance__Payment_Gateway__c, cm_finance__Transaction_Status__c, cm_finance__Amount__c, cm_finance__Application_Fee__c, cm_finance__Payment_Method__r.cm_finance__Holder_Full_Name__c, cm_finance__Payment_Method__r.RecordType.Name, cm_finance__Payment_Method__r.cm_finance__Encrypted_Token__c,cm_finance__Payment_Method__r.cm_finance__Card_Expiration_Year__c, cm_finance__Payment_Method__r.cm_finance__Card_Expiration_Month__c, cm_finance__Payment_Gateway__r.cm_finance__Payment_Gateway__c, cm_finance__Payment_Gateway__r.Name, cm_finance__Payment_Method__r.cm_finance__Bank_Account_Owner_Type__c, cm_finance__Payment_Method__r.cm_finance__Bank_Account_Type__c , cm_finance__Payment_Method__r.cm_finance__Location_User_Id__c FROM cm_finance__Payment_Transaction__c WHERE cm_finance__Payment_Status__c = \'Authorized\' and cm_finance__Payment_Date__c<=today';
Database.executeBatch(new BatchCaptureScheduledPayment(sQuery), 1);
👉 Run batch with customized where clause (uses custom where clause):
Setup the Custom Where clause in the Data Transfer Settings
-
Navigate to Setup -> Custom Settings -> Data Transfer Settings
-
Create an Entry:
BatchP1Status_WhereClause. -
The value should start with ' and <clause 1> '
Database.executeBatch(new BatchPullFileRequestStatus(), 1);
Next run settings
-
ScheduleBatchRequired
-
Default is false.
-
Enables the next instance of the batch to run.
-
-
NextScheduleBatchRunTime
-
Time in minutes until the next instance of the batch runs.
-
✅ Benefits
📅 Ensures timely processing of all File Requests and reduce manual effort
📈 Tracks successful vs. failed capture attempts for auditing