0

Summarize the problem - I've tried to work out how to use a flow to delete specific data if the last modified date is today's date + 2 years ago. This is then to delete specific data within the Campaign Member information (name, email etc) so that after the 2 years, whatever is stored gets deleted automatically (without going down the apex route unless I have to..)

Describe what you’ve tried - I've created a couple of flows, some have worked and some have not thanks to my dodgy formula creations - I did manage to get it working to show me some data, however I still can work out how to get it to calculate over 2 years old as the last modified date... I did find a snippet of code, again - it didn't work for me, IF(CampaignMember.LastModifiedDate < TODAY() - 2 * 365, 'YES', 'NO')

Here is a picture of the working flow.. that works.. but it's not automated.. Attempt 1

As I was being a dummie - I thought to use an auto launched flow to make it work in the background for me, checking all the time to see if the Campaign has been over 2 years, Automated one and Here's the formula that I've put above the decision

Anybody know where I'm going wrong here or should I start learning Apex to do this?

Many thanks in advance!

Update 11/04/21

Using the checkbox has managed to work something - please see my comment for more information below: Here's the latest - click me

1 Answer 1

0

You can definitely do this with Flow.

  • If you have legacy data going back in time, you'll need to use a Schedule-triggered flow that runs every day

  • Because schedule-triggered flows don't have entry conditions that support relative dates (at least as of Spring 22), you'll need a formula field on CampaignMember which calculates a checkbox: Is_GDPR_Deletion__Eligible__c. This field should take some reference date and subtract two years from it. Using LastModifiedDate maybe problematic as a reference date as stuff can happen to records unrelated to any business event (like Data loader repairs, 3rd party integrations, etc)

  • Configure your schedule-triggered flow to only include CampaignMember is Is_GDPR_Deletion_Eligible__c = true. This will effectively be a table scan that runs every day.

  • Be aware of Limits - 2000 executed flow elements per transaction

Now, if you have no legacy data, then you can use Record-triggered flows with scheduled paths. Again, based on a reference date in CampaignMember, the scheduled path can be set to +2 years hence. If the reference data changes in the record, then SFDC automatically adjusts the future scheduled path

3
  • Very interesting - I hadn't considered adding a new field! thank you for the suggestion - i'll be giving this a go this afternoon and will see how it goes! Thank you.
    – Ekemo
    Commented May 11, 2022 at 8:18
  • Wow. So i've put in what you've suggested (although not figured out the calculation for more than 2 years ago yet...) But the checkbox had worked as it has something to "get" and run against!
    – Ekemo
    Commented May 11, 2022 at 14:20
  • To further this - As i needed to work out a date - I made another flow to update a new record to place the date in when the checkbox is ticked... so as this is not a date that can be constantly checked... I'll update with a picture soon to show you what i mean..
    – Ekemo
    Commented May 11, 2022 at 15:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .