Building > Reference > forms/ > app : Formsappform Namepropertiesjson
App Forms: Used to complete reports, tasks, and actions in the app
This tutorial will take you through how to write the <form_name>.properties.json
file.
The <form_name>.properties.json
file allows you to add logic that ensures that the right action appears for the right contacts (people and places). For instance, an assessment form for children under-5 will only appear for person contacts on the CHT whose age is less than 5.
You will be adding meta-data and context to an assessment workflow that allows Community Health Workers to conduct a health assessment for children under the age of 5.
Form context defines when and where the form should be available in the app.
You should have a functioning CHT instance with cht-conf
installed locally, completed a project folder setup, and an assessment form.
Create a new file in the same folder as your assessment.xlsx
file and name it assessment.properties.json
.
Edit the assessment.properties.json
file and add a title
key with the value corresponding to the desired file title.
{
"title": "Assessment"
}
Add a resources
folder in your project folder and put your preferred icon for assessment in it. Name the icon file icon-healthcare-assessment.png
if it is a png
file or icon-healthcare-assessment.svg
if it is an svg
file.
Create a resources.json
file in your project folder and add key/value pairs for your icon resources.
{
"icon-healthcare-assessment": "icon-healthcare-assessment.png"
}
See Also: Icon Library
Add an icon
key in the assessment.properties.json
file. Pick the key of the icon you require from the resources.json
file and add it as the icon
value.
{
"title": "Assessment",
"icon": "icon-healthcare-assessment"
}
First, add a context
key in the assessment.properties.json
file. Next, add an object with person
, place
and expression
keys. Then, add the boolean value true
for the person
key, the boolean value false
for the place
key and the expression ageInYears(contact) < 5
for the expression
key.
{
"title": "Assessment",
"icon": "icon-healthcare-assessment",
"context": {
"person": true,
"place": false,
"expression": "ageInYears(contact) < 5"
}
}
<form_name>.properties.json
FileRun the following command from the root folder to upload the resources folder and resources.json
file:
cht --url=https://<username>:<password>@localhost --accept-self-signed-certs upload-resources
Run the following command from the root folder to upload the assessment.properties.json
file:
cht --url=https://<username>:<password>@localhost --accept-self-signed-certs upload-app-forms -- assessment
<username>
and <password>
with the actual username and password of your test instance.Once you successfully upload the assessment.properties.json
file, ‘Assessment’ will appear as an action only for person contacts who are less that 5 years old. Additionally, the icon-healthcare-assessment
icon will now show alongside the action name.
App Forms: Used to complete reports, tasks, and actions in the app
This document covers the configuration best practices of forms, tasks, targets, and contact profiles when building your own community health app.
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.