Transmitting Geographical Locations between Workflow and Forms

One possible type of field in Laserfiche Forms is a field that represents a geographical point, as indicated by its latitude and longitude. Using Laserfiche Workflow, you can retrieve location information from an entry and set that location as the value of a Forms location field. Conversely, you can retrieve a geographical point from a Forms location field and assign that point to an entry. This page explains some sample workflows that illustrate how locations can be sent and received between Workflow and Forms.

Sending Geographical Locations to a Forms Geolocation Field

Using Laserfiche Workflow, you can obtain a location token from an entry and assign a Forms variable to have the location token's value. This section describes a workflow that does this. The following sample workflow uses the Invoke Business Process activity, but you can also set variables in an ongoing business process by retrieving variables from a business process and setting them to the appropriate values.

Diagram of sample workflow

The key steps in this workflow are as follows.

  1. Use a Find Entry activity to get the geographical location of an entry. The activity retrieves a token whose value is the JSON string representing the location.
  2. Use a Read JSON activity to extract the Type and Subtype properties in the JSON string as tokens. We need to check these properties to make sure that the JSON string does represent on the earth labelled by latitude and longitude. This is the only type of geographical location that can be sent to Forms geolocation fields.
    1. To extract the Type property, create a JPath expression token and enter Data.Type under JPath Expression. Select Create a token.

      Screenshot of Edit Expression dialog
    2. To extract the Subtype property, create a JPath expression token and enter Data.Subtype under JPath Expression. Select Create a token.

      Screenshot of Edit Expression dialog for extracting subtype.
  3. Use a conditional sequence that sets the Forms geolocation fields only if the JSON string has a value of Point for Type and a value of XY for Subtype. This is the only type of geolocation that Forms supports. If these conditions are not met, the workflow does nothing.
  4. If the conditions described in step 3 are met, the workflow proceeds to do the following:
    1. Use another Read JSON activity to extract the latitude and longitude from the value of Point in the JSON string. In the properties for the Read JSON activity, do the following:
      1. For the JSON Source, select the token produced in step 1 which represents the JSON string.
      2. Configure a JPath expression to extract the latitude from the JSON string and create a token from it. Enter Data.Point[0] under JPath Expression and select Create a token.

        Screenshot of Edit Expression dialog
      1. Configure a JPath expression to extract the longitude from the JSON string and create a token from it. Enter Data.Point[1] under JPath Expression and select Create a token.

        Screenshot of Edit Expression dialog, for longitude token
    2. Use the Invoke Business Process activity or Set Business Process Variables activity to assign the tokens to a form's geolocation field.

Retrieving a Geographical Location from a Forms Geolocation Field

The following sample workflow illustrates how to retrieve geographical data from a Forms geolocation field and assign the data to a repository entry.

 

When Geolocation is sent from Forms to Workflow it's currently sent as {"Latitude":"33.8200657","Longitude":"-118.1883175"}. Workflow expects the format to be:

{
			"Data": {   
			"Type": "Point",  
			"Subtype": "XY",  
			"Point": [%(RetrieveBusinessProcessVariables_Geolocation\Longitude), %(RetrieveBusinessProcessVariables_Geolocation\Latitude)]
			}
			}