1

I'd like some input from someone other than my own testing and experience.

I need to touch "a record" in an object "every hour" (doesn't matter which record, first or last is fine).

In the GUI, I'm talking about doing an EDIT, then a SAVE - no field changes.

The "every hour" is easy. The query to find a record is easy. I'm just thinking maybe all I need to do is essentially three steps in the Flow:

  • Query for a record
  • Assign "1" to an unused Variable (X = 1)
  • Write the record

To be clear, "X" is never actually used, and should cause no issues as it's a variable that gets a value and that's it.

How would you accomplish this "better" or "differently" in Flow, so that you are SURE it is COMMITTING the record even with "no changes"? I'd also be open to changing a field to "what it already equals". I believe my "testing" would simply be... does the Modify Date change after this flow runs? Agreed?

This seems insanely simple, but I don't want to be fooled into thinking I touched a record, and find out later I never was. Or, that I'm doing something inappropriate.

This has to do with a year long caching issue.

Thanks.


ADDED NOTE: Funny how typing out the idea to the general public makes you think more clearly.

Perhaps the solution is that I add a custom field called "Last Touched" date/time, and I stamp that every time - that guarantees it happens when I Write.

Thoughts?

2
  • do you want to automate the changes in every hour without user interaction? Jul 5, 2017 at 18:27
  • Technically there is (no need) for a change, per se. I just need to touch the record. Stamping a field no one cares about seems like the simplest method to be SURE it REALLY IS touching the record (per the added comment at the end of the Question). I think it's a no-brainer when you look at it that way. Just TOUCH A RECORD... set an unneeded datetime field to NOW()............. (haven't put this into practice yet for the cache-problem it's going to help solve)...
    – AMM
    Jul 7, 2017 at 19:04

1 Answer 1

1

I just found this while looking for an improvement on something that I have already implemented. Here's my current solution for what @AMM is asking:

  1. Create an auto-launched flow that that accepts as input a record id (type text). The obvious name for this input variable is "Id" or "ID". The flow has the following flow elements in this order:
  • Get Record. Get only the first record, where the condition requirement is Id Equals {!Id} (or whatever you chose for the record id input variable). For "How to Store Record Data" use "Choose fields and let Salesforce do the rest." The only field is the default one, ID.

  • Update Record. The "Record or Record Collection" is the record from the Get Record element. Depending on what you named the Get Record, this might be {!Get_Record} / "Contact from Get_Record".

That's it. Save and Activate.

  1. Next, use Doug Ayers' Mass Action Scheduler (https://douglascayers-org.github.io/sfdx-mass-action-scheduler/) to schedule the above flow on a regular basis.
  • Adjust the batch size appropriately - e.g., given that the "touch" flow does a SOQL and DML, I recommend a batch size of 100.
  • If you are processing a very large number of records, consider using the SOQL ability in Mass Action Scheduler and LIMIT. You may need to build in some state (e.g., last processed date) so you can track which records have not been recently updated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.