We've nearly completed setting up our account opening process. Management would like the possibility to offer additional, optional, services to the client once the account has been opened. Is there any way to encode additional business cases within our process?
Yes: Appway provides a way for you to encode additional, optional, services through the Optional Documents action.
Let's assume we're in an account opening process and the customer has provided all information required to open the account. At the end of the process, you want to give the client advisor the opportunity to sell some optional services such as an additional credit card, a safety-deposit box or a loan.
The Optional Documents action allows you to encode optional business cases for which a document and/or a screen (to input additional information) are needed.
The custom Optional Document action is deployed by the ActionsExtension. After installing the ActionsExtension, the Optional Documents action appears in the Element Library of the Business Rule editor.
Figure 1 shows the initial set-up of our example business case in the Business Rule editor.

Note:
The Optional Documents action should not be confused with the Document action, which is used to create the final PDF document. The Optional Document action only helps encode the additional business cases and track whether a business case has been selected by the user. It is NOT used for rendering the PDF.
The Optional Documents action uses a Named Boolean collection to encode whether a specific follow-up product has been selected. If the product has been selected, the action automatically creates a Document action and a Screen action. The Document action is used when rendering the PDF, and the Screen action is used to present a form that allows the user to input additional information for the specific case.
In order for this to work, the following Business Objects are mandatory:
- PDF Output: One PDF Output for each optional business case.
- Screen Include: One Screen Include for each optional business case.
- Document: One Document for each optional business case. The Document contains the relevant PDF Output and Screen Include.
- Rule: One or more Business Rules triggering the Optional Document actions.
- Rule Set: One Rule Set containing the relevant Business Rule(s).
- Data Class: A specific data class to track the selected state of the optional document actions, and to hold additional information per optional case. The data class must contain a Named Boolean collection to hold the "checked" states of the optional business cases. Of course, handling of additional information per optional case should be divided into one or more "child" data classes (one child class for each optional business case could be a good idea).
Figure 2 shows the various Business Objects required by our example, and the relationship between them.

Figure 3 shows a simple process handling optional documents.

The Overview Screen displays a list of Optional Document actions, allowing the user to select one or more optional business cases. Let's say our customer would like an AMEX credit card.

After selecting AMEX Credit Card, the "checked" state for all Optional Documents looks like this:
Boolean{A1=false, A2=true, A3=false}
Note: The state A2=true means "Document A2" has been checked on screen.
The Formular Screen then shows the relevant screen for the selected optional business case — in our case, the AMEX credit card.

The following code shows the Indexed Action collection after AMEX Credit Card case has been selected.
[
{
"expressions": {},
"source": "1466497801703",
"params": {
"toBeReturned": "true",
"documentTitle": "Safety-Deposit Box",
"defaultChecked": "false",
"inputFormId": "A1",
"checkedCollection": "$optBank.checked",
"documentId": "A1",
"disabled": "false",
"bindingId": "A1"
},
"type": "optionaldocument"
},
{
"expressions": {},
"source": "1466497803838",
"params": {
"toBeReturned": "true",
"documentTitle": "AMEX Credit Card",
"defaultChecked": "false",
"inputFormId": "A2",
"checkedCollection": "$optBank.checked",
"documentId": "A2",
"disabled": "false",
"bindingId": "A2"
},
"type": "optionaldocument"
},
{
"expressions": {},
"source": "1466497803838",
"bindingValues": {},
"params": {
"documentTitle": "AMEX Credit Card",
"relatedDocument": "A2",
"inputFormId": "A2",
"fromOptionalDoc": "A2"
},
"type": "inputform"
},
{
"expressions": {},
"source": "1466497803838",
"bindingValues": {},
"params": {
"toBeReturned": "true",
"documentTitle": "AMEX Credit Card",
"documentId": "A2",
"relatedScreen": "A2",
"fromOptionalDoc": "A2",
"copies": "1"
},
"type": "outputform"
},
{
"expressions": {},
"source": "1466497805384",
"params": {
"toBeReturned": "true",
"documentTitle": "Loan",
"defaultChecked": "false",
"inputFormId": "A3",
"checkedCollection": "$optBank.checked",
"documentId": "A3",
"disabled": "false",
"bindingId": "A3"
},
"type": "optionaldocument"
}
]
In the JSON data above you can see the three Optional Document actions (type: optionaldocument). Two new actions were created because the AMEX Credit Card case was selected. The additional actions are the only 'inputform' and 'outputform' actions in the collection.
If rules containing Optional Document actions are evaluated, the Action object for that action is always found in the resulting Indexed Action collection. If the Optional Document has been checked, you will find the Document action in that resulting Indexed Action collection. If applicable, the relevant Screen action will also be in the resulting Indexed Action collection.
Here is a brief summary of the steps you need to take in order to use the Optional Documents action:
- Create the PDF Output, Document and Include screen for the Optional Document
- Create the data class for capturing the "checked" state of the Optional Document
- Create the Rule triggering Optional Document actions. Make sure to use the proper path to the "checked" state collection.
The export file below contains the example case used in this recipe, illustrating how to use Optional Document business rule actions in Appway 6.3.
Optional Document example .awexport