Have you noticed that Salesforce’s Last Activity Date is not very useful? It could have been triggered by a number of activities, but not always the ones that matter. Think of this Flow as a blueprint for any type of activity you would like to track.
Imagine a stakeholder asks you, “Can I have a Last Activity Date for only completed Demos on an Account? We want to be able to easily report and track the Accounts we are Demoing on.” Lets assume for the purpose of this example that every Demo preformed is as a Task on an Opportunity. Every time a someone completes a Demo, they must select what type of Demo was preformed via the Custom Picklist Field Demo Type.
Create a Custom Date Field on the Account. Label the Custom Field Last Demo Date. (Setup | Customize | Accounts | Fields)
Create a New Flow. (Setup | Create | Workflows & Approvals | Flows)
For this Flow we need to create two Text Variables and one Date Variable. Call the variables AccountId and OpportunityId, and ActivityDate.
Create a Record Lookup to Find the AccountId from the Opportunity.
Create a Record Update to Update Last Demo Date
Set the Start Element for the Flow
Save the Flow, label it Update Last Demo Date. And then Activate the Flow.
For this Flow we are assuming that the Opportunity is always the WhatId, as that is what the Sales team has been trained to use when tracking their Demos. We use a Process Builder to trigger on all Completed Activities that are Demos. If the criteria was met, we will then have the Process Builder fire off the Autolaunched Flow Update Last Demo Date.
Create a New Process Builder and have it based on the Task Object.
Have the Filter Criteria be when a Demo has been completed. In this case, we want to have it being when a Demo Type is entered and the Task is completed.
Now we get to setup the Autolaunched Flow to fire off the Last Demo Date update. Then, set the Flow Variables for ActivityDate and the OpportunityId.
Hit Save and then Activate the Process Builder! Congrats, you’re done! Now test the Autolaunched Flow to make sure everything is working properly.