Business Console 10.7 | webMethods Business Console Documentation | Developing Gadgets for Business Console | Importing and Enhancing AgileApps Forms | Lifecycle of an AgileApps Cloud Form Gadget
 
Lifecycle of an AgileApps Cloud Form Gadget
The lifecycle of an AgileApps Cloud form gadget is depicted in the flow diagrams and the details of each stage is available in the following table:
Stages
Create Mode
Update Mode
initData()
Initializes the UI model with default values.
Initializes the UI model by retrieving the record from the AgileApps Cloud server using either the AgileApps Cloud object name or object type Id and record ID.
saveNewObjectRecord()
A new object is created with the specified values for the object name or object type.
This stage does not apply to update mode.
updateObjectRecord()
This stage does not apply to create mode.
Updates an existing record with the specified values.
preProcessData()
Converts the data from the back end service response to the UI model format. For example, time field on the UI requires a complete dataTime value but the back end service returns only the timestamp.
Converts the data from the back end service response to the UI model format. For example, time field on the UI requires a complete dataTime value but the back end service returns only the timestamp.
postProcessData()
Converts the data from UI model format to match the back end service requirements. For example, multi check box on the UI needs an Array, but the back end service requires a string with commas as a separator.
Converts the data from UI model format to match back end service requirements. For example, multi check box on the UI needs an Array, but the back end service requires a string with commas as a separator.
buildPathParams ()
Forms the REST URL with the required path and query parameters.
Forms the REST URL with the required path and query parameters.
The following flow diagram depicts the control flow in the create mode:
The following flow diagram depicts the control flow in the update mode:
Inherited Event Subscriptions
On importing an AgileApps Cloud form into Software AG Designer, a few event subscriptions are inherited along with all the required parameters. The gadgetdefinition.xml contains this information.
The gadget generated with the AgileApps Cloud form subscribes to AA_RECORD_CHANGE_EVENT and AA_MODE_CHANGE_EVENT by default. A few events such as GEO_LOCATION and LOOKUP are published by the generated gadget based on the actions you perform.
Payload for both the events are expected in a certain format. The payload for AA_RECORD_CHANGE_EVENT needs to be in the following form:
"AA_OBJECT_RECORD_CHANGE":
payload = {AAObjectName:"",
AAObjectID:"",
AAObjectRecordID:""
}
The payload for AA_MODE_CHANGE_EVENT needs to be in the following form:
"AA_GADGET_MODE_CHANGE":
payload = {AAObjectName:"",
isNewMode:""
}
When the Workstream gadget is placed along with the generated AgileApps Cloud form gadget in a single AppSpace, the gadgets interact seamlessly. In the Workstream gadget, if you select a case instance, the AgileApps Cloud form is automatically refreshed with the details of the selected case instance.
If the generated gadget is placed along with the Business Console maps gadget, then the AgileApps Cloud locations are identified and mapped automatically in the Business Console maps gadget.
Switching Between the Create and Update Modes
On clicking the Settings icon, the gadget settings model dialog appears. Select True in isNewMode to make the form appear with create controls. Select False for the form to appear with editing controls.