Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Drupal Building Housing records are synchronized from MOH SalesForce on a schedule. Salesforce is the authoritative source, and data should not be added or changed in Drupal.
There are 6 synchronizations with Salesforce which run in the following order, every cron run (so every 5 mins) The order is important, because Projects must be created before Attachments & Website Updates before Meetings & Chatter postings.
Each synchronization process does the following: A Drupal Application runs a Salesforce API object query to identify any records in the SF object which have been deleted or which have their last updated date after a last updated date stored by Drupal for that SF object. The identified records are then added/updated or deleted in Drupal. At the end of the process Drupal updates its last updated date for that object with the latest SF updated date found in the import. This date is then used as a high-water mark for the next import cycle.
This synchronization imports Project records from Salesforce Project__c
object into Drupals' bh_project
entity.
This synchronization manages project stages, documents and messages to appear on the timeline. It extends and replaces the functionality for the Update__c object which is imported for legacy reasons in Building Housing - Project Update
.
There is only ever 1 Website Update (Website_Update__c
) record per Project (Project__c
) record in Salesforce.
There is a rule in Salesforce to stop multiple records which would potentially create confusion for project stages etc.
If multiple Website Update records do exist for a Project in Salesforce, then all records will be imported into Drupal, but ONLY the last (when ordered by createdDate) will be used in the Project Timeline.
There should be no new Update__c records being created in SF. However, there are legacy records containing data which must be included in Drupal. Even though we do not normally expect the sync to process these objects, the code is important if the data is to be recreated accurately and completely (for example if a Salesforce purge is performed).
This handles legacy TextMessages (now use chatter) and document attachments (now use Website Update Attachments).
This synchronization imports Community Meetings event records from Salesforce Community_Meeting_Event__c
object into Drupals bh_meeting
entity.
This is a simple mapping and the import does little except cleaning up any URLs and address fields.
The bh_meeting
record holds a reference to it's parent bh_update
which is linked to the bh_project
.
If a Meeting event is updated, or deleted in SF, then the associated record will be updated in Drupal, and if necessary will move on the timeline.
Sync Name | Drupal Destination | SF Origin |
---|---|---|
Building Housing - Projects
bh_project
Project__c
Building Housing - Website Update
bh_update
Website_Update__c
Building Housing - Project Update
bh_update
Update__c
BH Community Meeting Event
bh_meeting
Community_Meeting_Event__c
Building Housing - Parcels
bh_parcel
Parcel__c
Building Housing - Parcels-Project Assoc
bh_parcel_project_assoc
ParcelProject_Association__c
A DND Development Officer is able to create a Meeting object in Sales Force, with all the meeting information, and attach it to a Project in Sales Force. When CRON runs on Drupal it then will sync any new or updated Meetings from Sales Force with a Drupal BH Meeting. After the new meeting is crated in Drupal, we also creat a Drupal Event so that the meeting will be listed on the Boston.gov Events page. The Meeting is also then displayed on the corresponding Drupal BH Project.
BH Meeting Content Type: /admin/structure/types/manage/bh_meeting
Sales Force Mappings: /admin/structure/salesforce/mappings/manage/bh_community_meeting_event
Templates:
docroot/modules/custom/bos_content/modules/node_buildinghousing/templates/snippets/bh-project-meeting-notice.html.twig
docroot/modules/custom/bos_content/modules/node_buildinghousing/templates/snippets/bh-project-timeline-meeting.html.twig
Helper Functions (Pre-process, alters):
docroot/modules/custom/bos_content/modules/node_buildinghousing/node_buildinghousing.module
docroot/modules/custom/bos_content/modules/node_buildinghousing/src/BuildingHousingUtils.php
This feature allows Drupal entities to sync back and forth with Sales Force Objects via the Drupal Sales Force module. It is primarily used by DND to use the data and access that is already on DND's Sales Force server to automatically sync with the Boston.gov Drupal site. This is controlled by field mapping configurations in the Drupal Sales Force module. Currently, all syncing is scheduled to happen on Drupal CRON run, every 5 minutes, with only updated objects.
Sales Force Mappings:
Building Housing - Projects (/admin/structure/salesforce/mappings/manage/building_housing_projects/fields)
bh_project --> Project__c
Building Housing - Website Update (/admin/structure/salesforce/mappings/manage/bh_website_update/fields)
bh_update --> Website_Update__c
Building Housing - Project Update (/admin/structure/salesforce/mappings/manage/building_housing_project_update/fields)
bh_update --> Update__c
BH Community Meeting Event (/admin/structure/salesforce/mappings/manage/bh_community_meeting_event/fields)
bh_meeting --> Community_Meeting_Event__c
Building Housing - Parcels (/admin/structure/salesforce/mappings/manage/building_housing_parcels/fields)
bh_parcel --> Parcel__c
Building Housing - Parcels-Project Assoc (/admin/structure/salesforce/mappings/manage/bh_parcel_project_assoc/fields)
bh_parcel_project_assoc --> ParcelProject_Association__c
Sales Force Settings:
Building Housing - Projects (/admin/structure/salesforce/mappings/manage/building_housing_projects)
Building Housing - Website Update (/admin/structure/salesforce/mappings/manage/bh_website_update)
Building Housing - Project Update (/admin/structure/salesforce/mappings/manage/building_housing_project_update)
BH Community Meeting Event (/admin/structure/salesforce/mappings/manage/bh_community_meeting_event)
Building Housing - Parcels (/admin/structure/salesforce/mappings/manage/building_housing_parcels)
Building Housing - Parcels-Project Assoc (/admin/structure/salesforce/mappings/manage/bh_parcel_project_assoc)
Troubleshoot Sales Force connection issues
If Drupal and Sales Force are not connecting or syncing please check the Authorization from Drupal to Sales Force (/admin/config/salesforce/authorize/list). You may need to Re-auth or even make a new connection if you need to connect to a lower development or testing environment on Sales Force. If you need access to an instance contact DND's Sales Force developer/administrator.
If a single item is not syncing or if you need info about the Drupal to Sales Force connection you can view the list this admin page. If you edit the instance you then have the option to force pull or push the Drupal entity with the Sales Force Object. If there is an issue you should see an error message in the response. You can also find other useful info like timestamps and record ids.
From the building housing landing page a user can click and open a map showing all the current projects. The map and sidebar list are both generated via Building Housing View.
Entry point: /buildinghousing (click show map)
Custom CSS:
docroot/modules/custom/bos_content/modules/node_buildinghousing/css/node_bh_landing_page.css
docroot/modules/custom/bos_content/modules/node_buildinghousing/css/views_bh_listings.css
Views Template: docroot/modules/custom/bos_content/modules/node_buildinghousing/templates/views-view--bhmaps--maplist.html.twig
Views Functions: docroot/modules/custom/bos_content/modules/node_buildinghousing/node_buildinghousing.views.inc
Custom Markers: docroot/modules/custom/bos_content/modules/node_buildinghousing/images
The following Drupal Entities are created to warehouse/cache data which originates in Salesforce.
The following nodes have records which are populated (add, update and delete) by mappings between Salesforce and Drupal which are run each cron cycle.
The following taxonomies have been created and their list items are maintained manually by Drupal developers. Taxonomy items can be added and deleted as needed, but usually will need adjustments to code to work as required.
As at March 2023
Building Housing allows constituents to see a full inventory of projects and parcels managed by the city of Boston.
Entry point: /buildinghousing (click show map)
URL pattern: /buildinghousing/{ProjectName}
Custom CSS: docroot/modules/custom/bos_content/modules/node_buildinghousing/css/node_bh_project.css
Field Templates: docroot/modules/custom/bos_content/modules/node_buildinghousing/templates/snippets
Field Formatters: docroot/modules/custom/bos_content/modules/node_buildinghousing/src/Plugin/Field/FieldFormatter
Helper Functions (Pre-process, alters, fields):
docroot/modules/custom/bos_content/modules/node_buildinghousing/node_buildinghousing.module
docroot/modules/custom/bos_content/modules/node_buildinghousing/src/BuildingHousingUtils.php
Parcel Map - settings
Uses BuildingHousingUtils->setParcelGeoPolyData() and Arcgis to set the Polygon geo data for the parcels
Photo gallery - settings
Building Housing Project Map (same as above Map feature)
Project information
Developer Information - Custom field in node_buildinghousing.module
Project Goals
Project Timeline - Altered field to combine other fields
docroot/modules/custom/bos_content/modules/node_buildinghousing/src/Plugin/Field/FieldFormatter/EntityReferenceTaxonomyTermBSPublicStageFormatter.php
docroot/modules/custom/bos_content/modules/node_buildinghousing/src/BuildingHousingUtils.php
Project Type - Custom field in node_buildinghousing.module
Contact information - Custom field in node_buildinghousing.module
Email sign-up - Custom field in node_buildinghousing.module
Feedback form - settings
Building Housing allows constituents to see a full inventory of projects and parcels managed by the city of Boston.
This Drupal App allows residents to browse all active housing, open space, commercial, and to be decided (TBD) projects. It also provides information on city-owned land for sale.
Residents can click search for a specific project and/or view a map of all projects. A drill-down into a project page displays goals, a timeline, photos, meetings and more.
Search for Projects on the Building Housing Map
View details of a Project
Auto-create Community Meeting Events from Sales Force on CRON (5 minutes)
Auto-create and update Projects from Sales Force on CRON (5 minutes)
Drupal
Sales Force
Google Maps API
node_buildinghousing (docroot/modules/custom/bos_content/modules/node_buildinghousing)
Views
Webforms
Geolocation
Salesforce
The largest on-page component for a Building Housing Project record in Drupal is its timeline. The timeline visually displays a Projects past and projected events & information in a time ordered list.
The main code is contained here:
docroot/modules/custom/bos_content/modules/node_buildinghousing/src/Plugin/Field/FieldFormatter/EntityReferenceTaxonomyTermBSPublicStageFormatter.php
Various templates are defined to create each timeline article, one template per timeline type.
Timeline icons are controlled by css and are defined in function getStageIcon()
in EntityReferenceTaxonomyTermBSPublicStageFormatter.php
The various stages are defined at items in the bh_public_stage
taxonomy
Entity | Name | Description |
---|---|---|
Timeline items are gathered from various places in the system.
- text posts are items in the field_bh_text_updates
field of the bh_update
entity. Tiles are inserted using the messages create date for ordering. If the message is updated in SF, it continues to use the original created date. If the message is deleted in SF it should be deleted from the timeline. Posts are sourced from Salesforce Chatter and imported using .
- documents are file objects which are referenced as items in the field_bh_attachment
field of the bh_project
. Tiles are inserted using the create date of the attachment for ordering. If Drupal detects an update to the attachment in SF, it continues to use the original created date for ordering. Documents are sourced from Salesforce and imported using .
- a single rfp tile is created if the field_bh_rfp_issued_date
field is not empty Tile is inserted using the date in the field_bh_rfp_issued_date
field. If the date is changed (or deleted) in SF, the rfp tile will be moved or removed from the timeline. RFP date is sourced from Salesforce as part of .
- meetings are bh_meeting
objects which are referenced as items in the field_bh_update_ref
field of the bh_update
entity. Tiles are inserted using the meetings start date. If the meeting is updated in SF, meeting will move accordingly in the timeline. Meetings are sourced from Salesforce and imported using .
- stages
node
bh_project
The primary content_type for a Building Housing Property. Contains meta data about the Project and links to updates, attachments, parcels etc.
node
bh_update
Contains information about updates to a project. This includes certain status changes, attached documents, links to community meeting records and comments from CoB Project Managers to insert into the timeline.
node
bh_meeting
Contains information about Community Meetings held by CoB with residents regarding Building Housing Properties.
node
bh_parcel
The official parcel number and top-level info - with GIS coordinates for the parcel.
node
bh_parcel_project_assoc
Possibly deprecated ? I believe the parcel# is now saved in the field_bh_parcel_id field of bh_project.
node
bh_contact
Deprecated (no data)
node
bh_account
Deprecated (no data)
taxonomy
bh_project_stage
The overall project stage. (usually when project status = active).
Linked directly from bh_project
.
taxonomy
bh_project_status
The status of the Project.
Linked directly from bh_project
.
taxonomy
bh_funding_stage
The funding stage for the Project.
Linked directly from bh_project
.
taxonomy
bh_project_type
The broad project type for the Project.
Linked directly from bh_project
.
taxonomy
bh_project_update_type
Update type for a bh_update
.
Linked directly from bh_update
.
taxonomy
bh_property_type
The property type.
Linked directly from bh_parcel
.
taxonomy
bh_public_stage
The Project stage as used in the timeline.
Linked directly from bh_project
.
taxonomy
bh_neighborhood
taxonomy
bh_record_type
taxonomy
bh_disposition_type
List of disposition types - for use in map.
view
building_housing
view
bh_maps
view
building_housing_updates
page
buildinghousing/[propertyname]
This is the landing page for information about a property.
This is a customized page for the node bh_project
and contains a timeline and information about parcels.