This articles illustrates how to leverage Salesforce flow to trigger direct debit collection automatically on a regular basis so that you can collect your pain.008 files for direct debit payment initation directly in Salesforce.
The RaiseNow FundraisingKit for Salesforce provides an invocable Apex method that can be called from within Salesforce flow in order to initiate the direct debit message file generation.
We are going to invoke this method using Salesforce flow. This is the scheduled flow we are going to build. In this example we are executing on even days, but as you will see you can easily adapt this to select any day of the month.
We configure this flow to execute daily. We will build a check later to ensure the method is only invoked on the days that we actually want to generate direct debit message files.
We also need to create a new formula resource:
This will simply return true on any even day of the month. Adapt this condition to your needs:
DAY(TODAY()) == 2 || DAY(TODAY()) == 4 || DAY(TODAY()) == 6 || DAY(TODAY()) == 8 || DAY(TODAY()) == 10 || DAY(TODAY()) == 12 || DAY(TODAY()) == 14 || DAY(TODAY()) == 16 || DAY(TODAY()) == 18 || DAY(TODAY()) == 20 || DAY(TODAY()) == 22 || DAY(TODAY()) == 24 || DAY(TODAY()) == 26 || DAY(TODAY()) == 28 || DAY(TODAY()) == 30
Note: We could also use the more elegant module to the same effect. However, the above example is easier to adapt to specifc days of the month. But if your are looking for a more elegant way of charging on even days only, this condition would serve:
MOD(DAY(TODAY()), 2) == 0
We add a decision element to proceed with our flow if this formula returns true. As we run the flow once every day this will happen on any even day.
Now we simply need to add an Apex action to trigger the direct debit message file generation:
When you activate this flow, Salesforce will regularily request pain.008 file generation from the RaiseNow API. RaiseNow will then process all new direct debit payments, meaning payments that have not previously been included in a pain.008 file, and provide this pain file in Salesforce as a new RaiseNow__Pain_008_File__c object.
You can download the file on the related tab and provide it to your bank.
Please sign in to leave a comment.