Geocode Record Flow Overview
The Geocode Record Flow is a flexible template that can be integrated into other flows or triggered from various parts of Salesforce. It manages the geocoding process and updates location fields using predefined mapping configurations.
Input Variables
• recordid (required):
The ID of the record that needs to be geocoded.
• customMapConfigId (optional):
The ID of the ifspmaps__Custom_Mapping__c record, which contains the address field mapping and the target geolocation field.
How It Works
• With a customMapConfigId Provided:
The flow uses the mapping defined in the specified ifspmaps__Custom_Mapping__c record.
• Without a customMapConfigId:
• For non-standard objects:
The system selects the first available ifspmaps__Custom_Mapping__c record.
• For Account, Contact, or Lead:
The default geolocation rules for these standard objects are applied.
Example: Record-Triggered Flow to Update Geolocation
This flow clears any existing geolocation values when an object’s address is updated. It then geocodes the record with the new address and updates the record with the new geolocation coordinates.
1. Start by Creating a New Flow:
• In Setup, search for and select Flows.
• Click New Flow, then choose Start From Scratch.
• Pick Record-Triggered Flow as your type and click Create.
2. Configure the Trigger:
• Select the object you want to trigger the flow. In this example, we’ll use the Employee Benefit object.
• Set the trigger to When a record is updated.
• Define the entry condition so the flow triggers if an address field is changed (using an OR logic for any condition met).
3. Add the “Reset Geolocation” Subflow:
• Click Add Element and select Subflow.
• Find and select the Reset Geolocation subflow.
• Give it a Label and API Name.
• Set the recordid input to the ID of the record that triggered the flow.
4. Include the “Geocode Record” Subflow:
• Click Add Element again and choose the Geocode Record subflow.
• Provide a Label and API Name.
• For inputs, assign the triggering record’s ID to recordid.
If there are multiple ifspmaps__Custom_Mapping__c records for the same object, you can specify the ID of the one you want to use as the input. If not, just leave it as “Not Included".
5. Save and Test Your Flow:
• Click Save, then give your flow a descriptive Label, API Name, and Description.
• Finally, debug and test your flow to ensure everything works smoothly before activating it in production.
This flow ensures that any time a record address is updated, the flow clears old geolocation data, geocodes the new address, and updates your record accordingly.