SugarCRM Google Maps IFrame URL Parameters

IFrame URL Parameters

Some recent questions have been asked, regarding the different ways to use the JJWDesign Google Maps inside of SugarCRM. One of the best ways is to add Maps into your Views using IFrame Fields. This posting will describe the various formats of the IFrame URL parameters. Please note this is to be used in a SugarCRM “IFrame” field created in the SugarCRM Studio. This post does not describe how to add the IFrame field or how to add the field to your views. Please refer to the SugarCRM documentation for those topics.

The URL’s described here are relative to the SugarCRM application index.php file. Always use absolute paths when creating your IFrame URLs. Fields that should be replaced with values are shown with brackets [ ]. Fields that are part of the “Generated” IFrame URL are shown in curly brackets { }. Note, all of the URL’s described here use the “jjwg_Maps” controller with action “map_markers” (module=jjwg_Maps with action=map_markers).

Example URL:

index.php?module=jjwg_Maps&action=map_markers&record=cd9169eb-e2e7-49a6-ce6e-527c325f90a7

or using {id} for the record id,

http://www.yourdomain.com/sugarcrm/index.php?module=jjwg_Maps&action=map_markers&record={id}

If you are using the iFrame URL field to display the maps, then a automatically injected record id {id} can be used in your “Default Value”. The records defined address {jjwg_maps_address_c} may also be used where appropriate; see below.

Share a Saved Map by Record ID

The Maps saved in the Maps module can be shared using the following parameters in your URL. This is the most simple format, as all of the required map settings are already part of the Map record. All you need is the record id (UUID).

index.php?module=jjwg_Maps&action=map_markers&record=[id]

  • module: jjwg_Maps
  • action: map_markers
  • record: The ‘id’ field value of the Map record (UUID)

Example URL:

index.php?module=jjwg_Maps&action=map_markers&record=cd9169eb-e2e7-49a6-ce6e-527c325f90a7

Map Records Related to a Center Point

Related record maps are the most common type of maps. It’s based on a center point (related record) and a module type to display (display type).

index.php?module=jjwg_Maps&action=map_markers&relate_id=[id]&relate_module=[relate_module]&display_module=[display_module]&distance=[distance]&unit_type=[unit_type]

  • module: jjwg_Maps
  • action: map_markers
  • relate_id: The ‘id’ field value of the related record (UUID). {id} may also be used.
  • relate_module: The related record’s module name
  • display_module: The display module’s name
  • distance: Maximum radius distance from related record
  • unit_type: Unit type of distance; either ‘mi’ or ‘km’ for miles or kilometers

Example URL:

index.php?module=jjwg_Maps&action=map_markers&relate_id=58510da2-17f7-ed2b-02f7-51dd71e4b086&relate_module=Accounts&display_module=Leads&distance=9999&unit_type=mi

or

index.php?module=jjwg_Maps&action=map_markers&relate_id={id}&relate_module=Accounts&display_module=Leads&distance=9999&unit_type=mi

Map Records Near a Quick Address

Quick radius maps are usually based on a typed in address using the “Quick Radius Map” form. The address is geocoded on-the-fly to get the geocoding information. Then nearby display records are mapped around that location. This can be done using a hard-coded address, or even a records “defined” address field {jjwg_maps_address_c}. Keep in mind that with hard-coded addresses, you must URL escape your parameter values properly.

index.php?module=jjwg_Maps&action=map_markers&quick_address=[address]&display_module=[display_module]&distance=[distance]&unit_type=[unit_type]

  • module: jjwg_Maps
  • action: map_markers
  • quick_address: Full/partial one line address. The defined address {jjwg_maps_address_c} may also be used.
  • display_module: The display module’s name
  • distance: Maximum radius distance from related record
  • unit_type: Unit type of distance; either ‘mi’ or ‘km’ for miles or kilometers

Example URL:

index.php?module=jjwg_Maps&action=map_markers&quick_address=Orlando%2C+FL,+32810-3608&display_module=Accounts&distance=250&unit_type=mi

or

index.php?module=jjwg_Maps&action=map_markers&quick_address={jjwg_maps_address_c}&display_module=Accounts&distance=250&unit_type=mi

Mapping Account’s Members

One of the most unique maps that can be presented thru an IFrame URL is the Account’s Members map. In an corporately dominated world, its often necessary to map a Parent Account with the Members of that Account (or Children). The members of an account, with the parent, can be mapped using the following URL parameters. Note, the display module type of “Accounts_Members” is a special trigger for the action, it is not an actual module in SugarCRM.

index.php?module=jjwg_Maps&action=map_markers&relate_id=[id]&relate_module=Accounts&display_module=Accounts_Members&distance=[distance]&unit_type=[unit_type]

  • module: jjwg_Maps
  • action: map_markers
  • relate_id: The ‘id’ field value of the related record (UUID)
  • relate_module: Must be set to “Accounts
  • display_module: Must be set to “Accounts_Members
  • distance: Maximum radius distance from related record (9999 Recommended)
  • unit_type: Unit type of distance; either ‘mi’ or ‘km’ for miles or kilometers

Example URL:

index.php?module=jjwg_Maps&action=map_markers&relate_id=11c08a0c-3ab8-21bc-f367-51dd716d027a&relate_module=Accounts&display_module=Accounts_Members&distance=9999&unit_type=mi

or

index.php?module=jjwg_Maps&action=map_markers&relate_id={id}&relate_module=Accounts&display_module=Accounts_Members&distance=9999&unit_type=mi

Well, that should just about do it. It’s probably more than anyone wanted to know. If you have any question or comments please feel free to post them here.

Leave a Comment