The Location object in Maica represents a Location where Services are delivered, i.e. office or home address
Fields & Relationships
The table below provides a comprehensive overview of all fields and relationships for the Location object in Maica. Please refer to the table below for detailed information.
Click here to view and download the complete Location Schema.
Automation
Flows
The list below outlines the Flows applied to the Location Object in Maica.
Please refer to the list below for more detailed information on each Flow.
Location Geocoding
This flow is designed to geocode a location's address upon creation or update of the location record.
Flow Summary
This flow geocodes the address of a location and updates the location record with the latitude and longitude by:
Triggering on the creation or update of a location record.
Geocoding the address fields using an Apex action.
Checking for errors in the geocoding process.
Updating the location record with the geocoded latitude and longitude if no errors occur.
Flow Description
Start (Record-Triggered Flow):
The flow is triggered upon the creation or update of a location record.
The flow runs asynchronously after the record is saved.
Proceeds to geocode the address.
Geocode the Address (Apex Action):
Calls the GeocodeAddressInvocableProc Apex action to geocode the address fields.
Passes the address fields and the record ID as input parameters.
Proceeds to the decision step to check for errors.
Error? (Decision):
Checks if there was an error during the geocoding process by evaluating the errorMessage from the Geocode_the_Address action.
No: If no error, proceeds to update the location.
Yes: If an error occurred, the flow ends without updating the location.
Update Location (Record Update):
Updates the location record with the latitude and longitude values obtained from the geocoding process.
Ends the flow.
Trigger Handlers
The list below outlines the Trigger Handlers applied to the Location Object in Maica.
Please refer to the list below for more detailed information on each Trigger Handler.
Location Geocoding
This trigger is designed to manage the geocoding of locations in Maica.
Execution, Logic & Outcome
Execution of Trigger Logic:
The trigger logic defined in the LocationGeocode_MDTM class is executed when the trigger conditions are met. The class contains the code that manages the geocoding process for locations.
Trigger Conditions:
When a new location (maica__Location__c) is created.
When an existing location is updated.
Any specific field changes that are monitored by the trigger (defined in the handler class).
Logic Explanation
Initialisation:
When a location record is created or updated, the trigger is initialised. The LocationGeocode_MDTM metadata type configuration is loaded, ensuring that the trigger is active (Active__c is true) and has the correct load order (Load_Order__c is 1.0).
Trigger Execution:
Upon initialisation, the trigger executes the logic defined in the LocationGeocode_MDTM class.
The class methods perform the following steps:
Validation: The location address data is validated to ensure it is complete and accurate.
Geocoding: The validated address data is converted into geographical coordinates using geocoding services.
Update: The location record is updated with the newly obtained geographical coordinates.
Trigger Outcome:
Once executed, the trigger ensures that each location is geocoded correctly, based on the logic defined in the handler class. This helps maintain accurate geographical data for locations.