API - Custom Form Data Searching
The following will outline the process of searching custom form data within the system.
Before beginning the process of searching in custom form data, you should use the following searches to acquire information about the form you would like to search.
Search For Custom Forms - All
This first endpoint will return an array of all active forms in the organization. (True is the boolean value for active in this url).
GET https://securelb.trackerproducts.com/api/forms/all/true
The response will return some pertinent information about the form including the schema, id, and model type id.
Custom Form
Note the form id and the modelTypeId. The id will be used later in searching, and the model type is important so that the search is run against the correct entity - case, item, or person.
In order to see the model types, use this endpoint:
GET https://securelb.trackerproducts.com/api/modelTypes
This returns an array of model types used throughout the system.
Model Types
Search For Custom Forms - By Model Type (Form Type)
Forms can also be searched by form type.
The form type is the id to the corresponding model type.
4 = cases
5 = items
11 = people
0 = all
GET https://securelb.trackerproducts.com/api/forms?formType=Cases
This will return an array of all case custom forms.
Search For Custom Forms - By Id
Forms can also be searched by their.
GET https://securelb.trackerproducts.com/api/forms/913
Here is the response for a form we will use for our first search:
Custom Form With Text Field
The most important information here is in schema => fields.
For this example we will be concerned with the type (text), and the name (field5617).
Searching Within A Custom Form - Text Field
From the above example, we will be doing a people search within the Person Form Test custom form.
Here is the endpoint we will be using:
POST https://securelb.trackerproducts.com/api/people/search
The search parameters we will be supplying will be in the body of the post.
Custom Form Text Search
Note - "formId" is the id of the form we are searching.
"name" is the field we are searching in
"model" is the value we are searching for
For a review of how to use search criteria, see this page of the Support Guide: People Search
This returns an array of person records that have "Powdered Sugar" as a value in the Test Text Box of Person Form Test custom form:
Image title
Another note in the search body of our POST is the "searchJustForm". If true, this will return all people in the system that have this attached custom form. So making that one change to the body of my post, I will get back the following:
Anything in form result
Now we have 18 records returned, and the value stored for the field does not matter. All person records with the form will be returned.