Building > Forms > Configuring > App Form SMS
Trigger calls and SMS from within the form, or send an SMS once submitted.
In version 2.13.0 and higher, you can configure app forms to generate additional docs upon submission. You can create one or more docs using variations on the configuration described below. One case where this can be used is to register a newborn from a delivery report, as shown below. First, here is an overview of what you can do and how the configuration should look in XML:
Extra docs can be added by defining structures in the model with the attribute
db-doc="true"
true
in your XLSform, even though Excel will default to TRUE
.<data>
<root_prop_1>val A</root_prop_1>
<other_doc db-doc="true">
<type>whatever</type>
<other_prop>val B</other_prop>
</other_doc>
</data>
Report (as before):
{
_id: '...',
_rev: '...',
type: 'report',
_attachments: { xml: ... ],
fields: {
root_prop_1: 'val A',
}
}
Other doc:
{
"_id": "...",
"_rev": "...",
"type": "whatever",
"other_prop": "val B"
}
<sickness>
<sufferer db-doc-ref="/sickness/new">
<new db-doc="true">
<type>person</type>
<name>Gómez</name>
<original_report db-doc-ref="/sickness"/>
</new>
</sickness>
Report:
{
"_id": "abc-123",
"_rev": "...",
"type": "report",
"fields": {
"sufferer": "def-456"
}
}
Other doc:
{
"_id": "def-456",
"_rev": "...",
"type": "person",
"name": "Gómez",
"original_report": "abc-123"
}
<thing>
<name>Ab</name>
<related db-doc="true">
<type>relative</type>
<name>Bo</name>
<parent db-doc-ref="/thing"/>
</related>
<related db-doc="true">
<type>relative</type>
<name>Ca</name>
<parent db-doc-ref="/thing"/>
</related>
</artist>
Report:
{
"_id": "abc-123",
"_rev": "...",
"type": "report",
"fields": {
"name": "Ab"
}
}
Other docs:
{
"_id": "...",
"_rev": "...",
"type": "relative",
"name": "Bo",
"parent": "abc-123",
}
{
"_id": "...",
"_rev": "...",
"type": "relative",
"name": "Ch",
"parent": "abc-123",
}
This example shows how you would register a single newborn from a delivery report.
First, the relevant section of the delivery report XLSForm file:
Here is the corresponding portion of XML generated after converting the form:
<repeat>
<child_repeat db-doc="true" jr:template="">
<child_name/>
<child_gender/>
<child_doc db-doc-ref=" /delivery/repeat/child_repeat "/>
<created_by_doc db-doc-ref="/delivery"/>
<name/>
<sex/>
<date_of_birth/>
<parent>
<_id/>
<parent>
<_id/>
<parent>
<_id/>
</parent>
</parent>
</parent>
<type>person</type>
</child_repeat>
</repeat>
If you’ve done your configuration correctly, all you should see when you click on the submitted report from the Reports tab is the child_doc
field with an _id
that corresponds to the linked doc. In this case, you could look for that _id
on the People tab or in the DB itself to confirm that the resulting doc looks correct.
This example extends the above example to show how you would register one or multiple newborns from a delivery report. This allows you to handle multiple births.
First, the relevant section of the delivery report XLSForm file:
Here is the corresponding portion of XML generated after converting the form:
<repeat>
<child_repeat db-doc="true" jr:template="">
<child_name/>
<child_gender/>
<created_by_doc db-docs-ref="/delivery"/>
<name/>
<sex/>
<date_of_birth/>
<parent>
<_id/>
<parent>
<_id/>
<parent>
<_id/>
</parent>
</parent>
</parent>
<type>person</type>
</child_repeat>
</repeat>
If you’ve done your configuration correctly, all you should see when you click on the submitted report from the Reports tab is that there will be no information on the children created. You will find the created docs as siblings to the subject of the previously submitted report. Each of these child docs will have a field created_by_doc
whose value is the _id
of the report that created them. You can also look in the DB itself to confirm that the resulting docs look correct.
Trigger calls and SMS from within the form, or send an SMS once submitted.
How to include multimedia files in forms
Contact Forms: Used for creating and editing people and places
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.