NOTE: The following documentation applies to EasyTerritory integrated with Microsoft Dynamics 365/CRM.
The Location Lookup plugin is a workflow activity, that is, it is used as a step in a workflow process. The location lookup plugin takes latitude and longitude and does a lookup against an EasyTerritory map layer. Typically, this is used against boundary layers to identify regions containing the record location and triggered by changes to the latitude and longitude properties.
This can be used by itself but it is designed to be used in conjunction with the Territory Sync Plugin and the Geocoding Workflow Activity. The Territory Sync Plugin fires when a properly configured EasyTerritory projecty is saved, pushing territory polygons from EasyTerritory to SQL Server and territory attributes to CRM. It can also intersect the territory polygons against records in other entities such as leads or accounts which have latitude and longitude set by this plugin and update territory references on those records.
The Geocoding Workflow Activity fires when an entity record’s address changes, to obtain the new location. The location lookup can then be invoked to look the new location up against the same SQL Server polygon data that is maintained by the Territory Sync Plugin.
- Install the EasyTerritory managed solution for Dynamics 365/CRM.
- Next, create a new workflow process.Inputs to the LocationLookup step are:
MapDotNet URL REQUIRED URI of your EasyTerritory map service endpoint. This should be present in your welcome email.
Map ID REQUIRED EasyTerritory map ID (Use ‘EasyTerritory’)
Layer ID REQUIRED EasyTerritory layer ID defined using MapDotNet UX Studio. (You’ll have one for each table in SQL Azure that corresponds to your CRM entities.)
Field Name REQUIRED Name of field to retrieve from EasyTerritory.
Where OPTIONAL MapDotNet Where clause for filtering returned data, for example, LayerId,Type=5.
REQUIRES ONE OF:
Lat String & Lon String Used for Latitude and Longitude fields that are ‘Single Line of Text’ data type.
Latitude & Longitude Used for Latitude and Longitude fields that are either ‘Floating Point’ or ‘Decimal Number ‘ data type.
The following are used if you need to update an entity reference on the record the workflow applies to.
Reference Attribute Field on the entity being updated that references the Reference Entity.
Reference Entity An entity that is referenced by the entity being updated.
Reference Entity Attribute The attribute on the Reference Entity that we look up the value of [Field Name] against.
Properties below here were recently added. If you need them and don’t see them, please contact email@example.com for an update.
Reference Entity Constraint Attribute An attribute on the Reference Entity that must match the given constraint value for the Reference Entity to be selected.
Reference Entity Constraint Value The value the Reference Entity Constraint Attribute must match.
Reference Entity Constraint Type The .Net type of Reference Entity Constraint Attribute, i.e. string for any sort of text, int, decimal, etc.
Reference Entity Constraint Attribute 2 An attribute on the Reference Entity that must match the given constraint value for the Reference Entity to be selected.
Reference Entity Constraint Value 2 The value the Reference Entity Constraint Attribute 2 must match.
Reference Entity Constraint Type The .Net type of Reference Entity Constraint Attribute 2.
Outputs from the LocationLookup step are:
Data Found A flag (boolean value) that indicates whether the lookup found anything. In the example shown, we check this before updating the target record.
Value The value of [FieldName] for the first record found that intersects the input location, or null if none found.
- Typically, this is set up as a standalone workflow triggered by changes to longitude and latitude. You’ll want it in place prior to a bulk geocode.
If the geocode plugin workflow is the only activity that ever sets longitude and latitude then you should include this plugin in the same workflow as the geocode plugin, conditional on a successful geocode.