Form - Background
The widget is not displayed in the UI. It runs continuously in the background to receive events and control form data.
#
TriggersFunction | Description | Example |
---|---|---|
setValue | Sets form field value | const fieldValue = { fieldName: ‘name’, value: ‘Value set from connectedapp’ }; app.interface.trigger(‘setValue’, fieldValue); |
getValue | Gets form field value | app.interface.trigger(‘getValue’, {fieldName: ‘name’}) .then(data => { console.log(‘field value: ’, data); }); |
getFormData | Gets all form fields data | app.interface.trigger(‘getFormData’) .then(formData => { console.log(‘form data: ’, formData); }); |
getFormMeta | Gets form meta json including list of fields | app.interface.trigger(‘getFormMeta’) .then(formMeta => { console.log(‘form meta: ’, formMeta); }); |
setSubFormData | Sets subform data from connected app | const subformData = { subFormId: 1234, subFormValue: [ {name: ‘subform record 1’}, {name: ‘subform record 2’} {name: ‘subform record 3’}, ] }; app.interface.trigger(‘setSubFormData’, subformData); |
getCurrentRecord | Get the current record object if edit record form | app.interface.trigger(‘getCurrentRecord’) .then(record => { console.log(‘record: ’, record); }); |
#
EventsEvent | Description | Example |
---|---|---|
form.changed | This event will be triggered whenever any form field values change. | app.on(‘form.{fieldName}.changed, (fieldValue) => { console.log(‘field value changed’, fieldValue); }); |
form.{fieldName}.changed | This event will be triggered whenever particular field value changed | app.on(‘form.changed’, (formData) => { console.log(‘form data changed’, formData); }); |