Lime CRM Maps

Lime CRM Maps is an add on to Lime CRM which through integration with Google Maps makes it possible to show locations on a map and perform easier operations. The map is shown in Lime CRM as an add-on tab The documentation to how to use Lime CRM Maps is located in the user manual for Lime CRM under F:\Products\Lime CRM\Reusable customizations\Add-ons\Maps

Lime CRM Maps consists of two central parts – The Lime CRM-client and the cache-server. The cache-server has a connection to Goggle Maps to be able to geocode addresses.

The coordinates are saved in a geography field in Lime CRM. This is an xml-field with a graphical component that is shown on the card. When the mouse is drawn over the field a tab is shown in the upper right corner. If it is clicked the coordinates are shown for the actual post and the coordinates can then be edited.

If the coordinates precision (in relation to the address) is known staples is shown down in the right corner. The precision is divided according to the following:

Staples Precision Description
5 ROOFTOP Exact position for the address
4 RANGE_INTERPOLATED Interpolated position (between two known, exact positions) Usually street-level
3 GEOMETRIC_CENTER The positions are calculated to the middle of the street or a smaller area
2 -Not used at the moment
1 APPROXIMATE The precision may vary a lot. Usually not more precision than city or street-level
0 - No precision is given, or the coordinates is missing

When a map is generated Lime first control if there already exists coordinates connected to the card. In that case these are used to show the location on the map. If the coordinates are missing they are searched for in the cache-server.

The purpose of the cache-server is to speed up the geocoding-process if the coordinates are missing in the card. Then a search is performed in the cache-server, trying to find the coordinates here instead. The cache-server is only a large table with addressed attached to their coordinates. If the coordinates are missing here as well a search is performed in Google Maps with the address from Lime CRM. Google Maps returns the address coordinates which are stored in the cache-server for future searches. The coordinates are also imported to Lime CRM and the relevant card. To control if the cache-server is up and running it is possible to “ping” it from the web browser (ignore any security warnings regarding certificates, just keep going): https://maps.lundalogik.se/ping Is everything ok the server responds with ”PONG”.

When generating a map the following happens:

In the first step a check is performed to ensure that the user has authorisation to use the maps-function. In the current version no authorisations are made so every call is let through. The plan is to implement licence handling in upcoming versions.

After validation the client goes through every marked posts and collects them without any coordinates saved on the card. These are sent, one by one, to the cache-server for address look up. On the cache-server a search is made on the database to control if the coordinates are stored here. If the coordinates are not present a geocoding request is sent to Google Maps. The answer from Google Maps contains the hits that matches the post address and the information regarding the accuracy of search. If the hit is good the coordinates are save in the cache-database. If the coordinates are found in the database or at Google Maps they are returned right away to the client and saved on the card. The post is also shown on the map.

The result of a geocoding against Google Maps contains a lot more of information then the coordinates that is desired. The Meta-data Lime CRM Maps is looking for to rank the quality of the geocoding is based on the following: • Status • Quantity of hits • Address match To be qualified as a good geocoding hit the following criteria’s need to be achieved: • Status is OK, meaning no error occurred during the geocoding • Only one hit was returned for the address • The whole address matched • The precision is ROOFTOP or RANGE_INTERPOLATED The results who is not achieving the criterions are shown in a list for the user. The user can from here control the results and choose which hit is correct, the coordinates the user has chosen is then saved on the card in Lime CRM.

When coordinates are found for each post they will be added to the map. This is done through a JavaScript-function on the HTML-page which is shown on the map. A JSON-object containing information regarding the post and its coordinates are sent with some parameters and the JavaScript is making sure that the needle on the map is drawn correctly with correct information in the information window. When all posts have been added the JavaScript-function is called which puts the values on the filtration and shows the posts Lime can't show in a list (example would be that no coordinates could be found).

The client is installed by running the installation program on the computer where the Maps add-on is desired. No configuration is needed for the client itself however, the Lime CRM-database needs to be updated. When the Maps add-on is installed on the client computer some files are copied to the users hard drive. These will be reached from: C:\Program Files (x86)\Common Files\Lundalogik\AddIns\Lundalogik Lime CRM – Maps In the root all required dll-files are stored, under \Utility the file which handles the language support is stored. In \Content the html-pages which the Maps add-on uses locally. Relevant registrations keys can be found at: HKEY_LOCAL_MACHINE\SOFTWARE\(Wow6432Node\)Lundalogik\Lime\ InstalledAddins\LimeMaps.Addin

To be able to use the Maps add-on the following requirements are needed:

• .NET 4 (Full version) installed on the client computer • Lime CRM 10.8

• Geography fields on the tables which posts are desired to be shown on the map (Example Company or Persons). There is no restriction for which kind of table the map can be generated on.

In LISA a geography field can be added:

1) 	Log on to the database and open the table where the geography field is supposed to be put.
2)   	Create a new field with the following configuration:
* Fieldtype: XML-field
* Type: XMLNode
* Field label: Geography
3) 	Create the field and mark it in the list
4) 	Change the width and height to desired values (for example 2 x 2 units) 
5) 	Put the attribute Invisible to No 

To be able to collect coordinates automatically the table need to have some kind of address-field (Filed label for address-field). What kind of address-field is used doesn´t matter, the map add-on looks for all different types. If there are no address-fields present coordinates needs to be added manually on each card to be able to show the post on the map. If many address-fields are present they are prioritized according to the following order:

1) Visiting address divided on multiple fields with the following labels:	
* Visiting address - Postal address 1
* Visiting address - Postal address 2
* Visiting address - Postal zip code
* Visiting address - Postal city 
* Visiting address - Postal country
2) Address divided on multiple fields with the following labels. 
* Address – Postal address
* Address – Postal zip code
* Address – Postal city
* Address – Postal country
3) Address, work
4) Address, home

For some customers it might be relevant to customise the Maps add-on according to the customers Lime CRM-solution. The following describes a real case:

The Maps add-on is configured for being able to handle company and machines. This means that it is possible to print companies and machines through Google maps. When you plot a machine or a company the Maps add-on firstly uses the coordinates which are stored in the coordination-field on the post that is about to be plotted. If there are no coordinates present the Maps add-on uses the address-fields to collect data and find the correct coordinates which a stored in the coordinates-fields automatically if found. This will speed up the process next time the object is about to be plotted.

Being able to plot the companies on the map coordinates-fields have been added to the company card. This field is placed at the down bottom of the card under a separater and is no field the users should be working with but is mainly data that is used by the Maps add-on to store the coordinates.

To be able to plot the machines on the map it is required that every machine is connected to an address (which will be used to access the coordinates). We have solved this by adding a coordination-field and an address-field on the machine card.

To not make the users manually write an address on every machine there is a VBA-customisation (see next chapter) which collects the address from the company that the machine is connected to. The logic is the following: 1) Every time a machine card is opened a control is made if there exists any address-field on the machine. 2) If the machine doesn't have an address-field a control is made if the machines is connected to a company. 3) If the machine is connected to a company the address will be collected to the machine address-field from the company´s address-field Initially every machine have the same address as the visiting address of the company (with the exception for the machines that are not connected to any company). The address can then be changed on a machine if the address is not the same as the visiting address of the company. The following VBA-code handles the addresses on the machine card: If m_controls.GetValue(“visitingaddress”) = “” Then

 If m_controls.GetValue("company") <> "" Then
    Call m_controls.SetValue("visitingaddress", m_controls.GetText("company.visitingaddress"))
 End If
 End If

If a machine/company has been plotted once the post will get coordinates imported to the field “coordinates”. The coordinates are based on the address that was used when the plot was made. If the address is changed the coordinates needs to be cleared which there exists a VBA-customisation for. Public Function EraseCoordinates(ID As Long, Table As String)

  On Error GoTo Errorhandler
  Dim oRecords As New LDE.Records
  Dim oRecord As New LDE.Record
  Dim Filter As New LDE.Filter
  Dim oBatch As New LDE.Batch
  
  Call Filter.AddCondition("id" & Table, lkOpEqual, ID)
  oRecords.Open Database.Classes(Table), Filter
      
  For Each oRecord In oRecords
      oRecord.value("coordinates") = ""
      oRecord.Update oBatch
  Next
          
  Set oBatch.Database = Application.Database
  oBatch.Execute   
  Exit Function 
  Errorhandler:
  Call UI.ShowError("Globals.EraseCoordinates")
  End Function

If the Maps add-on does not work. If the message “Cannot access the map-server at the moment” appears when trying to display posts on the map either the map-server is not available or the client´s firewall blocks the call. Also, check that the client has an internet-connection. To control if the server works do the following: Open the browser and go to: https://maps.lundalogik.se/ping (Ignore eventual warnings regarding certificate that might appear). Control that the browser responds with “Pong”. If you can ping the server in the browser it is probably the firewall that blocks the calls. The Maps add-on uses port 80 and 443 to communicate with the server, control that these ports are open. If the messages shows “The database that is used is too old” when trying to plot on the map this is due to the fact that the Lime CRM 10.8 is required.

  • Last modified: 6 months ago
  • by Simon Jehrbo