Accessing webform submission data
In any webform submission, only the submitted properties of controls with an identifier are accessible to workflow scripts.
You can access webform submission data in a workflow script using the form
variable. form is a hierarchy of map objects containing a map object for
each named control in the submitted webform. Use the submitted identifiers and the names of
submitted properties with the dot operator to retrieve
the submitted data.
For example, in the webform below, both popup controls have a named child
control, but only one of them has an identifier
itself.
...
<chapter title="Just a regular popup">
<popup title="Click here for a good time">
<chapter title="And a good time was had by all">
<textbox id="goodTimeBox" text="Goodies"/>
</chapter>
</popup>
</chapter>
...
<chapter title="Ain't nobody here but us chickens">
<if id="hider" cond='{NOT invisible.hide.checked}'>
<popup id="invisible" title="You can't keep a good man down">
<checkbox id="hide" text="Hide this guy"/>
</popup>
</if>
</chapter>
In
an associated workflow script, form.goodTimeBox.text can be used to access
the text property of goodTimeBox in an associated workflow
script, because the control's first named parent in the form is the form
element itself. To access the checked status of hide in
the same script requires form.hider.invisible.hide.checked, because the
checkbox control has two named parents nested inside the
form element.
"The input in the textbox:", "Goodies" "The checkbox is checked:", false
When processing webform submissions, keep in mind that only the properties marked as
submitted in the webforms reference guide are accessible in workflow
scripts.
Type mapping
The structure of the data submitted via a webform may be transformed in its workflow script representation. Here's a complete overview of how webforms language data types are mapped onto workflow script data types.
string type
values are available as strings.
The
textbox above, submitted and traced to the
console:
{... textboxAnt: {text: "hovercraft"}, ...}bool type values
are available as bools.
The
checkbox above, submitted and traced to the
console:
{... checkboxBacterium: {checked: true}, ...}int type values are
available as ints.
The
numberbox above, submitted and traced to the
console:
{...nboxCamel: {number: 718706000} ...}float type values
are available as floats.
The
numberbox above, submitted and traced to the
console:
{... nboxCat: {number: 42.1}, ...}dtl type values are available as dtls.
The
datepicker above, submitted and traced to the
console:
{... dpickerDog: {date: 2015.10.14. 0:00:00 (Dtl)}, ...}record type
values are available as maps.
The
selectedKey property of the dropdown above is an
integer, selectedText is a string, and the record-type
selectedValue is represented as a map when submitted to the
Cloud:
{...
ddownElephant:
{
selectedKey: 3,
selectedText: "jellyfish",
selectedValue: {keyFish: 3, valueGecko: "jellyfish"}
}
...}recordset type
values are available as a list of maps.
...
<table id="tableMole"
recordset='{TABLE keyNewt, valueOtter
(1, "panda";
2, "quail";
3, "rhino";
4, "sponge")}'
record="mole">
<row>
<cell>
<textview id="tviewTrout"
text='{TOSTRING(mole.keyNewt)}'/>
</cell>
<cell>
<textview id="tviewUnicorn"
text='{mole.valueOtter}'/>
</cell>
</row>
</table>
...
Workflow
scripts access the data in table controls as a list of map objects through the
rows
field.
{...
tableMole:
{
rows:
[
{
tviewTrout: {text: "1"},
tviewUnicorn: {text: "panda"}
},
{
tviewTrout: {text: "2"},
tviewUnicorn: {text: "quail"}
},
{
tviewTrout: {text: "3"},
tviewUnicorn: {text: "rhino"}
},
{
tviewTrout: {text: "4"},
tviewUnicorn: {text: "sponge"}
}
]
}
...}
Metadata
The following metadata is available on a webform submission's form
variable:
-
form.submissionTitle: the text that is displayed for a webform in the browser UI -
form.info.dtuSubmit: a dtu value of the date and time of the form submission -
form.info.dtlSubmit: a dtl value of the date and time of the form submission -
form.info.user: a map with two keys - the server-assignedinttypeidand thestringtype username (name) of the user who submitted the form
This is how the metadata portion of a varSample webform submission is
represented in an associated workflow
script:
{
...
submissionTitle: "Sample form",
info:
{
dtuSubmit: 2015.08.11. 8:20:14 (Dtu),
dtlSubmit: 2015.08.11. 10:20:14 (Dtl),
user: {id: 31, name: "petar.hoyt@gmail.com"}
}
}