I’m currently working with a charity to set up their CRM. One thing they need the ability do in CRM is claim Gift Aid against transactions. Gift Aid is a UK-wide programme whereby charities can receive an extra 25% on all charitable donations made by UK taxpayers.
For this process, we needed the ability to find all the donations where Gift Aid had not yet been claimed and pull these into a primary report to be checked. Then when the report has been checked and submitted to HMRC (The UK’s tax, payments and customs authority), we can mark all the Gift Aid transactions as completed, so they won’t be double counted in the next report.
Historically, using standard CRM workflows, listing/amending numerous related records was not possible without writing javascript.
Flow provides a no-code (or at least low-code!) solution to this, which is pretty straightforward to set up, and easy to maintain/troubleshoot further down the line.
1. CRM Set-up
Firstly, in CRM I created a new entity: ‘Gift Aid Process’. This is where the whole process will run from start to finish.
On this new Gift Aid process entity, we want to have two flows running; the first to find all the relevant transactions and link them to this entity to run the report from, the second to tick all the transactions as completed when the user has submitted their report to HMRC.
In this entity I created the following basic fields:
- ‘Up To Date’ – the input parameter for our report.
- ‘Process Run Date’ – will be updated by the flow automatically.
- ‘Submitted’ – a boolean field, to kick off the second flow
- ‘Submitted Date’ – will be updated by the second flow automatically
- I also used the new auto-number functionality to set a standard unique reference code as the name field for my new Gift Aid process entity N.B. You need to make sure the name field is not business required, as the auto-number functionality works on first save of the record, so it will error on create in this case.
I then created a 1:N relationship between my Gift Aid process entity and my transaction entity, and added in a transaction subgrid to the Gift Aid process main form.
Now we can create our flow by navigating to ‘make.powerapps.com’. The best place to build Flow is from within a solution in Dynamics or PowerApps.

2. Flow Trigger
First we first define our trigger for the flow.
We select the required entity and the scope (exactly the same as with standard CRM workflows – usually we choose organisation here).
In this case I’m going to select ‘Create or Update’ and I want to run this when the ‘Up to Date’ contains data.

3. List Records
Here the goal is to find all relevant records based on the required criteria. There are a few ways of specifying the query, I’m going to use the Fetch Xml query to do this. In CRM I make my advanced find on my transaction entity with all the specifications I want (at this stage I set any variable fields as constant values – I’ll change these in a bit).

In your advanced find window, select the ‘Download Fetch Xml’ button on the top bar, and just paste the downloaded text file directly into the Fetch Xml Query field on the ’List Transactions’ step.
Then, for any variable fields, in my case ‘Up to Date’, you want to remove the constant value from the Fetch Xml text, and replace with the relevant field from your ‘Dynamic Content’ panel on the right hand side.

4. Apply to each
Here, to run a routine task on each record found in the previous step (transactions in this example) we must select ‘value’ from the dynamic content panel, in the ‘select an output from previous steps’ field.
We then want to add a new step under to define the action on each record. Here I am going to update, and I need to select the entity name and then define the Item ID using the dynamic content panel to find the ‘Transaction’ field.

5. Update listed records
Now we can set any field value in the entity, either statically or based on dynamic content. In my case, I simply want to link all my records to this Gift Aid process entity via a lookup, so that they are all visible in my subgrid, and so we can run a report on them.
To add a lookup value to a field when updating/creating a record in flow, we need to use the following syntax:
“Entity_Plural_Schema_Name(Entity ID)” where the Entity ID comes from the dynamic content panel.

When selecting your dynamic content, flow also splits out the fields into the separate flow steps so you can see clearly where your different dynamic field options are coming from.

6. Update original record
Here we are going to return to the original record (the Gift Aid process record) and update this accordingly to show the date the process was run.
We again have to specify the link back to the original record, specifying the entity and using the dynamic content to get the record ID.
Then I’m going to update the ‘Process Run Date’ using the expression utcNow, from the expressions panel on the right.

This is my final stage, so now we’re ready to save, test and make live!
This example just shows the first flow I mentioned, but my second one was very similar – I found that once I’d got the first one all perfected and tested, the second one fell into place very easily with just a few tweaks.
Working with flow is sometimes a bit fiddly at first, there are certain eccentricities to remember and there’s a lot of options to choose from at every stage. However, I’ve found it well worth putting the extra time in at the beginning to make use of all the functionalities of flow that you can’t get OOTB in any other aspect of Dynamics.