Introduction and Goals

Models allow Forms to get and use data from other sources. For this article we're going to get data from a Datastore.

Goals

The goal for this article is to construct a model from a Datastore. The Model will include attributes and qualifications. The Datastore is modeled after the one created in the previous article

Models Video

Models

A Model is a representation of data and qualifications that is used to bring data into a Form. Examples of Models include, getting accounts from Salesforce, Tickets from ServiceNow, or Locations from an Orale database. Datastores are often used with Models in Request

For our example we'll use the Sites Datastore from the previous article.

Each Model has three parts, Bridge, Attributes, and Qualification (Query).

Using the portal for a Datastore, it's very easy to add the Bridge and the Attributes. Below is an example. The Bridge and Model options are available at the bottom of the Datastore Configuration console.

V5-Model for Sites

You select your Bridge from the dropdown list and then you can set the Attributes by clicking the 'Generate from Fields' button. It automatically adds each field from the Datastore form as an attribute.

V5 Site Model with Attributes

Now that we've done the easy stuff in the Portal we can move to the Application Consoles and see what's behind the scenes.

Attributes

Attributes are a representation of the data from the source system. In the case of our Datastore, each attribute represents a field from the Sites Datastore form.

In the Application console the Attributes are represented like this:

V5 Sites Model Attributes Console

The Names in the left column are the "friendly" names that are used in the application.

Qualifications

Qualifications are used to define the results of a model. The specific query language of the qualification depends on the Source. Again in our example we're using a Datastore, so we could get a list of all the Active sites by finding every site with a Status of Active.

formSlug=sites&limit=1000&index=values[Status]&q=values[Status]="Active"	

Here's an example of the qualifications console:

V5-Site Model Qualifications

Test

An incredibly useful feature included with Models is Testing. Once your Attributes and Qualification are entered, you can test directly from the console, even with parameters.

For each test you select at least one attribute to show, select the qualification to test, and then add a parameter value if needed. Here's an example of the Status Active qualification test:

V5-Site Model Test

In the Next Article

Now that the Model is built, we'll walk through creating a Bridged Resource to get Data for our Form.

Story for this Class

The Cleaning Request created in the previous classes is OK, but now we need to improve the User Experience and Workflow.