In this chapter we will create a simple workflow, to create invoices for a chosen contact. This uses many of the features of app building you have used up to this point, and adds a new feature - context variables - which are crucial as you take users from one screen to another in a workflow.
Intermediate step: assign transaction to contact
In this exercise, we will create the intermediate step of the workflow, where the user can assign a transaction to a chosen contact. In the exercise you will need a sample file of transactions. You can download the file here:
...
Open the Contacts
dashboard, and go into App Mode. Select a contact, and press the Create Invoice
button - this will take you to the Assign Transactions
dashboard, with details for the selected contact shown.
Final step: create invoice
Widget Connector | ||||||
---|---|---|---|---|---|---|
|
Complete configuration of the invoice generation process in your app. To recap the steps in the video:
- Create a stream
Invoices
, by creating a stream from the hover menu on the streamContacts
- Set the period of the stream to Transactional
- Drag all attributes from
Contacts
intoInvoices
- Drag all attributes from
Invoice Transactions
intoInvoices
- Create a dashboard
Invoices
to show invoices: add a grid view including all attributes from the streamInvoices
, and hide theUID
field - Create a custom action that will take users from the intermediate stage of the process to the invoices screen (the intermediate dashboard is backed by the stream
Invoice Transactions
):- Open the configuration form for the stream
Invoice Transactions
, and add an action:- Name:
Complete invoice creation
- Display Name:
Complete invoice creation
- In the Action Completion section:
- Tick Close Parent Dashboard; in this case the parent dashboard will the be intermediate dashboard, used to assign transactions to a contact, so we want to close this when the user goes to complete the process
- Tick Open Post Dashboard, and drag in the dashboard
Invoices
to create a dashboard rule
- Open the section Context Parameters:
- Tick Include Previous Context Parameters - this will bring forward any context parameters from the previous dashboard, in this case
UID
- Add new context parameters, to capture new details from the intermediate dashboard - these are details of the chosen transaction
- First, get the dashboard element name of the grid view of transactions from the intermediate dashboard (
Assign Transactions
) - Use this to set the expression for each context parameter as: [dashboard element name of transactions in
Assign Transactions
].[View attribute name] - Do this for:
SKU
TransValue
TransDate
- First, get the dashboard element name of the grid view of transactions from the intermediate dashboard (
- Tick Include Previous Context Parameters - this will bring forward any context parameters from the previous dashboard, in this case
- Name:
- Open the configuration form for the stream
- Add a button to the intermediate dashboard (
Assign Transactions
) to complete the generation of an invoice:- Call the button
Complete invoice creation
- Find the custom action under the stream
Invoice Transactions
, and drag it on to the button to set the custom action - Update the button label to
Complete Invoice Creation
- Call the button
- Complete configuration of the stream
Invoices
, in the model view:- Make the stream
Contacts
static; this will stop this stream being run when the streamInvoices
is run - Open details for the pipe that connects
Contacts
andInvoices
- Set Data To Read = All; after you added importing of contacts from files into the contacts app, there are multiple runs in the
Contacts
stream, and this setting ensures that we can get all contacts down the pipe - Create a filter on the pipe:
UID
=_context.UID
(don't forget to press ABC)
- Set Data To Read = All; after you added importing of contacts from files into the contacts app, there are multiple runs in the
- Open the configuration form for the stream
Invoices
, and set the expressions forSKU
,TransDate
andTransValue
, in each case using the expression:_context.
[context parameter name]
- Make the stream
- Create a task plan,
Complete invoice creation
, to run theInvoices
stream - Complete configuration of the custom action
Complete invoice creation
:- Tick Run Selected Task Plan, and drag in the task plan
Complete invoice creation
to create a task plan rule
- Tick Run Selected Task Plan, and drag in the task plan
Panel | ||
---|---|---|
| ||
In summary, our custom action to complete invoice creation now:
|
- Add a filter to the
Invoices
dashboard to show only invoices for the currently selected user:- From the grid view in the
Invoices
dashboard, open the dashboard element details - Add a background filter:
UID
=_context.UID
(don't forget to press the ABC button)
- From the grid view in the
Open the Contacts
app, and go into App Mode. Press Create Invoice
. In the intermediate step, select a transaction, then press Complete Invoice Creation
. You should see details for a new invoice, for the contact you chose on the Contacts
dashboard, and the transaction you chose on the Assign Transactions
dashboard.
Note |
---|
An alternative method of implementing the final step of the workflow would be, instead of running analysis to update the Which method you choose is a design decision based on the the data set you are dealing with, and the process you are trying to implement. If, for example, the final step of creating invoices involves a lot of rules which are easily implemented in analysis - such as enriching the data through lookups, then the method we have used here would be best. However, if the creation of invoices involved no additional logic, using an insert action is probably easier to implement. If you have time, try and create invoices using this alternative method. |
Panel |
---|
Next chapter: 15. Controlling access to apps |