Skip to main content

Form - Background


The widget is not displayed in the UI. It runs continuously in the background to receive events and control form data.

Triggers#

FunctionDescriptionExample
setValueSets form field valueconst fieldValue = {
fieldName: ‘name’,
value: ‘Value set from connectedapp’
};
app.interface.trigger(‘setValue’, fieldValue);
getValueGets form field valueapp.interface.trigger(‘getValue’, {fieldName: ‘name’})
.then(data => {
console.log(‘field value: ’, data);
});
getFormDataGets all form fields dataapp.interface.trigger(‘getFormData’)
.then(formData => {
console.log(‘form data: ’, formData);
});
getFormMetaGets form meta json including list of fieldsapp.interface.trigger(‘getFormMeta’)
.then(formMeta => {
console.log(‘form meta: ’, formMeta);
});
setSubFormDataSets subform data from connected appconst subformData = {
subFormId: 1234,
subFormValue: [
{name: ‘subform record 1’},
{name: ‘subform record 2’}
{name: ‘subform record 3’},
]
};

app.interface.trigger(‘setSubFormData’, subformData);
getCurrentRecordGet the current record object if edit record formapp.interface.trigger(‘getCurrentRecord’)
.then(record => {
console.log(‘record: ’, record);
});

Events#

EventDescriptionExample
form.changedThis event will be triggered whenever any form field values change.app.on(‘form.{fieldName}.changed, (fieldValue) => {
console.log(‘field value changed’, fieldValue);
});
form.{fieldName}.changedThis event will be triggered whenever particular field value changedapp.on(‘form.changed’, (formData) => {
console.log(‘form data changed’, formData);
});
On This Topic